Loading src/java/android/telephony/SmsMessage.java +5 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.telephony; import android.os.Binder; import android.os.Parcel; import android.content.res.Resources; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.text.TextUtils; import com.android.internal.telephony.GsmAlphabet; Loading Loading @@ -221,10 +222,10 @@ public class SmsMessage { * * {@hide} */ public static SmsMessage newFromCMT(String[] lines) { public static SmsMessage newFromCMT(byte[] pdu) { // received SMS in 3GPP format SmsMessageBase wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.newFromCMT(lines); com.android.internal.telephony.gsm.SmsMessage.newFromCMT(pdu); if (wrappedMessage != null) { return new SmsMessage(wrappedMessage); Loading @@ -235,10 +236,10 @@ public class SmsMessage { } /** @hide */ public static SmsMessage newFromParcel(Parcel p) { public static SmsMessage newCdmaSmsFromRil(CdmaSmsMessage msg) { // received SMS in 3GPP2 format SmsMessageBase wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromParcel(p); com.android.internal.telephony.cdma.SmsMessage.newFromRil(msg); return new SmsMessage(wrappedMessage); } Loading src/java/com/android/internal/telephony/RIL.java +67 −245 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.hardware.radio.V1_0.RadioError; import android.hardware.radio.V1_0.RadioIndicationType; import android.hardware.radio.V1_0.RadioResponseInfo; import android.hardware.radio.V1_0.RadioResponseType; import android.hardware.radio.V1_0.SetupDataCallResult; import android.hardware.radio.V1_0.UusInfo; import android.net.ConnectivityManager; import android.net.LocalSocket; Loading Loading @@ -2661,7 +2662,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { void processIndication(int indicationType) { if (indicationType == RadioIndicationType.UNSOLICITED_ACK_EXP) { sendAck(); if (RIL.RILJ_LOGD) riljLog("Unsol response received; Sending ack to ril.cpp"); if (RILJ_LOGD) riljLog("Unsol response received; Sending ack to ril.cpp"); } else { // ack is not expected to be sent back. Nothing is required to be done here. } Loading Loading @@ -2754,8 +2755,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { /** * This is a helper function to be called at the end of all RadioResponse callbacks. * It takes care of logging, decrementing wakelock if needed, and releases the request from * memory pool. * It takes care of sending error response, logging, decrementing wakelock if needed, and * releases the request from memory pool. * @param rr RILRequest for which response callback was called * @param responseInfo RadioResponseInfo received in the callback * @param ret object to be returned to request sender Loading Loading @@ -3399,6 +3400,14 @@ public final class RIL extends BaseCommands implements CommandsInterface { return s; } void writeMetricsNewSms(int tech, int format) { mMetrics.writeRilNewSms(mInstanceId, tech, format); } void writeMetricsCallRing(char[] response) { mMetrics.writeRilCallRing(mInstanceId, response); } private void processUnsolicited (Parcel p, int type) { int response; Loading @@ -3421,33 +3430,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { } 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 = responseSimRefresh(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; Loading Loading @@ -3491,103 +3475,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { mImsNetworkStateChangedRegistrants .notifyRegistrants(new AsyncResult(null, null, null)); 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); mMetrics.writeRilNewSms(mInstanceId, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP); // 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); boolean ignoreNitz = SystemProperties.getBoolean( TelephonyProperties.PROPERTY_IGNORE_NITZ, false); if (ignoreNitz) { if (RILJ_LOGD) riljLog("ignoring UNSOL_NITZ_TIME_RECEIVED"); } else { if (mNITZTimeRegistrant != null) { mNITZTimeRegistrant .notifyRegistrant(new AsyncResult (null, result, null)); } // in case NITZ time registrant isn't registered yet, or a new registrant // registers later mLastNITZTimeInfo = result; } break; case RIL_UNSOL_SIGNAL_STRENGTH: // Note this is set to "verbose" because it happens Loading @@ -3599,82 +3486,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { 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) unsljLog(response); if (mCatProCmdRegistrant != null) { mCatProCmdRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_STK_EVENT_NOTIFY: if (RILJ_LOGD) unsljLog(response); 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); Loading @@ -3684,28 +3495,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { } 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); mMetrics.writeRilNewSms(mInstanceId, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2); 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) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret)); Loading Loading @@ -4001,14 +3790,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { return notification; } private Object responseCdmaSms(Parcel p) { SmsMessage sms; sms = SmsMessage.newFromParcel(p); return sms; } private Object responseString(Parcel p) { String response; Loading Loading @@ -4393,20 +4174,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { return notification; } private Object responseCallRing(Parcel p){ char response[] = new char[4]; response[0] = (char) p.readInt(); // isPresent response[1] = (char) p.readInt(); // signalType response[2] = (char) p.readInt(); // alertPitch response[3] = (char) p.readInt(); // signal mMetrics.writeRilCallRing(mInstanceId, response); return response; } private void notifyRegistrantsCdmaInfoRec(CdmaInformationRecords infoRec) { int response = RIL_UNSOL_CDMA_INFO_REC; Loading Loading @@ -5501,4 +5268,59 @@ public final class RIL extends BaseCommands implements CommandsInterface { public List<ClientRequestStats> getClientRequestStats() { return mClientWakelockTracker.getClientRequestStats(); } public static byte[] arrayListToPrimitiveArray(ArrayList<Byte> bytes) { byte[] ret = new byte[bytes.size()]; for (int i = 0; i < ret.length; i++) { ret[i] = bytes.get(i); } return ret; } static ArrayList<DataCallResponse> convertHalDcList(ArrayList<SetupDataCallResult> dcList) { ArrayList<DataCallResponse> dcResponseList; int num = 0; if (dcList != null) { num = dcList.size(); } dcResponseList = new ArrayList<>(num); for (int i = 0; i < num; i++) { DataCallResponse dcResponse = new DataCallResponse(); SetupDataCallResult dc = dcList.get(i); // todo: get rid of this version field? // todo: create a DataCallResponse constructor that takes in these fields to make sure // no fields are missing dcResponse.version = 11; dcResponse.status = dc.status; dcResponse.suggestedRetryTime = dc.suggestedRetryTime; dcResponse.cid = dc.cid; dcResponse.active = dc.active; dcResponse.type = dc.type; dcResponse.ifname = dc.ifname; if ((dcResponse.status == DcFailCause.NONE.getErrorCode()) && TextUtils.isEmpty(dcResponse.ifname)) { throw new RuntimeException("getDataCallResponse, no ifname"); } String addresses = dc.addresses; if (!TextUtils.isEmpty(addresses)) { dcResponse.addresses = addresses.split(" "); } String dnses = dc.dnses; if (!TextUtils.isEmpty(dnses)) { dcResponse.dnses = dnses.split(" "); } String gateways = dc.gateways; if (!TextUtils.isEmpty(gateways)) { dcResponse.gateways = gateways.split(" "); } String pcscf = dc.pcscf; if (!TextUtils.isEmpty(pcscf)) { dcResponse.pcscf = pcscf.split(" "); } dcResponse.mtu = dc.mtu; dcResponseList.add(dcResponse); } return dcResponseList; } } src/java/com/android/internal/telephony/RadioIndication.java +289 −49 File changed.Preview size limit exceeded, changes collapsed. Show changes src/java/com/android/internal/telephony/cdma/SmsMessage.java +18 −18 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony.cdma; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.os.Parcel; import android.os.SystemProperties; import android.telephony.PhoneNumberUtils; Loading Loading @@ -127,7 +128,7 @@ public class SmsMessage extends SmsMessageBase { * Create a "raw" CDMA SmsMessage from a Parcel that was forged in ril.cpp. * Note: Only primitive fields are set. */ public static SmsMessage newFromParcel(Parcel p) { public static SmsMessage newFromRil(CdmaSmsMessage cdmaSmsMessage) { // Note: Parcel.readByte actually reads one Int and masks to byte SmsMessage msg = new SmsMessage(); SmsEnvelope env = new SmsEnvelope(); Loading @@ -139,9 +140,9 @@ public class SmsMessage extends SmsMessageBase { int addressDigitMode; //currently not supported by the modem-lib: env.mMessageType env.teleService = p.readInt(); //p_cur->uTeleserviceID env.teleService = cdmaSmsMessage.teleserviceId; if (0 != p.readByte()) { //p_cur->bIsServicePresent if (cdmaSmsMessage.isServicePresent) { env.messageType = SmsEnvelope.MESSAGE_TYPE_BROADCAST; } else { Loading @@ -152,20 +153,19 @@ public class SmsMessage extends SmsMessageBase { env.messageType = SmsEnvelope.MESSAGE_TYPE_POINT_TO_POINT; } } env.serviceCategory = p.readInt(); //p_cur->uServicecategory env.serviceCategory = cdmaSmsMessage.serviceCategory; // address addressDigitMode = p.readInt(); addr.digitMode = (byte) (0xFF & addressDigitMode); //p_cur->sAddress.digit_mode addr.numberMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_mode addr.ton = p.readInt(); //p_cur->sAddress.number_type addr.numberPlan = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_plan count = p.readByte(); //p_cur->sAddress.number_of_digits addressDigitMode = cdmaSmsMessage.address.digitMode; addr.digitMode = (byte) (0xFF & addressDigitMode); addr.numberMode = (byte) (0xFF & cdmaSmsMessage.address.numberMode); addr.ton = cdmaSmsMessage.address.numberType; addr.numberPlan = (byte) (0xFF & cdmaSmsMessage.address.numberPlan); count = (byte) cdmaSmsMessage.address.digits.size(); addr.numberOfDigits = count; data = new byte[count]; //p_cur->sAddress.digits[digitCount] for (int index=0; index < count; index++) { data[index] = p.readByte(); data[index] = cdmaSmsMessage.address.digits.get(index); // convert the value if it is 4-bit DTMF to 8 bit if (addressDigitMode == CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF) { Loading @@ -175,9 +175,9 @@ public class SmsMessage extends SmsMessageBase { addr.origBytes = data; subaddr.type = p.readInt(); // p_cur->sSubAddress.subaddressType subaddr.odd = p.readByte(); // p_cur->sSubAddress.odd count = p.readByte(); // p_cur->sSubAddress.number_of_digits subaddr.type = cdmaSmsMessage.subAddress.subaddressType; subaddr.odd = (byte) (cdmaSmsMessage.subAddress.odd ? 1 : 0); count = (byte) cdmaSmsMessage.subAddress.digits.size(); if (count < 0) { count = 0; Loading @@ -188,7 +188,7 @@ public class SmsMessage extends SmsMessageBase { data = new byte[count]; for (int index = 0; index < count; ++index) { data[index] = p.readByte(); data[index] = cdmaSmsMessage.subAddress.digits.get(index); } subaddr.origBytes = data; Loading @@ -201,14 +201,14 @@ public class SmsMessage extends SmsMessageBase { */ // bearer data countInt = p.readInt(); //p_cur->uBearerDataLen countInt = cdmaSmsMessage.bearerData.size(); if (countInt < 0) { countInt = 0; } data = new byte[countInt]; for (int index=0; index < countInt; index++) { data[index] = p.readByte(); data[index] = cdmaSmsMessage.bearerData.get(index); } // BD gets further decoded when accessed in SMSDispatcher env.bearerData = data; Loading src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java +3 −3 Original line number Diff line number Diff line Loading @@ -117,8 +117,8 @@ public final class GsmSMSDispatcher extends SMSDispatcher { * be a String representing the status report PDU, as ASCII hex. */ private void handleStatusReport(AsyncResult ar) { String pduString = (String) ar.result; SmsMessage sms = SmsMessage.newFromCDS(pduString); byte[] pdu = (byte[]) ar.result; SmsMessage sms = SmsMessage.newFromCDS(pdu); if (sms != null) { int tpStatus = sms.getStatus(); Loading @@ -134,7 +134,7 @@ public final class GsmSMSDispatcher extends SMSDispatcher { } PendingIntent intent = tracker.mDeliveryIntent; Intent fillIn = new Intent(); fillIn.putExtra("pdu", IccUtils.hexStringToBytes(pduString)); fillIn.putExtra("pdu", pdu); fillIn.putExtra("format", getFormat()); try { intent.send(mContext, Activity.RESULT_OK, fillIn); Loading Loading
src/java/android/telephony/SmsMessage.java +5 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.telephony; import android.os.Binder; import android.os.Parcel; import android.content.res.Resources; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.text.TextUtils; import com.android.internal.telephony.GsmAlphabet; Loading Loading @@ -221,10 +222,10 @@ public class SmsMessage { * * {@hide} */ public static SmsMessage newFromCMT(String[] lines) { public static SmsMessage newFromCMT(byte[] pdu) { // received SMS in 3GPP format SmsMessageBase wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.newFromCMT(lines); com.android.internal.telephony.gsm.SmsMessage.newFromCMT(pdu); if (wrappedMessage != null) { return new SmsMessage(wrappedMessage); Loading @@ -235,10 +236,10 @@ public class SmsMessage { } /** @hide */ public static SmsMessage newFromParcel(Parcel p) { public static SmsMessage newCdmaSmsFromRil(CdmaSmsMessage msg) { // received SMS in 3GPP2 format SmsMessageBase wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromParcel(p); com.android.internal.telephony.cdma.SmsMessage.newFromRil(msg); return new SmsMessage(wrappedMessage); } Loading
src/java/com/android/internal/telephony/RIL.java +67 −245 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.hardware.radio.V1_0.RadioError; import android.hardware.radio.V1_0.RadioIndicationType; import android.hardware.radio.V1_0.RadioResponseInfo; import android.hardware.radio.V1_0.RadioResponseType; import android.hardware.radio.V1_0.SetupDataCallResult; import android.hardware.radio.V1_0.UusInfo; import android.net.ConnectivityManager; import android.net.LocalSocket; Loading Loading @@ -2661,7 +2662,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { void processIndication(int indicationType) { if (indicationType == RadioIndicationType.UNSOLICITED_ACK_EXP) { sendAck(); if (RIL.RILJ_LOGD) riljLog("Unsol response received; Sending ack to ril.cpp"); if (RILJ_LOGD) riljLog("Unsol response received; Sending ack to ril.cpp"); } else { // ack is not expected to be sent back. Nothing is required to be done here. } Loading Loading @@ -2754,8 +2755,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { /** * This is a helper function to be called at the end of all RadioResponse callbacks. * It takes care of logging, decrementing wakelock if needed, and releases the request from * memory pool. * It takes care of sending error response, logging, decrementing wakelock if needed, and * releases the request from memory pool. * @param rr RILRequest for which response callback was called * @param responseInfo RadioResponseInfo received in the callback * @param ret object to be returned to request sender Loading Loading @@ -3399,6 +3400,14 @@ public final class RIL extends BaseCommands implements CommandsInterface { return s; } void writeMetricsNewSms(int tech, int format) { mMetrics.writeRilNewSms(mInstanceId, tech, format); } void writeMetricsCallRing(char[] response) { mMetrics.writeRilCallRing(mInstanceId, response); } private void processUnsolicited (Parcel p, int type) { int response; Loading @@ -3421,33 +3430,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { } 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 = responseSimRefresh(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; Loading Loading @@ -3491,103 +3475,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { mImsNetworkStateChangedRegistrants .notifyRegistrants(new AsyncResult(null, null, null)); 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); mMetrics.writeRilNewSms(mInstanceId, SmsSession.Event.Tech.SMS_GSM, SmsSession.Event.Format.SMS_FORMAT_3GPP); // 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); boolean ignoreNitz = SystemProperties.getBoolean( TelephonyProperties.PROPERTY_IGNORE_NITZ, false); if (ignoreNitz) { if (RILJ_LOGD) riljLog("ignoring UNSOL_NITZ_TIME_RECEIVED"); } else { if (mNITZTimeRegistrant != null) { mNITZTimeRegistrant .notifyRegistrant(new AsyncResult (null, result, null)); } // in case NITZ time registrant isn't registered yet, or a new registrant // registers later mLastNITZTimeInfo = result; } break; case RIL_UNSOL_SIGNAL_STRENGTH: // Note this is set to "verbose" because it happens Loading @@ -3599,82 +3486,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { 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) unsljLog(response); if (mCatProCmdRegistrant != null) { mCatProCmdRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_STK_EVENT_NOTIFY: if (RILJ_LOGD) unsljLog(response); 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); Loading @@ -3684,28 +3495,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { } 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); mMetrics.writeRilNewSms(mInstanceId, SmsSession.Event.Tech.SMS_CDMA, SmsSession.Event.Format.SMS_FORMAT_3GPP2); 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) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret)); Loading Loading @@ -4001,14 +3790,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { return notification; } private Object responseCdmaSms(Parcel p) { SmsMessage sms; sms = SmsMessage.newFromParcel(p); return sms; } private Object responseString(Parcel p) { String response; Loading Loading @@ -4393,20 +4174,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { return notification; } private Object responseCallRing(Parcel p){ char response[] = new char[4]; response[0] = (char) p.readInt(); // isPresent response[1] = (char) p.readInt(); // signalType response[2] = (char) p.readInt(); // alertPitch response[3] = (char) p.readInt(); // signal mMetrics.writeRilCallRing(mInstanceId, response); return response; } private void notifyRegistrantsCdmaInfoRec(CdmaInformationRecords infoRec) { int response = RIL_UNSOL_CDMA_INFO_REC; Loading Loading @@ -5501,4 +5268,59 @@ public final class RIL extends BaseCommands implements CommandsInterface { public List<ClientRequestStats> getClientRequestStats() { return mClientWakelockTracker.getClientRequestStats(); } public static byte[] arrayListToPrimitiveArray(ArrayList<Byte> bytes) { byte[] ret = new byte[bytes.size()]; for (int i = 0; i < ret.length; i++) { ret[i] = bytes.get(i); } return ret; } static ArrayList<DataCallResponse> convertHalDcList(ArrayList<SetupDataCallResult> dcList) { ArrayList<DataCallResponse> dcResponseList; int num = 0; if (dcList != null) { num = dcList.size(); } dcResponseList = new ArrayList<>(num); for (int i = 0; i < num; i++) { DataCallResponse dcResponse = new DataCallResponse(); SetupDataCallResult dc = dcList.get(i); // todo: get rid of this version field? // todo: create a DataCallResponse constructor that takes in these fields to make sure // no fields are missing dcResponse.version = 11; dcResponse.status = dc.status; dcResponse.suggestedRetryTime = dc.suggestedRetryTime; dcResponse.cid = dc.cid; dcResponse.active = dc.active; dcResponse.type = dc.type; dcResponse.ifname = dc.ifname; if ((dcResponse.status == DcFailCause.NONE.getErrorCode()) && TextUtils.isEmpty(dcResponse.ifname)) { throw new RuntimeException("getDataCallResponse, no ifname"); } String addresses = dc.addresses; if (!TextUtils.isEmpty(addresses)) { dcResponse.addresses = addresses.split(" "); } String dnses = dc.dnses; if (!TextUtils.isEmpty(dnses)) { dcResponse.dnses = dnses.split(" "); } String gateways = dc.gateways; if (!TextUtils.isEmpty(gateways)) { dcResponse.gateways = gateways.split(" "); } String pcscf = dc.pcscf; if (!TextUtils.isEmpty(pcscf)) { dcResponse.pcscf = pcscf.split(" "); } dcResponse.mtu = dc.mtu; dcResponseList.add(dcResponse); } return dcResponseList; } }
src/java/com/android/internal/telephony/RadioIndication.java +289 −49 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/java/com/android/internal/telephony/cdma/SmsMessage.java +18 −18 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.internal.telephony.cdma; import android.hardware.radio.V1_0.CdmaSmsMessage; import android.os.Parcel; import android.os.SystemProperties; import android.telephony.PhoneNumberUtils; Loading Loading @@ -127,7 +128,7 @@ public class SmsMessage extends SmsMessageBase { * Create a "raw" CDMA SmsMessage from a Parcel that was forged in ril.cpp. * Note: Only primitive fields are set. */ public static SmsMessage newFromParcel(Parcel p) { public static SmsMessage newFromRil(CdmaSmsMessage cdmaSmsMessage) { // Note: Parcel.readByte actually reads one Int and masks to byte SmsMessage msg = new SmsMessage(); SmsEnvelope env = new SmsEnvelope(); Loading @@ -139,9 +140,9 @@ public class SmsMessage extends SmsMessageBase { int addressDigitMode; //currently not supported by the modem-lib: env.mMessageType env.teleService = p.readInt(); //p_cur->uTeleserviceID env.teleService = cdmaSmsMessage.teleserviceId; if (0 != p.readByte()) { //p_cur->bIsServicePresent if (cdmaSmsMessage.isServicePresent) { env.messageType = SmsEnvelope.MESSAGE_TYPE_BROADCAST; } else { Loading @@ -152,20 +153,19 @@ public class SmsMessage extends SmsMessageBase { env.messageType = SmsEnvelope.MESSAGE_TYPE_POINT_TO_POINT; } } env.serviceCategory = p.readInt(); //p_cur->uServicecategory env.serviceCategory = cdmaSmsMessage.serviceCategory; // address addressDigitMode = p.readInt(); addr.digitMode = (byte) (0xFF & addressDigitMode); //p_cur->sAddress.digit_mode addr.numberMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_mode addr.ton = p.readInt(); //p_cur->sAddress.number_type addr.numberPlan = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_plan count = p.readByte(); //p_cur->sAddress.number_of_digits addressDigitMode = cdmaSmsMessage.address.digitMode; addr.digitMode = (byte) (0xFF & addressDigitMode); addr.numberMode = (byte) (0xFF & cdmaSmsMessage.address.numberMode); addr.ton = cdmaSmsMessage.address.numberType; addr.numberPlan = (byte) (0xFF & cdmaSmsMessage.address.numberPlan); count = (byte) cdmaSmsMessage.address.digits.size(); addr.numberOfDigits = count; data = new byte[count]; //p_cur->sAddress.digits[digitCount] for (int index=0; index < count; index++) { data[index] = p.readByte(); data[index] = cdmaSmsMessage.address.digits.get(index); // convert the value if it is 4-bit DTMF to 8 bit if (addressDigitMode == CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF) { Loading @@ -175,9 +175,9 @@ public class SmsMessage extends SmsMessageBase { addr.origBytes = data; subaddr.type = p.readInt(); // p_cur->sSubAddress.subaddressType subaddr.odd = p.readByte(); // p_cur->sSubAddress.odd count = p.readByte(); // p_cur->sSubAddress.number_of_digits subaddr.type = cdmaSmsMessage.subAddress.subaddressType; subaddr.odd = (byte) (cdmaSmsMessage.subAddress.odd ? 1 : 0); count = (byte) cdmaSmsMessage.subAddress.digits.size(); if (count < 0) { count = 0; Loading @@ -188,7 +188,7 @@ public class SmsMessage extends SmsMessageBase { data = new byte[count]; for (int index = 0; index < count; ++index) { data[index] = p.readByte(); data[index] = cdmaSmsMessage.subAddress.digits.get(index); } subaddr.origBytes = data; Loading @@ -201,14 +201,14 @@ public class SmsMessage extends SmsMessageBase { */ // bearer data countInt = p.readInt(); //p_cur->uBearerDataLen countInt = cdmaSmsMessage.bearerData.size(); if (countInt < 0) { countInt = 0; } data = new byte[countInt]; for (int index=0; index < countInt; index++) { data[index] = p.readByte(); data[index] = cdmaSmsMessage.bearerData.get(index); } // BD gets further decoded when accessed in SMSDispatcher env.bearerData = data; Loading
src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java +3 −3 Original line number Diff line number Diff line Loading @@ -117,8 +117,8 @@ public final class GsmSMSDispatcher extends SMSDispatcher { * be a String representing the status report PDU, as ASCII hex. */ private void handleStatusReport(AsyncResult ar) { String pduString = (String) ar.result; SmsMessage sms = SmsMessage.newFromCDS(pduString); byte[] pdu = (byte[]) ar.result; SmsMessage sms = SmsMessage.newFromCDS(pdu); if (sms != null) { int tpStatus = sms.getStatus(); Loading @@ -134,7 +134,7 @@ public final class GsmSMSDispatcher extends SMSDispatcher { } PendingIntent intent = tracker.mDeliveryIntent; Intent fillIn = new Intent(); fillIn.putExtra("pdu", IccUtils.hexStringToBytes(pduString)); fillIn.putExtra("pdu", pdu); fillIn.putExtra("format", getFormat()); try { intent.send(mContext, Activity.RESULT_OK, fillIn); Loading