From 023346cf9050c146a36eedd14886d0e9a679dc49 Mon Sep 17 00:00:00 2001 From: Jake Hamby Date: Tue, 3 Dec 2013 13:21:40 -0800 Subject: Fix OOBE crash/DoS after receiving 0-byte WAP push. Add a try/catch block around the code in WapPushOverSms.dispatchWapPdu(), so we don't get into a reboot trap on receiving weirdly formed messages. Only catch ArrayIndexOutOfBoundsException, which is difficult to prevent inside dispatchWapPdu() for 0-byte PDUs or other unusual contents. The caller should probably catch any unhandled exceptions of other types and log them with stack traces. Bug: 11967705 Change-Id: Iabfec68d2564dd438d45c80cdba877bf19fa0397 --- .../android/internal/telephony/WapPushOverSms.java | 293 +++++++++++---------- 1 file changed, 150 insertions(+), 143 deletions(-) diff --git a/src/java/com/android/internal/telephony/WapPushOverSms.java b/src/java/com/android/internal/telephony/WapPushOverSms.java index 87b38109a..2f22794cb 100755 --- a/src/java/com/android/internal/telephony/WapPushOverSms.java +++ b/src/java/com/android/internal/telephony/WapPushOverSms.java @@ -90,168 +90,175 @@ public class WapPushOverSms implements ServiceConnection { if (DBG) Rlog.d(TAG, "Rx: " + IccUtils.bytesToHexString(pdu)); - int index = 0; - int transactionId = pdu[index++] & 0xFF; - int pduType = pdu[index++] & 0xFF; - - if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) && - (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { - index = mContext.getResources().getInteger( - com.android.internal.R.integer.config_valid_wappush_index); - if(index != -1) { - transactionId = pdu[index++] & 0xff; - pduType = pdu[index++] & 0xff; - if (DBG) - Rlog.d(TAG, "index = " + index + " PDU Type = " + pduType + - " transactionID = " + transactionId); - - // recheck wap push pduType - if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) - && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { + try { + int index = 0; + int transactionId = pdu[index++] & 0xFF; + int pduType = pdu[index++] & 0xFF; + + if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) && + (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { + index = mContext.getResources().getInteger( + com.android.internal.R.integer.config_valid_wappush_index); + if (index != -1) { + transactionId = pdu[index++] & 0xff; + pduType = pdu[index++] & 0xff; + if (DBG) + Rlog.d(TAG, "index = " + index + " PDU Type = " + pduType + + " transactionID = " + transactionId); + + // recheck wap push pduType + if ((pduType != WspTypeDecoder.PDU_TYPE_PUSH) + && (pduType != WspTypeDecoder.PDU_TYPE_CONFIRMED_PUSH)) { + if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); + return Intents.RESULT_SMS_HANDLED; + } + } else { if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); return Intents.RESULT_SMS_HANDLED; } - } else { - if (DBG) Rlog.w(TAG, "Received non-PUSH WAP PDU. Type = " + pduType); - return Intents.RESULT_SMS_HANDLED; } - } - - WspTypeDecoder pduDecoder = new WspTypeDecoder(pdu); - /** - * Parse HeaderLen(unsigned integer). - * From wap-230-wsp-20010705-a section 8.1.2 - * The maximum size of a uintvar is 32 bits. - * So it will be encoded in no more than 5 octets. - */ - if (pduDecoder.decodeUintvarInteger(index) == false) { - if (DBG) Rlog.w(TAG, "Received PDU. Header Length error."); - return Intents.RESULT_SMS_GENERIC_ERROR; - } - int headerLength = (int) pduDecoder.getValue32(); - index += pduDecoder.getDecodedDataLength(); - - int headerStartIndex = index; - - /** - * Parse Content-Type. - * From wap-230-wsp-20010705-a section 8.4.2.24 - * - * Content-type-value = Constrained-media | Content-general-form - * Content-general-form = Value-length Media-type - * Media-type = (Well-known-media | Extension-Media) *(Parameter) - * Value-length = Short-length | (Length-quote Length) - * Short-length = (octet <= WAP_PDU_SHORT_LENGTH_MAX) - * Length-quote = (WAP_PDU_LENGTH_QUOTE) - * Length = Uintvar-integer - */ - if (pduDecoder.decodeContentType(index) == false) { - if (DBG) Rlog.w(TAG, "Received PDU. Header Content-Type error."); - return Intents.RESULT_SMS_GENERIC_ERROR; - } - - String mimeType = pduDecoder.getValueString(); - long binaryContentType = pduDecoder.getValue32(); - index += pduDecoder.getDecodedDataLength(); + WspTypeDecoder pduDecoder = new WspTypeDecoder(pdu); + + /** + * Parse HeaderLen(unsigned integer). + * From wap-230-wsp-20010705-a section 8.1.2 + * The maximum size of a uintvar is 32 bits. + * So it will be encoded in no more than 5 octets. + */ + if (pduDecoder.decodeUintvarInteger(index) == false) { + if (DBG) Rlog.w(TAG, "Received PDU. Header Length error."); + return Intents.RESULT_SMS_GENERIC_ERROR; + } + int headerLength = (int) pduDecoder.getValue32(); + index += pduDecoder.getDecodedDataLength(); + + int headerStartIndex = index; + + /** + * Parse Content-Type. + * From wap-230-wsp-20010705-a section 8.4.2.24 + * + * Content-type-value = Constrained-media | Content-general-form + * Content-general-form = Value-length Media-type + * Media-type = (Well-known-media | Extension-Media) *(Parameter) + * Value-length = Short-length | (Length-quote Length) + * Short-length = (octet <= WAP_PDU_SHORT_LENGTH_MAX) + * Length-quote = (WAP_PDU_LENGTH_QUOTE) + * Length = Uintvar-integer + */ + if (pduDecoder.decodeContentType(index) == false) { + if (DBG) Rlog.w(TAG, "Received PDU. Header Content-Type error."); + return Intents.RESULT_SMS_GENERIC_ERROR; + } - byte[] header = new byte[headerLength]; - System.arraycopy(pdu, headerStartIndex, header, 0, header.length); + String mimeType = pduDecoder.getValueString(); + long binaryContentType = pduDecoder.getValue32(); + index += pduDecoder.getDecodedDataLength(); - byte[] intentData; + byte[] header = new byte[headerLength]; + System.arraycopy(pdu, headerStartIndex, header, 0, header.length); - if (mimeType != null && mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO)) { - intentData = pdu; - } else { - int dataIndex = headerStartIndex + headerLength; - intentData = new byte[pdu.length - dataIndex]; - System.arraycopy(pdu, dataIndex, intentData, 0, intentData.length); - } + byte[] intentData; - /** - * Seek for application ID field in WSP header. - * If application ID is found, WapPushManager substitute the message - * processing. Since WapPushManager is optional module, if WapPushManager - * is not found, legacy message processing will be continued. - */ - if (pduDecoder.seekXWapApplicationId(index, index + headerLength - 1)) { - index = (int) pduDecoder.getValue32(); - pduDecoder.decodeXWapApplicationId(index); - String wapAppId = pduDecoder.getValueString(); - if (wapAppId == null) { - wapAppId = Integer.toString((int) pduDecoder.getValue32()); + if (mimeType != null && mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO)) { + intentData = pdu; + } else { + int dataIndex = headerStartIndex + headerLength; + intentData = new byte[pdu.length - dataIndex]; + System.arraycopy(pdu, dataIndex, intentData, 0, intentData.length); } - String contentType = ((mimeType == null) ? - Long.toString(binaryContentType) : mimeType); - if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); - - try { - boolean processFurther = true; - IWapPushManager wapPushMan = mWapPushManager; + /** + * Seek for application ID field in WSP header. + * If application ID is found, WapPushManager substitute the message + * processing. Since WapPushManager is optional module, if WapPushManager + * is not found, legacy message processing will be continued. + */ + if (pduDecoder.seekXWapApplicationId(index, index + headerLength - 1)) { + index = (int) pduDecoder.getValue32(); + pduDecoder.decodeXWapApplicationId(index); + String wapAppId = pduDecoder.getValueString(); + if (wapAppId == null) { + wapAppId = Integer.toString((int) pduDecoder.getValue32()); + } - if (wapPushMan == null) { - if (DBG) Rlog.w(TAG, "wap push manager not found!"); - } else { - Intent intent = new Intent(); - intent.putExtra("transactionId", transactionId); - intent.putExtra("pduType", pduType); - intent.putExtra("header", header); - intent.putExtra("data", intentData); - intent.putExtra("contentTypeParameters", - pduDecoder.getContentParameters()); - - int procRet = wapPushMan.processMessage(wapAppId, contentType, intent); - if (DBG) Rlog.v(TAG, "procRet:" + procRet); - if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0 - && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) { - processFurther = false; + String contentType = ((mimeType == null) ? + Long.toString(binaryContentType) : mimeType); + if (DBG) Rlog.v(TAG, "appid found: " + wapAppId + ":" + contentType); + + try { + boolean processFurther = true; + IWapPushManager wapPushMan = mWapPushManager; + + if (wapPushMan == null) { + if (DBG) Rlog.w(TAG, "wap push manager not found!"); + } else { + Intent intent = new Intent(); + intent.putExtra("transactionId", transactionId); + intent.putExtra("pduType", pduType); + intent.putExtra("header", header); + intent.putExtra("data", intentData); + intent.putExtra("contentTypeParameters", + pduDecoder.getContentParameters()); + + int procRet = wapPushMan.processMessage(wapAppId, contentType, intent); + if (DBG) Rlog.v(TAG, "procRet:" + procRet); + if ((procRet & WapPushManagerParams.MESSAGE_HANDLED) > 0 + && (procRet & WapPushManagerParams.FURTHER_PROCESSING) == 0) { + processFurther = false; + } } + if (!processFurther) { + return Intents.RESULT_SMS_HANDLED; + } + } catch (RemoteException e) { + if (DBG) Rlog.w(TAG, "remote func failed..."); } - if (!processFurther) { - return Intents.RESULT_SMS_HANDLED; - } - } catch (RemoteException e) { - if (DBG) Rlog.w(TAG, "remote func failed..."); } - } - if (DBG) Rlog.v(TAG, "fall back to existing handler"); + if (DBG) Rlog.v(TAG, "fall back to existing handler"); - if (mimeType == null) { - if (DBG) Rlog.w(TAG, "Header Content-Type error."); - return Intents.RESULT_SMS_GENERIC_ERROR; - } + if (mimeType == null) { + if (DBG) Rlog.w(TAG, "Header Content-Type error."); + return Intents.RESULT_SMS_GENERIC_ERROR; + } - String permission; - int appOp; + String permission; + int appOp; - if (mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_MMS)) { - permission = android.Manifest.permission.RECEIVE_MMS; - appOp = AppOpsManager.OP_RECEIVE_MMS; - } else { - permission = android.Manifest.permission.RECEIVE_WAP_PUSH; - appOp = AppOpsManager.OP_RECEIVE_WAP_PUSH; - } + if (mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_MMS)) { + permission = android.Manifest.permission.RECEIVE_MMS; + appOp = AppOpsManager.OP_RECEIVE_MMS; + } else { + permission = android.Manifest.permission.RECEIVE_WAP_PUSH; + appOp = AppOpsManager.OP_RECEIVE_WAP_PUSH; + } - Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION); - intent.setType(mimeType); - intent.putExtra("transactionId", transactionId); - intent.putExtra("pduType", pduType); - intent.putExtra("header", header); - intent.putExtra("data", intentData); - intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters()); - - // Direct the intent to only the default MMS app. If we can't find a default MMS app - // then sent it to all broadcast receivers. - ComponentName componentName = SmsApplication.getDefaultMmsApplication(mContext, true); - if (componentName != null) { - // Deliver MMS message only to this receiver - intent.setComponent(componentName); - if (DBG) Rlog.v(TAG, "Delivering MMS to: " + componentName.getPackageName() + - " " + componentName.getClassName()); - } + Intent intent = new Intent(Intents.WAP_PUSH_DELIVER_ACTION); + intent.setType(mimeType); + intent.putExtra("transactionId", transactionId); + intent.putExtra("pduType", pduType); + intent.putExtra("header", header); + intent.putExtra("data", intentData); + intent.putExtra("contentTypeParameters", pduDecoder.getContentParameters()); + + // Direct the intent to only the default MMS app. If we can't find a default MMS app + // then sent it to all broadcast receivers. + ComponentName componentName = SmsApplication.getDefaultMmsApplication(mContext, true); + if (componentName != null) { + // Deliver MMS message only to this receiver + intent.setComponent(componentName); + if (DBG) Rlog.v(TAG, "Delivering MMS to: " + componentName.getPackageName() + + " " + componentName.getClassName()); + } - handler.dispatchIntent(intent, permission, appOp, receiver); - return Activity.RESULT_OK; + handler.dispatchIntent(intent, permission, appOp, receiver); + return Activity.RESULT_OK; + } catch (ArrayIndexOutOfBoundsException aie) { + // 0-byte WAP PDU or other unexpected WAP PDU contents can easily throw this; + // log exception string without stack trace and return false. + Rlog.e(TAG, "ignoring dispatchWapPdu() array index exception: " + aie); + return Intents.RESULT_SMS_GENERIC_ERROR; + } } } -- cgit v1.2.3 From 7af882af5b1195e03881a61f177adf86e44ab76f Mon Sep 17 00:00:00 2001 From: "duho.ro" Date: Mon, 27 Jan 2014 17:19:53 +0900 Subject: UICC : delete adn cache after SIM REFRESH RESET delete ADN cache after SIM REFRESH RESET for updating the SIM contacts Bug: 12751374 Change-Id: I2d707dca3e76271f203b1b86212947e3287a8ed1 --- src/java/com/android/internal/telephony/uicc/SIMRecords.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java index 721758ab4..ada815e2f 100644 --- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java +++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java @@ -1234,6 +1234,7 @@ public class SIMRecords extends IccRecords { * desired power state has changed in the interim, we don't want to * override it with an unconditional power on. */ + mAdnCache.reset(); break; default: // unknown refresh operation -- cgit v1.2.3 From fb36cdca91cbbfd12ca680ce0e1a2b33f7e85ab6 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 19 Dec 2013 16:03:03 -0800 Subject: Fix isSameNamedOperatorConsideredRoaming [DO NOT MERGE] Does a loop checking data based on your current network, but exits out based on the result of the first check rather than doing the rest of the checks. Bug: 11408729 Bug: 12121959 Change-Id: I37f98682702ec19467f374d64a23e15fb87e9697 --- .../internal/telephony/gsm/GsmServiceStateTracker.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index 0b75d4959..348e0a804 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -1361,12 +1361,14 @@ final class GsmServiceStateTracker extends ServiceStateTracker { String[] numericArray = mPhone.getContext().getResources().getStringArray( com.android.internal.R.array.config_operatorConsideredNonRoaming); - if (numericArray.length == 0 || operatorNumeric == null) + if (numericArray.length == 0 || operatorNumeric == null) { return false; + } for (String numeric : numericArray) { - if (operatorNumeric.startsWith(numeric)) + if (operatorNumeric.startsWith(numeric)) { return true; + } } return false; } @@ -1376,14 +1378,14 @@ final class GsmServiceStateTracker extends ServiceStateTracker { String[] numericArray = mPhone.getContext().getResources().getStringArray( com.android.internal.R.array.config_sameNamedOperatorConsideredRoaming); - if (numericArray.length == 0 || operatorNumeric == null) + if (numericArray.length == 0 || operatorNumeric == null) { return false; + } for (String numeric : numericArray) { - if (operatorNumeric.startsWith(numeric)) + if (operatorNumeric.startsWith(numeric)) { return true; - else - return false; + } } return false; } -- cgit v1.2.3 From b0b637dbf2a67c0e7eee917c0809f1cc54983986 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Wed, 5 Mar 2014 17:21:44 -0800 Subject: Switch from SIM to carrier info for wifi country Now will also inform when no known country too. bug:11062898 Change-Id: I4a938119c1c06898b39b3bcc6124031d2f66dd71 --- .../com/android/internal/telephony/MccTable.java | 70 ++++++++++++---------- .../internal/telephony/ServiceStateTracker.java | 10 ++++ .../android/internal/telephony/cdma/CDMAPhone.java | 2 +- .../telephony/cdma/CdmaLteServiceStateTracker.java | 2 + .../telephony/cdma/CdmaServiceStateTracker.java | 3 +- .../telephony/gsm/GsmServiceStateTracker.java | 3 +- .../internal/telephony/uicc/RuimRecords.java | 2 +- .../internal/telephony/uicc/SIMRecords.java | 5 +- 8 files changed, 61 insertions(+), 36 deletions(-) diff --git a/src/java/com/android/internal/telephony/MccTable.java b/src/java/com/android/internal/telephony/MccTable.java index c57a8c484..a0c83499f 100644 --- a/src/java/com/android/internal/telephony/MccTable.java +++ b/src/java/com/android/internal/telephony/MccTable.java @@ -171,8 +171,10 @@ public final class MccTable * correct version of resources. If MCC is 0, MCC and MNC will be ignored (not set). * @param context Context to act on. * @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end + * @param fromServiceState true if coming from the radio service state, false if from SIM */ - public static void updateMccMncConfiguration(Context context, String mccmnc) { + public static void updateMccMncConfiguration(Context context, String mccmnc, + boolean fromServiceState) { if (!TextUtils.isEmpty(mccmnc)) { int mcc, mnc; @@ -190,28 +192,37 @@ public final class MccTable if (mcc != 0) { setTimezoneFromMccIfNeeded(context, mcc); locale = getLocaleFromMcc(context, mcc); - setWifiCountryCodeFromMcc(context, mcc); } - try { - Configuration config = new Configuration(); - boolean updateConfig = false; - if (mcc != 0) { - config.mcc = mcc; - config.mnc = mnc == 0 ? Configuration.MNC_ZERO : mnc; - updateConfig = true; - } - if (locale != null) { - config.setLocale(locale); - updateConfig = true; - } - if (updateConfig) { - Slog.d(LOG_TAG, "updateMccMncConfiguration updateConfig config=" + config); - ActivityManagerNative.getDefault().updateConfiguration(config); - } else { - Slog.d(LOG_TAG, "updateMccMncConfiguration nothing to update"); + if (fromServiceState) { + setWifiCountryCodeFromMcc(context, mcc); + } else { + // from SIM + try { + Configuration config = new Configuration(); + boolean updateConfig = false; + if (mcc != 0) { + config.mcc = mcc; + config.mnc = mnc == 0 ? Configuration.MNC_ZERO : mnc; + updateConfig = true; + } + if (locale != null) { + config.setLocale(locale); + updateConfig = true; + } + if (updateConfig) { + Slog.d(LOG_TAG, "updateMccMncConfiguration updateConfig config=" + config); + ActivityManagerNative.getDefault().updateConfiguration(config); + } else { + Slog.d(LOG_TAG, "updateMccMncConfiguration nothing to update"); + } + } catch (RemoteException e) { + Slog.e(LOG_TAG, "Can't update configuration", e); } - } catch (RemoteException e) { - Slog.e(LOG_TAG, "Can't update configuration", e); + } + } else { + if (fromServiceState) { + // an empty mccmnc means no signal - tell wifi we don't know + setWifiCountryCodeFromMcc(context, 0); } } } @@ -342,19 +353,18 @@ public final class MccTable } /** - * If the number of allowed wifi channels has not been set, set it based on - * the MCC of the SIM. + * Set the country code for wifi. This sets allowed wifi channels based on the + * country of the carrier we see. If we can't see any, reset to 0 so we don't + * broadcast on forbidden channels. * @param context Context to act on. - * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA) + * @param mcc Mobile Country Code of the operator. 0 if not known */ private static void setWifiCountryCodeFromMcc(Context context, int mcc) { String country = MccTable.countryCodeForMcc(mcc); - if (!country.isEmpty()) { - Slog.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country); - WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); - //persist - wM.setCountryCode(country, true); - } + Slog.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country); + WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + //persist + wM.setCountryCode(country, true); } static { diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java index c4a93b9ad..f737ab87c 100644 --- a/src/java/com/android/internal/telephony/ServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java @@ -16,6 +16,7 @@ package com.android.internal.telephony; +import android.content.Context; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; @@ -25,6 +26,7 @@ import android.os.SystemClock; import android.telephony.CellInfo; import android.telephony.ServiceState; import android.telephony.SignalStrength; +import android.text.TextUtils; import android.util.Pair; import android.util.TimeUtils; @@ -791,4 +793,12 @@ public abstract class ServiceStateTracker extends Handler { if (VDBG) log("isCallerOnDifferentThread: " + value); return value; } + + protected void updateCarrierMccMncConfiguration(String newOp, String oldOp, Context context) { + // if we have a change in operator, notify wifi (even to/from none) + if (((newOp == null) && (TextUtils.isEmpty(oldOp) == false)) || + ((newOp != null) && (newOp.equals(oldOp) == false))) { + MccTable.updateMccMncConfiguration(context, newOp, true); + } + } } diff --git a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java index ccffeae74..1c3e8c1b6 100644 --- a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -1580,7 +1580,7 @@ public class CDMAPhone extends PhoneBase { getContext().getContentResolver().insert(uri, map); // Updates MCC MNC device configuration information - MccTable.updateMccMncConfiguration(mContext, operatorNumeric); + MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false); return true; } catch (SQLException e) { diff --git a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java index 278eb089b..3ba47c37f 100644 --- a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java @@ -406,6 +406,8 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); + updateCarrierMccMncConfiguration(operatorNumeric, + prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); diff --git a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index 7ad075704..e5225592b 100644 --- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -1070,7 +1070,8 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); - + updateCarrierMccMncConfiguration(operatorNumeric, + prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index 348e0a804..24ec58602 100644 --- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -948,7 +948,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker { SystemProperties.get(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); operatorNumeric = mSS.getOperatorNumeric(); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, operatorNumeric); - + updateCarrierMccMncConfiguration(operatorNumeric, + prevOperatorNumeric, mPhone.getContext()); if (operatorNumeric == null) { if (DBG) log("operatorNumeric is null"); mPhone.setSystemProperty(TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java index 250429465..425951d6c 100755 --- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java +++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java @@ -483,7 +483,7 @@ public final class RuimRecords extends IccRecords { String operatorNumeric = getRUIMOperatorNumeric(); if (operatorNumeric != null) { if(operatorNumeric.length() <= 6){ - MccTable.updateMccMncConfiguration(mContext, operatorNumeric); + MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false); } } break; diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java index ada815e2f..b0534196f 100644 --- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java +++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java @@ -625,7 +625,8 @@ public class SIMRecords extends IccRecords { if (mMncLength != UNKNOWN && mMncLength != UNINITIALIZED) { // finally have both the imsi and the mncLength and can parse the imsi properly - MccTable.updateMccMncConfiguration(mContext, mImsi.substring(0, 3 + mMncLength)); + MccTable.updateMccMncConfiguration(mContext, + mImsi.substring(0, 3 + mMncLength), false); } mImsiReadyRegistrants.notifyRegistrants(); break; @@ -890,7 +891,7 @@ public class SIMRecords extends IccRecords { // finally have both imsi and the length of the mnc and can parse // the imsi properly MccTable.updateMccMncConfiguration(mContext, - mImsi.substring(0, 3 + mMncLength)); + mImsi.substring(0, 3 + mMncLength), false); } } break; -- cgit v1.2.3 From 82d87aeb1a7694d6ba782fb80bb2ede4f242993a Mon Sep 17 00:00:00 2001 From: Sudheer Reddy Yampalla Date: Wed, 20 Nov 2013 15:14:51 -0800 Subject: Telephony: Add + for international number for MT SMS Add + if international number is not having + at starting. Bug: 10951615 Bug: 11599528 Change-Id: I0000b0685181f17ba6b5b0eaaba60a77971e7908 --- src/java/com/android/internal/telephony/cdma/SmsMessage.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/java/com/android/internal/telephony/cdma/SmsMessage.java b/src/java/com/android/internal/telephony/cdma/SmsMessage.java index c3aef215e..2d5dda789 100644 --- a/src/java/com/android/internal/telephony/cdma/SmsMessage.java +++ b/src/java/com/android/internal/telephony/cdma/SmsMessage.java @@ -729,6 +729,11 @@ public class SmsMessage extends SmsMessageBase { if (mOriginatingAddress != null) { mOriginatingAddress.address = new String(mOriginatingAddress.origBytes); + if (mOriginatingAddress.ton == CdmaSmsAddress.TON_INTERNATIONAL_OR_IP) { + if (mOriginatingAddress.address.charAt(0) != '+') { + mOriginatingAddress.address = "+" + mOriginatingAddress.address; + } + } if (VDBG) Rlog.v(LOG_TAG, "SMS originating address: " + mOriginatingAddress.address); } -- cgit v1.2.3 From c187f0e9bfb897405d6c41f669fc2aadacb0ee1e Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Thu, 13 Mar 2014 06:54:55 -0700 Subject: Handle provisioning APN by turning off/on data. This is a start and two tests succeed: Tested expired AT&T SIM and waiting 15min for alarm to fire. Tested a provisioned Verizon SIM and works normally. I've NOT tested AT&T where I've properly completed the provisioning. I've NOT tested T-Mobile SIM either provisioned or not-provisioned. I've NOT tested provisioning over WiFi. I've NOT tested that WiFi <-> Mobile works I've NOT tested voice calls, SMS, MMS ... The current bug is below, but it is poorly named either it should be renamed or a new bug created. Bug: 13190133 Change-Id: I0a09f642614cd27a8655e9dae764b8999ce485b8 --- .../telephony/dataconnection/DcTrackerBase.java | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java b/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java index a8050a6f9..40eba1198 100644 --- a/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java +++ b/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java @@ -849,10 +849,6 @@ public abstract class DcTrackerBase extends Handler { break; } case DctConstants.CMD_ENABLE_MOBILE_PROVISIONING: { - // TODO: Right now we know when it ends "successfully" when - // provisioning apn gets dropped, what happens if the user never - // succeed, I assume there is a timeout and the network will drop - // it after a period of time. Bundle bundle = msg.getData(); if (bundle != null) { try { @@ -867,18 +863,11 @@ public abstract class DcTrackerBase extends Handler { mIsProvisioning = false; mProvisioningUrl = null; } else { - ApnContext apnContext = mApnContexts.get(PhoneConstants.APN_TYPE_DEFAULT); - if (apnContext.isProvisioningApn() && apnContext.getState() == State.CONNECTED){ - log("CMD_ENABLE_MOBILE_PROVISIONING: mIsProvisioning=true url=" - + mProvisioningUrl); - mIsProvisioning = true; - startProvisioningApnAlarm(); - completeConnection(mApnContexts.get(PhoneConstants.APN_TYPE_DEFAULT)); - } else { - log("CMD_ENABLE_MOBILE_PROVISIONING: No longer connected"); - mIsProvisioning = false; - mProvisioningUrl = null; - } + loge("CMD_ENABLE_MOBILE_PROVISIONING: provisioningUrl=" + mProvisioningUrl); + mIsProvisioning = true; + startProvisioningApnAlarm(); + onSetInternalDataEnabled(true); + enableApnType("default"); } break; } -- cgit v1.2.3