Methods Summary |
---|
static com.android.internal.telephony.gsm.RILRequest | obtain(int request, android.os.Message result)Retrieves a new RILRequest instance from the pool.
RILRequest rr = null;
synchronized(sPoolSync) {
if (sPool != null) {
rr = sPool;
sPool = rr.mNext;
rr.mNext = null;
sPoolSize--;
}
}
if (rr == null) {
rr = new RILRequest();
}
synchronized(sSerialMonitor) {
rr.mSerial = sNextSerial++;
}
rr.mRequest = request;
rr.mResult = result;
rr.mp = Parcel.obtain();
if (result != null && result.getTarget() == null) {
throw new NullPointerException("Message target must not be null");
}
// first elements in any RIL Parcel
rr.mp.writeInt(request);
rr.mp.writeInt(rr.mSerial);
return rr;
|
void | onError(int error)
CommandException ex;
ex = CommandException.fromRilErrno(error);
if (RIL.RILJ_LOGD) Log.d(LOG_TAG, serialString() + "< "
+ RIL.requestToString(mRequest)
+ " error: " + ex);
if (mResult != null) {
AsyncResult.forMessage(mResult, null, ex);
mResult.sendToTarget();
}
if (mp != null) {
mp.recycle();
mp = null;
}
|
void | release()Returns a RILRequest instance to the pool.
Note: This should only be called once per use.
synchronized (sPoolSync) {
if (sPoolSize < MAX_POOL_SIZE) {
this.mNext = sPool;
sPool = this;
sPoolSize++;
}
}
|
static void | resetSerial()
synchronized(sSerialMonitor) {
sNextSerial = 0;
}
|
java.lang.String | serialString()
//Cheesy way to do %04d
StringBuilder sb = new StringBuilder(8);
String sn;
sn = Integer.toString(mSerial);
//sb.append("J[");
sb.append('[");
for (int i = 0, s = sn.length() ; i < 4 - s; i++) {
sb.append('0");
}
sb.append(sn);
sb.append(']");
return sb.toString();
|