Read from CarrierConfigManager instead of config.xml
This updates GsmUmtsOptions and CdmaOptions to read from the new
CarrierConfigManager API. These variables have been migrated:
config_carrier_settings_enable
config_operator_selection_expand
config_show_apn_setting_cdma
We don't register for ACTION_CARRIER_CONFIG_CHANGED broadcasts because
this variable is read when the settings activity is created, and the
value of the variable should only change when the sim operator changes.
(i.e. swapping SIM while viewing this activity)
Bug: 20270007
Change-Id: I73c22af620942324be32b04209ea47fd14495675
diff --git a/src/com/android/phone/CdmaOptions.java b/src/com/android/phone/CdmaOptions.java
index a04427e..fa3db13 100644
--- a/src/com/android/phone/CdmaOptions.java
+++ b/src/com/android/phone/CdmaOptions.java
@@ -20,11 +20,13 @@
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
+import android.os.Bundle;
import android.os.SystemProperties;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.provider.Settings;
+import android.telephony.CarrierConfigManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -64,9 +66,9 @@
mButtonAPNExpand = (PreferenceScreen) mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
boolean removedAPNExpand = false;
- Resources res = mPrefActivity.getResources();
- // Some CDMA carriers want the APN settings
- if (!res.getBoolean(R.bool.config_show_apn_setting_cdma) && mButtonAPNExpand != null) {
+ Bundle carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
+ // Some CDMA carriers want the APN settings.
+ if (!carrierConfig.getBoolean(CarrierConfigManager.BOOL_SHOW_APN_SETTING_CDMA) && mButtonAPNExpand != null) {
mPrefScreen.removePreference(mButtonAPNExpand);
removedAPNExpand = true;
}
@@ -115,8 +117,8 @@
}
// Read platform settings for carrier settings
- final boolean isCarrierSettingsEnabled = mPrefActivity.getResources().getBoolean(
- R.bool.config_carrier_settings_enable);
+ final boolean isCarrierSettingsEnabled = carrierConfig.getBoolean(
+ CarrierConfigManager.BOOL_CARRIER_SETTINGS_ENABLE);
if (!isCarrierSettingsEnabled) {
Preference pref = mPrefScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY);
if (pref != null) {