diff options
author | Ricardo Cerqueira <github@cerqueira.org> | 2012-04-28 15:43:20 +0100 |
---|---|---|
committer | Ricardo Cerqueira <github@cerqueira.org> | 2012-04-28 16:35:30 +0100 |
commit | f3e77a78c6b1ae9d58f032cb72804d52c1564238 (patch) | |
tree | 11a6ebaeb88040d183e2bcefcdca926a2455bdfb /telephony | |
parent | 690f7075b6720497ae9ae709304cca4c9b17d3d2 (diff) | |
download | frameworks_base-f3e77a78c6b1ae9d58f032cb72804d52c1564238.zip frameworks_base-f3e77a78c6b1ae9d58f032cb72804d52c1564238.tar.gz frameworks_base-f3e77a78c6b1ae9d58f032cb72804d52c1564238.tar.bz2 |
LGEQualcommRIL: Clean up processUnsolicited
At David Ferguson <ferguson.david@gmail.com>'s suggestion, remove
the full overload of processUnsolicited and have it just work with
the requests unknown by the RIL superclass. Pass everything else
upwards, unmodified.
Change-Id: Ie019fbaa3d5010bf7adc5528f3d523a77efb146f
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/LGEQualcommRIL.java | 349 |
1 files changed, 11 insertions, 338 deletions
diff --git a/telephony/java/com/android/internal/telephony/LGEQualcommRIL.java b/telephony/java/com/android/internal/telephony/LGEQualcommRIL.java index 7e9f0cf..c347700 100644 --- a/telephony/java/com/android/internal/telephony/LGEQualcommRIL.java +++ b/telephony/java/com/android/internal/telephony/LGEQualcommRIL.java @@ -248,48 +248,12 @@ public class LGEQualcommRIL extends RIL implements CommandsInterface { @Override protected void processUnsolicited (Parcel p) { - int response; Object ret; + int dataPosition = p.dataPosition(); // save off position within the Parcel + int response = p.readInt(); - response = p.readInt(); - - try {switch(response) { -/* - cat libs/telephony/ril_unsol_commands.h \ - | egrep "^ *{RIL_" \ - | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: \2(rr, p); break;/' -*/ - - case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret = responseVoid(p); break; - case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: ret = responseVoid(p); break; - case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: ret = responseVoid(p); break; - case RIL_UNSOL_RESPONSE_NEW_SMS: ret = responseString(p); break; - case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: ret = responseString(p); break; - case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: ret = responseInts(p); break; - case RIL_UNSOL_ON_USSD: ret = responseStrings(p); break; - case RIL_UNSOL_NITZ_TIME_RECEIVED: ret = responseString(p); break; - case RIL_UNSOL_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; - case RIL_UNSOL_DATA_CALL_LIST_CHANGED: ret = responseDataCallList(p);break; - case RIL_UNSOL_SUPP_SVC_NOTIFICATION: ret = responseSuppServiceNotification(p); break; - case RIL_UNSOL_STK_SESSION_END: ret = responseVoid(p); break; - case RIL_UNSOL_STK_PROACTIVE_COMMAND: ret = responseString(p); break; - case RIL_UNSOL_STK_EVENT_NOTIFY: ret = responseString(p); break; - case RIL_UNSOL_STK_CALL_SETUP: ret = responseInts(p); break; - case RIL_UNSOL_SIM_SMS_STORAGE_FULL: ret = responseVoid(p); break; - case RIL_UNSOL_SIM_REFRESH: ret = responseInts(p); break; - case RIL_UNSOL_CALL_RING: ret = responseCallRing(p); break; - case RIL_UNSOL_RESTRICTED_STATE_CHANGED: ret = responseInts(p); break; - case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: ret = responseVoid(p); break; - case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: ret = responseCdmaSms(p); break; - case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: ret = responseRaw(p); break; - case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: ret = responseVoid(p); break; - case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; - case RIL_UNSOL_CDMA_CALL_WAITING: ret = responseCdmaCallWaiting(p); break; - case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: ret = responseInts(p); break; - case RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInformationRecord(p); break; - case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break; - case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break; - case RIL_UNSOL_RESEND_INCALL_MUTE: ret = responseVoid(p); break; + switch(response) { + case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret = responseVoid(p); case 1031: ret = responseVoid(p); break; // RIL_UNSOL_VOICE_RADIO_TECH_CHANGED case 1032: ret = responseInts(p); break; // RIL_UNSOL_TETHERED_MODE_STATE_CHANGED case 1033: ret = responseVoid(p); break; // RIL_UNSOL_RESPONSE_DATA_NETWORK_STATE_CHANGED @@ -299,315 +263,24 @@ public class LGEQualcommRIL extends RIL implements CommandsInterface { case 1037: ret = responseVoid(p); break; // RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE default: - throw new RuntimeException("Unrecognized unsol response: " + response); - //break; (implied) - }} catch (Throwable tr) { - Log.e(LOG_TAG, "Exception processing unsol response: " + response + - "Exception:" + tr.toString()); - return; - } + // Rewind the Parcel + p.setDataPosition(dataPosition); + + // Forward responses that we are not overriding to the super class + super.processUnsolicited(p); + return; + } switch(response) { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: int state = p.readInt(); setRadioStateFromRILInt(state); break; - case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: - if (RILJ_LOGD) unsljLog(response); - - mCallStateRegistrants - .notifyRegistrants(new AsyncResult(null, null, null)); - break; - case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: - if (RILJ_LOGD) unsljLog(response); - - mVoiceNetworkStateRegistrants - .notifyRegistrants(new AsyncResult(null, null, null)); - break; - case RIL_UNSOL_RESPONSE_NEW_SMS: { - if (RILJ_LOGD) unsljLog(response); - - // FIXME this should move up a layer - String a[] = new String[2]; - - a[1] = (String)ret; - - SmsMessage sms; - - sms = SmsMessage.newFromCMT(a); - if (mGsmSmsRegistrant != null) { - mGsmSmsRegistrant - .notifyRegistrant(new AsyncResult(null, sms, null)); - } - break; - } - case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mSmsStatusRegistrant != null) { - mSmsStatusRegistrant.notifyRegistrant( - new AsyncResult(null, ret, null)); - } - break; - case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: - if (RILJ_LOGD) unsljLogRet(response, ret); - - int[] smsIndex = (int[])ret; - - if(smsIndex.length == 1) { - if (mSmsOnSimRegistrant != null) { - mSmsOnSimRegistrant. - notifyRegistrant(new AsyncResult(null, smsIndex, null)); - } - } else { - if (RILJ_LOGD) riljLog(" NEW_SMS_ON_SIM ERROR with wrong length " - + smsIndex.length); - } - break; - case RIL_UNSOL_ON_USSD: - String[] resp = (String[])ret; - - if (resp.length < 2) { - resp = new String[2]; - resp[0] = ((String[])ret)[0]; - resp[1] = null; - } - if (RILJ_LOGD) unsljLogMore(response, resp[0]); - if (mUSSDRegistrant != null) { - mUSSDRegistrant.notifyRegistrant( - new AsyncResult (null, resp, null)); - } - break; - case RIL_UNSOL_NITZ_TIME_RECEIVED: - if (RILJ_LOGD) unsljLogRet(response, ret); - - // has bonus long containing milliseconds since boot that the NITZ - // time was received - long nitzReceiveTime = p.readLong(); - - Object[] result = new Object[2]; - - result[0] = ret; - result[1] = Long.valueOf(nitzReceiveTime); - - if (mNITZTimeRegistrant != null) { - - mNITZTimeRegistrant - .notifyRegistrant(new AsyncResult (null, result, null)); - } else { - // in case NITZ time registrant isnt registered yet - mLastNITZTimeInfo = result; - } - break; - - case RIL_UNSOL_SIGNAL_STRENGTH: - // Note this is set to "verbose" because it happens - // frequently - if (RILJ_LOGV) unsljLogvRet(response, ret); - - if (mSignalStrengthRegistrant != null) { - mSignalStrengthRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - case RIL_UNSOL_DATA_CALL_LIST_CHANGED: - if (RILJ_LOGD) unsljLogRet(response, ret); - - mDataNetworkStateRegistrants.notifyRegistrants(new AsyncResult(null, ret, null)); - break; - - case RIL_UNSOL_SUPP_SVC_NOTIFICATION: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mSsnRegistrant != null) { - mSsnRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_STK_SESSION_END: - if (RILJ_LOGD) unsljLog(response); - - if (mCatSessionEndRegistrant != null) { - mCatSessionEndRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_STK_PROACTIVE_COMMAND: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mCatProCmdRegistrant != null) { - mCatProCmdRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_STK_EVENT_NOTIFY: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mCatEventRegistrant != null) { - mCatEventRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_STK_CALL_SETUP: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mCatCallSetUpRegistrant != null) { - mCatCallSetUpRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_SIM_SMS_STORAGE_FULL: - if (RILJ_LOGD) unsljLog(response); - - if (mIccSmsFullRegistrant != null) { - mIccSmsFullRegistrant.notifyRegistrant(); - } - break; - - case RIL_UNSOL_SIM_REFRESH: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mIccRefreshRegistrants != null) { - mIccRefreshRegistrants.notifyRegistrants( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_CALL_RING: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mRingRegistrant != null) { - mRingRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_RESTRICTED_STATE_CHANGED: - if (RILJ_LOGD) unsljLogvRet(response, ret); - if (mRestrictedStateRegistrant != null) { - mRestrictedStateRegistrant.notifyRegistrant( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: - if (RILJ_LOGD) unsljLog(response); - - if (mIccStatusChangedRegistrants != null) { - mIccStatusChangedRegistrants.notifyRegistrants(); - } - break; - - case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: - if (RILJ_LOGD) unsljLog(response); - - SmsMessage sms = (SmsMessage) ret; - - if (mCdmaSmsRegistrant != null) { - mCdmaSmsRegistrant - .notifyRegistrant(new AsyncResult(null, sms, null)); - } - break; - - case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: - if (RILJ_LOGD) unsljLog(response); - - if (mGsmBroadcastSmsRegistrant != null) { - mGsmBroadcastSmsRegistrant - .notifyRegistrant(new AsyncResult(null, ret, null)); - } - break; - - case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: - if (RILJ_LOGD) unsljLog(response); - - if (mIccSmsFullRegistrant != null) { - mIccSmsFullRegistrant.notifyRegistrant(); - } - break; - - case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: - if (RILJ_LOGD) unsljLog(response); - - if (mEmergencyCallbackModeRegistrant != null) { - mEmergencyCallbackModeRegistrant.notifyRegistrant(); - } - break; - - case RIL_UNSOL_CDMA_CALL_WAITING: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mCallWaitingInfoRegistrants != null) { - mCallWaitingInfoRegistrants.notifyRegistrants( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mOtaProvisionRegistrants != null) { - mOtaProvisionRegistrants.notifyRegistrants( - new AsyncResult (null, ret, null)); - } - break; - - case RIL_UNSOL_CDMA_INFO_REC: - ArrayList<CdmaInformationRecords> listInfoRecs; - - try { - listInfoRecs = (ArrayList<CdmaInformationRecords>)ret; - } catch (ClassCastException e) { - Log.e(LOG_TAG, "Unexpected exception casting to listInfoRecs", e); - break; - } - - for (CdmaInformationRecords rec : listInfoRecs) { - if (RILJ_LOGD) unsljLogRet(response, rec); - notifyRegistrantsCdmaInfoRec(rec); - } - break; - - case RIL_UNSOL_OEM_HOOK_RAW: - if (RILJ_LOGD) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret)); - if (mUnsolOemHookRawRegistrant != null) { - mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null)); - } - break; - - case RIL_UNSOL_RINGBACK_TONE: - if (RILJ_LOGD) unsljLogvRet(response, ret); - if (mRingbackToneRegistrants != null) { - boolean playtone = (((int[])ret)[0] == 1); - mRingbackToneRegistrants.notifyRegistrants( - new AsyncResult (null, playtone, null)); - } - break; - - case RIL_UNSOL_RESEND_INCALL_MUTE: - if (RILJ_LOGD) unsljLogRet(response, ret); - - if (mResendIncallMuteRegistrants != null) { - mResendIncallMuteRegistrants.notifyRegistrants( - new AsyncResult (null, ret, null)); - } - break; - case 1031: - break; case 1032: - break; case 1033: - break; case 1034: - break; case 1035: - break; case 1036: break; case 1037: // RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE |