Remove Manage Mobile Plan when config_show_mobile_plan is set to false
config_show_mobile_plan is set to true by default.
When you don't want to show "Manage mobile plan" set config_show_mobile_plan to false in overlay.
Bug: 10819853
Change-Id: Ic3c69fb4246cc0de38518ef6c9950cee7fa4d987
diff --git a/res/values/bools.xml b/res/values/bools.xml
index 76dc44a..137d4ce 100644
--- a/res/values/bools.xml
+++ b/res/values/bools.xml
@@ -32,4 +32,7 @@
<!-- Whether to show a preference item for regulatory information in About phone -->
<bool name="config_show_regulatory_info">false</bool>
+
+ <!-- Whether to show a preference item for mobile plan -->
+ <bool name="config_show_mobile_plan">true</bool>
</resources>
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 6724cc1..65127b5 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -333,6 +333,16 @@
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
removePreference(KEY_MANAGE_MOBILE_PLAN);
}
+ // Remove Mobile Network Settings and Manage Mobile Plan
+ // if config_show_mobile_plan sets false.
+ boolean isMobilePlanEnabled = this.getResources().getBoolean(
+ R.bool.config_show_mobile_plan);
+ if (!isMobilePlanEnabled) {
+ Preference pref = findPreference(KEY_MANAGE_MOBILE_PLAN);
+ if (pref != null) {
+ removePreference(KEY_MANAGE_MOBILE_PLAN);
+ }
+ }
protectByRestrictions(KEY_MOBILE_NETWORK_SETTINGS);
protectByRestrictions(KEY_MANAGE_MOBILE_PLAN);