summaryrefslogtreecommitdiffstats
path: root/src/com/android/phone/MobileNetworkSettings.java
diff options
context:
space:
mode:
authorAaron Knight <starlightknight@slkdev.net>2016-07-30 13:38:30 -0400
committerAdrian DC <radian.dc@gmail.com>2016-12-03 19:52:48 +0100
commitd9e7c69c3c658062cc88117ef8d2e2740d6f911a (patch)
treed6683acb017d76a5f91e1afc8ddc9b0a3cced99e /src/com/android/phone/MobileNetworkSettings.java
parent3fb3c9741a024ccc1325c8b93cdf25ace80459ad (diff)
downloadandroid_packages_services_Telephony-d9e7c69c3c658062cc88117ef8d2e2740d6f911a.tar.gz
android_packages_services_Telephony-d9e7c69c3c658062cc88117ef8d2e2740d6f911a.tar.bz2
android_packages_services_Telephony-d9e7c69c3c658062cc88117ef8d2e2740d6f911a.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 RM-290 Change-Id: I73939f1055849793d108b02bf034ab79e360c4e4
Diffstat (limited to 'src/com/android/phone/MobileNetworkSettings.java')
-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;
}