summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Knight <starlightknight@slkdev.net>2016-07-30 13:38:30 -0400
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-08-04 23:40:00 -0700
commitd2c1ea551ace19606746559b53cf4e401f1dfaf6 (patch)
treee8c8b5995a36c8dfe004a0666e3395787e1f9986
parent8dc84ac5cff942c2ef055741d895ecfa88529305 (diff)
downloadandroid_packages_services_Telephony-d2c1ea551ace19606746559b53cf4e401f1dfaf6.tar.gz
android_packages_services_Telephony-d2c1ea551ace19606746559b53cf4e401f1dfaf6.tar.bz2
android_packages_services_Telephony-d2c1ea551ace19606746559b53cf4e401f1dfaf6.zip
MobileNetworkSettings: Check CarrierConfig on isWorldMode
Add support for checking the CarrierConfig version of the World Phone config. If this is not present, fall back to the old deprecated way of looking it up from the Telephony settings. Not having this prevented the world phone config from working if you fully migrated to CarrierConfig - you had to have both versions or you would fail this check Change-Id: I73939f1055849793d108b02bf034ab79e360c4e4
-rwxr-xr-xsrc/com/android/phone/MobileNetworkSettings.java46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 2faac457c..729ac987f 100755
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -1290,7 +1290,10 @@ public class MobileNetworkSettings extends PreferenceActivity
}
private boolean isWorldMode() {
- return isWorldMode(this);
+ final PersistableBundle carrierConfig =
+ PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
+
+ return isWorldMode(this, carrierConfig);
}
private void controlGsmOptions(boolean enable) {
@@ -1343,21 +1346,31 @@ public class MobileNetworkSettings extends PreferenceActivity
return isSupportTdscdma(this, mPhone.getSubId());
}
- private static boolean isWorldMode(Context context) {
+ private static boolean isWorldMode(Context context, PersistableBundle carrierConfig) {
+ final boolean carrierConfigWorldPhone = carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL);
+
boolean worldModeOn = false;
- final TelephonyManager tm = (TelephonyManager)
- context.getSystemService(Context.TELEPHONY_SERVICE);
- final String configString = context.getResources().getString(R.string.config_world_mode);
-
- if (!TextUtils.isEmpty(configString)) {
- String[] configArray = configString.split(";");
- // Check if we have World mode configuration set to True only or config is set to True
- // and SIM GID value is also set and matches to the current SIM GID.
- if (configArray != null &&
- ((configArray.length == 1 && configArray[0].equalsIgnoreCase("true")) ||
- (configArray.length == 2 && !TextUtils.isEmpty(configArray[1]) &&
- tm != null && configArray[1].equalsIgnoreCase(tm.getGroupIdLevel1())))) {
- worldModeOn = true;
+
+ // Check the new CarrierConfig version of the flag
+ if(carrierConfigWorldPhone){
+ worldModeOn = true;
+ }
+ // If its not set, check the old deprecated way...
+ else {
+ final TelephonyManager tm = (TelephonyManager)
+ context.getSystemService(Context.TELEPHONY_SERVICE);
+ final String configString = context.getResources().getString(R.string.config_world_mode);
+
+ if (!TextUtils.isEmpty(configString)) {
+ String[] configArray = configString.split(";");
+ // Check if we have World mode configuration set to True only or config is set to True
+ // and SIM GID value is also set and matches to the current SIM GID.
+ if (configArray != null &&
+ ((configArray.length == 1 && configArray[0].equalsIgnoreCase("true")) ||
+ (configArray.length == 2 && !TextUtils.isEmpty(configArray[1]) &&
+ tm != null && configArray[1].equalsIgnoreCase(tm.getGroupIdLevel1())))) {
+ worldModeOn = true;
+ }
}
}
@@ -1488,7 +1501,8 @@ public class MobileNetworkSettings extends PreferenceActivity
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
}
- if (isWorldMode(context)) {
+
+ if (isWorldMode(context, carrierConfig)) {
ev[0] = com.android.phone.R.array.preferred_network_mode_choices_world_mode;
ev[1] = com.android.phone.R.array.preferred_network_mode_values_world_mode;
}