Methods Summary |
---|
static com.android.internal.telephony.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();
}
rr.mSerial = sNextSerial.getAndIncrement();
rr.mRequest = request;
rr.mResult = result;
rr.mParcel = Parcel.obtain();
if (result != null && result.getTarget() == null) {
throw new NullPointerException("Message target must not be null");
}
// first elements in any RIL Parcel
rr.mParcel.writeInt(request);
rr.mParcel.writeInt(rr.mSerial);
return rr;
|
void | onError(int error, java.lang.Object ret)
CommandException ex;
ex = CommandException.fromRilErrno(error);
if (RIL.RILJ_LOGD) Rlog.d(LOG_TAG, serialString() + "< "
+ RIL.requestToString(mRequest)
+ " error: " + ex + " ret=" + RIL.retToString(mRequest, ret));
if (mResult != null) {
AsyncResult.forMessage(mResult, ret, ex);
mResult.sendToTarget();
}
if (mParcel != null) {
mParcel.recycle();
mParcel = 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) {
mNext = sPool;
sPool = this;
sPoolSize++;
mResult = null;
}
}
|
static void | resetSerial()
// use a random so that on recovery we probably don't mix old requests
// with new.
sNextSerial.set(sRandom.nextInt());
|
java.lang.String | serialString()
//Cheesy way to do %04d
StringBuilder sb = new StringBuilder(8);
String sn;
long adjustedSerial = (((long)mSerial) - Integer.MIN_VALUE)%10000;
sn = Long.toString(adjustedSerial);
//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();
|