use of android.os.AsyncResult in project XobotOS by xamarin.
the class AdnRecordCache method handleMessage.
//***** Overridden from Handler
public void handleMessage(Message msg) {
AsyncResult ar;
int efid;
switch(msg.what) {
case EVENT_LOAD_ALL_ADN_LIKE_DONE:
/* arg1 is efid, obj.result is ArrayList<AdnRecord>*/
ar = (AsyncResult) msg.obj;
efid = msg.arg1;
ArrayList<Message> waiters;
waiters = adnLikeWaiters.get(efid);
adnLikeWaiters.delete(efid);
if (ar.exception == null) {
adnLikeFiles.put(efid, (ArrayList<AdnRecord>) ar.result);
}
notifyWaiters(waiters, ar);
break;
case EVENT_UPDATE_ADN_DONE:
ar = (AsyncResult) msg.obj;
efid = msg.arg1;
int index = msg.arg2;
AdnRecord adn = (AdnRecord) (ar.userObj);
if (ar.exception == null) {
adnLikeFiles.get(efid).set(index - 1, adn);
mUsimPhoneBookManager.invalidateCache();
}
Message response = userWriteResponse.get(efid);
userWriteResponse.delete(efid);
AsyncResult.forMessage(response, null, ar.exception);
response.sendToTarget();
break;
}
}
use of android.os.AsyncResult in project XobotOS by xamarin.
the class BaseCommands method registerForRilConnected.
/**
* {@inheritDoc}
*/
@Override
public void registerForRilConnected(Handler h, int what, Object obj) {
Log.d(LOG_TAG, "registerForRilConnected h=" + h + " w=" + what);
Registrant r = new Registrant(h, what, obj);
mRilConnectedRegistrants.add(r);
if (mRilVersion != -1) {
Log.d(LOG_TAG, "Notifying: ril connected mRilVersion=" + mRilVersion);
r.notifyRegistrant(new AsyncResult(null, new Integer(mRilVersion), null));
}
}
Aggregations