use of android.os.AsyncResult in project XobotOS by xamarin.
the class IccRecords method registerForRecordsLoaded.
public void registerForRecordsLoaded(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj);
recordsLoadedRegistrants.add(r);
if (recordsToLoad == 0 && recordsRequested == true) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
use of android.os.AsyncResult in project XobotOS by xamarin.
the class CdmaCallTracker method registerForVoiceCallStarted.
//***** Instance Methods
//***** Public Methods
public void registerForVoiceCallStarted(Handler h, int what, Object obj) {
Registrant r = new Registrant(h, what, obj);
voiceCallStartedRegistrants.add(r);
// Notify if in call when registering
if (state != Phone.State.IDLE) {
r.notifyRegistrant(new AsyncResult(null, null, null));
}
}
use of android.os.AsyncResult in project XobotOS by xamarin.
the class CdmaCallTracker method handleMessage.
//****** Overridden from Handler
public void handleMessage(Message msg) {
AsyncResult ar;
switch(msg.what) {
case EVENT_POLL_CALLS_RESULT:
{
Log.d(LOG_TAG, "Event EVENT_POLL_CALLS_RESULT Received");
ar = (AsyncResult) msg.obj;
if (msg == lastRelevantPoll) {
if (DBG_POLL)
log("handle EVENT_POLL_CALL_RESULT: set needsPoll=F");
needsPoll = false;
lastRelevantPoll = null;
handlePollCalls((AsyncResult) msg.obj);
}
}
break;
case EVENT_OPERATION_COMPLETE:
operationComplete();
break;
case EVENT_SWITCH_RESULT:
// there is nothing to do.
break;
case EVENT_GET_LAST_CALL_FAIL_CAUSE:
int causeCode;
ar = (AsyncResult) msg.obj;
operationComplete();
if (ar.exception != null) {
// An exception occurred...just treat the disconnect
// cause as "normal"
causeCode = CallFailCause.NORMAL_CLEARING;
Log.i(LOG_TAG, "Exception during getLastCallFailCause, assuming normal disconnect");
} else {
causeCode = ((int[]) ar.result)[0];
}
for (int i = 0, s = droppedDuringPoll.size(); i < s; i++) {
CdmaConnection conn = droppedDuringPoll.get(i);
conn.onRemoteDisconnect(causeCode);
}
updatePhoneState();
phone.notifyPreciseCallStateChanged();
droppedDuringPoll.clear();
break;
case EVENT_REPOLL_AFTER_DELAY:
case EVENT_CALL_STATE_CHANGE:
pollCallsWhenSafe();
break;
case EVENT_RADIO_AVAILABLE:
handleRadioAvailable();
break;
case EVENT_RADIO_NOT_AVAILABLE:
handleRadioNotAvailable();
break;
case EVENT_EXIT_ECM_RESPONSE_CDMA:
//no matter the result, we still do the same here
if (pendingCallInEcm) {
cm.dial(pendingMO.address, pendingCallClirMode, obtainCompleteMessage());
pendingCallInEcm = false;
}
phone.unsetOnEcbModeExitResponse(this);
break;
case EVENT_CALL_WAITING_INFO_CDMA:
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
handleCallWaitingInfo((CdmaCallWaitingNotification) ar.result);
Log.d(LOG_TAG, "Event EVENT_CALL_WAITING_INFO_CDMA Received");
}
break;
case EVENT_THREE_WAY_DIAL_L2_RESULT_CDMA:
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
// Assume 3 way call is connected
pendingMO.onConnectedInOrOut();
pendingMO = null;
}
break;
default:
{
throw new RuntimeException("unexpected event not handled");
}
}
}
use of android.os.AsyncResult in project XobotOS by xamarin.
the class CatService method handleMessage.
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_ID_SESSION_END:
case MSG_ID_PROACTIVE_COMMAND:
case MSG_ID_EVENT_NOTIFY:
case MSG_ID_REFRESH:
CatLog.d(this, "ril message arrived");
String data = null;
if (msg.obj != null) {
AsyncResult ar = (AsyncResult) msg.obj;
if (ar != null && ar.result != null) {
try {
data = (String) ar.result;
} catch (ClassCastException e) {
break;
}
}
}
mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, data));
break;
case MSG_ID_CALL_SETUP:
mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, null));
break;
case MSG_ID_ICC_RECORDS_LOADED:
break;
case MSG_ID_RIL_MSG_DECODED:
handleRilMsg((RilMessage) msg.obj);
break;
case MSG_ID_RESPONSE:
handleCmdResponse((CatResponseMessage) msg.obj);
break;
case MSG_ID_SIM_READY:
CatLog.d(this, "SIM ready. Reporting STK service running now...");
mCmdIf.reportStkServiceIsRunning(null);
break;
default:
throw new AssertionError("Unrecognized CAT command: " + msg.what);
}
}
use of android.os.AsyncResult in project XobotOS by xamarin.
the class IconLoader method handleMessage.
@Override
public void handleMessage(Message msg) {
AsyncResult ar;
try {
switch(msg.what) {
case EVENT_READ_EF_IMG_RECOED_DONE:
ar = (AsyncResult) msg.obj;
if (handleImageDescriptor((byte[]) ar.result)) {
readIconData();
} else {
throw new Exception("Unable to parse image descriptor");
}
break;
case EVENT_READ_ICON_DONE:
ar = (AsyncResult) msg.obj;
byte[] rawData = ((byte[]) ar.result);
if (mId.codingScheme == ImageDescriptor.CODING_SCHEME_BASIC) {
mCurrentIcon = parseToBnW(rawData, rawData.length);
mIconsCache.put(mRecordNumber, mCurrentIcon);
postIcon();
} else if (mId.codingScheme == ImageDescriptor.CODING_SCHEME_COLOUR) {
mIconData = rawData;
readClut();
}
break;
case EVENT_READ_CLUT_DONE:
ar = (AsyncResult) msg.obj;
byte[] clut = ((byte[]) ar.result);
mCurrentIcon = parseToRGB(mIconData, mIconData.length, false, clut);
mIconsCache.put(mRecordNumber, mCurrentIcon);
postIcon();
break;
}
} catch (Exception e) {
CatLog.d(this, "Icon load failed");
// post null icon back to the caller.
postIcon();
}
}
Aggregations