aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-06-06 01:33:56 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2014-06-06 01:33:56 -0700
commit00a3e0582f77cd87942f32ffe9ffc5a37ce35fea (patch)
tree7551e2c4b67184aada70409005a4fb048487deb0
parentac1a392a43d5423af37aa15fc9785828f21b467a (diff)
parent63f198d0f255e67e2cd4c1dd94c5017f91e1f31c (diff)
downloadandroid_frameworks_opt_telephony-00a3e0582f77cd87942f32ffe9ffc5a37ce35fea.tar.gz
android_frameworks_opt_telephony-00a3e0582f77cd87942f32ffe9ffc5a37ce35fea.tar.bz2
android_frameworks_opt_telephony-00a3e0582f77cd87942f32ffe9ffc5a37ce35fea.zip
Merge "Merge tag 'android-4.4.3_r1' into merge_branch"
-rw-r--r--src/java/com/android/internal/telephony/MccTable.java70
-rw-r--r--src/java/com/android/internal/telephony/ServiceStateTracker.java12
-rw-r--r--src/java/com/android/internal/telephony/cdma/CDMAPhone.java2
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java2
-rw-r--r--src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java3
-rw-r--r--src/java/com/android/internal/telephony/cdma/SmsMessage.java4
-rw-r--r--src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java21
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java17
-rw-r--r--src/java/com/android/internal/telephony/uicc/RuimRecords.java2
-rw-r--r--src/java/com/android/internal/telephony/uicc/SIMRecords.java46
10 files changed, 119 insertions, 60 deletions
diff --git a/src/java/com/android/internal/telephony/MccTable.java b/src/java/com/android/internal/telephony/MccTable.java
index bac8fe0c9..c00b4a456 100644
--- a/src/java/com/android/internal/telephony/MccTable.java
+++ b/src/java/com/android/internal/telephony/MccTable.java
@@ -173,8 +173,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;
@@ -201,28 +203,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);
}
}
}
@@ -354,19 +365,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 35ddb0639..c5f3a86ff 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;
import android.net.ConnectivityManager;
@@ -775,7 +777,7 @@ public abstract class ServiceStateTracker extends Handler {
log("SST.getAllCellInfo(): X size=" + result.list.size()
+ " list=" + result.list);
} else {
- log("SST.getAllCellInfo(): X size=0 list=null");
+ log("SST.getAllCellInfo(): X size=0 list=null");
}
}
return result.list;
@@ -818,6 +820,14 @@ public abstract class ServiceStateTracker extends Handler {
}
}
+ 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);
+ }
+ }
+
protected boolean isCallerOnDifferentThread() {
boolean value = Thread.currentThread() != getLooper().getThread();
if (VDBG) log("isCallerOnDifferentThread: " + value);
diff --git a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
index 26d0abbf5..d4adf04bc 100644
--- a/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/src/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -1595,7 +1595,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 7f64bf598..b457b78ac 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -434,6 +434,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 b945951d2..6257b505b 100644
--- a/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -1086,7 +1086,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/cdma/SmsMessage.java b/src/java/com/android/internal/telephony/cdma/SmsMessage.java
index 46c98a9b3..25d101fdb 100644
--- a/src/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/src/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -771,7 +771,9 @@ public class SmsMessage extends SmsMessageBase {
if (mOriginatingAddress != null) {
mOriginatingAddress.address = new String(mOriginatingAddress.origBytes);
if (mOriginatingAddress.ton == CdmaSmsAddress.TON_INTERNATIONAL_OR_IP) {
- mOriginatingAddress.address = "+" + mOriginatingAddress.address;
+ if (mOriginatingAddress.address.charAt(0) != '+') {
+ mOriginatingAddress.address = "+" + mOriginatingAddress.address;
+ }
}
if (VDBG) Rlog.v(LOG_TAG, "SMS originating address: "
+ mOriginatingAddress.address);
diff --git a/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java b/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
index 8ed449b77..dd3da0110 100644
--- a/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
+++ b/src/java/com/android/internal/telephony/dataconnection/DcTrackerBase.java
@@ -884,10 +884,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 {
@@ -902,18 +898,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;
}
diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 78d334fda..aa0b14ae8 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -1018,7 +1018,8 @@ public 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, "");
@@ -1454,12 +1455,14 @@ public 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;
}
@@ -1469,14 +1472,14 @@ public 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;
}
diff --git a/src/java/com/android/internal/telephony/uicc/RuimRecords.java b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
index 33abea9a8..a471e4746 100644
--- a/src/java/com/android/internal/telephony/uicc/RuimRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/RuimRecords.java
@@ -425,7 +425,7 @@ public final class RuimRecords extends IccRecords {
String operatorNumeric = getOperatorNumeric();
if (operatorNumeric != null) {
if(operatorNumeric.length() <= 6){
- MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
+ MccTable.updateMccMncConfiguration(mContext, operatorNumeric, false);
}
}
diff --git a/src/java/com/android/internal/telephony/uicc/SIMRecords.java b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
index fd62e361c..5caf07751 100644
--- a/src/java/com/android/internal/telephony/uicc/SIMRecords.java
+++ b/src/java/com/android/internal/telephony/uicc/SIMRecords.java
@@ -662,7 +662,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;
@@ -905,7 +906,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;
@@ -1210,6 +1211,47 @@ public class SIMRecords extends IccRecords {
}
}
+ private void handleSimRefresh(IccRefreshResponse refreshResponse){
+ if (refreshResponse == null) {
+ if (DBG) log("handleSimRefresh received without input");
+ return;
+ }
+
+ if (refreshResponse.aid != null &&
+ !refreshResponse.aid.equals(mParentApp.getAid())) {
+ // This is for different app. Ignore.
+ return;
+ }
+
+ switch (refreshResponse.refreshResult) {
+ case IccRefreshResponse.REFRESH_RESULT_FILE_UPDATE:
+ if (DBG) log("handleSimRefresh with SIM_FILE_UPDATED");
+ handleFileUpdate(refreshResponse.efId);
+ break;
+ case IccRefreshResponse.REFRESH_RESULT_INIT:
+ if (DBG) log("handleSimRefresh with SIM_REFRESH_INIT");
+ // need to reload all files (that we care about)
+ onIccRefreshInit();
+ break;
+ case IccRefreshResponse.REFRESH_RESULT_RESET:
+ if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");
+ mCi.setRadioPower(false, null);
+ /* Note: no need to call setRadioPower(true). Assuming the desired
+ * radio power state is still ON (as tracked by ServiceStateTracker),
+ * ServiceStateTracker will call setRadioPower when it receives the
+ * RADIO_STATE_CHANGED notification for the power off. And if the
+ * 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
+ if (DBG) log("handleSimRefresh with unknown operation");
+ break;
+ }
+ }
+
/**
* Dispatch 3GPP format message to registrant ({@code GSMPhone} or {@code CDMALTEPhone})
* to pass to the 3GPP SMS dispatcher for delivery.