Hide carrier related settings if HIDE_CARRIER_NETWORK_SETTINGS is set.
Bug: b/17430643
Change-Id: I079f7cc4efce505ad4d38695ebdd386a715199c9
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 2755bd7..457eb8d 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -1237,29 +1237,38 @@
int phoneType = mPhone.getPhoneType();
Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
- if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
+ boolean shouldHideCarrierSettings = Settings.Global.getInt(
+ getContentResolver(), Settings.Global.HIDE_CARRIER_NETWORK_SETTINGS, 0) == 1;
+ if (shouldHideCarrierSettings) {
prefSet.removePreference(fdnButton);
-
- if (!getResources().getBoolean(R.bool.config_voice_privacy_disable)) {
- addPreferencesFromResource(R.xml.cdma_call_privacy);
- }
- } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
- fdnButton.setIntent(mSubscriptionInfoHelper.getIntent(this, FdnSetting.class));
-
- if (getResources().getBoolean(R.bool.config_additional_call_setting)) {
- addPreferencesFromResource(R.xml.gsm_umts_call_options);
-
- Preference callForwardingPref = prefSet.findPreference(CALL_FORWARDING_KEY);
- callForwardingPref.setIntent(mSubscriptionInfoHelper.getIntent(
- this, GsmUmtsCallForwardOptions.class));
-
- Preference additionalGsmSettingsPref =
- prefSet.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
- additionalGsmSettingsPref.setIntent(mSubscriptionInfoHelper.getIntent(
- this, GsmUmtsAdditionalCallOptions.class));
+ if (mButtonDTMF != null) {
+ prefSet.removePreference(mButtonDTMF);
}
} else {
- throw new IllegalStateException("Unexpected phone type: " + phoneType);
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
+ prefSet.removePreference(fdnButton);
+
+ if (!getResources().getBoolean(R.bool.config_voice_privacy_disable)) {
+ addPreferencesFromResource(R.xml.cdma_call_privacy);
+ }
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
+ fdnButton.setIntent(mSubscriptionInfoHelper.getIntent(this, FdnSetting.class));
+
+ if (getResources().getBoolean(R.bool.config_additional_call_setting)) {
+ addPreferencesFromResource(R.xml.gsm_umts_call_options);
+
+ Preference callForwardingPref = prefSet.findPreference(CALL_FORWARDING_KEY);
+ callForwardingPref.setIntent(mSubscriptionInfoHelper.getIntent(
+ this, GsmUmtsCallForwardOptions.class));
+
+ Preference additionalGsmSettingsPref =
+ prefSet.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
+ additionalGsmSettingsPref.setIntent(mSubscriptionInfoHelper.getIntent(
+ this, GsmUmtsAdditionalCallOptions.class));
+ }
+ } else {
+ throw new IllegalStateException("Unexpected phone type: " + phoneType);
+ }
}
}