Allow configuration of GsmUmtsOptions based on mcc/mnc.
Bug: 9283641
Bug: 9287637
Change-Id: I57ab608efa6d7c3f07c41b01a73b64c2e19828f7
diff --git a/res/values/config.xml b/res/values/config.xml
index eb9de4c..9b3602e 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -112,4 +112,11 @@
<!-- If true, removes the Voice Privacy option from Call Settings -->
<bool name="config_voice_privacy_disable">false</bool>
+
+ <!-- Configure certain GsmUmtsOptions to be available or not. The
+ default values are in Phone/res/values/config.xml and maybe overridden
+ in operator specific resource directories or device specific overlays. -->
+ <bool name="config_apn_expand" translatable="false">true</bool>
+ <bool name="config_operator_selection_expand" translatable="false">true</bool>
+ <bool name="config_prefer_2g" translatable="false">true</bool>
</resources>
diff --git a/src/com/android/phone/GsmUmtsOptions.java b/src/com/android/phone/GsmUmtsOptions.java
index 64dccd8..1f1ac4a 100644
--- a/src/com/android/phone/GsmUmtsOptions.java
+++ b/src/com/android/phone/GsmUmtsOptions.java
@@ -20,6 +20,7 @@
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
+import android.content.res.Resources;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
@@ -58,14 +59,34 @@
mButtonAPNExpand.setEnabled(false);
mButtonOperatorSelectionExpand.setEnabled(false);
mButtonPrefer2g.setEnabled(false);
- } else if (mPrefActivity.getResources().getBoolean(R.bool.csp_enabled)) {
- if (PhoneFactory.getDefaultPhone().isCspPlmnEnabled()) {
- log("[CSP] Enabling Operator Selection menu.");
- mButtonOperatorSelectionExpand.setEnabled(true);
- } else {
- log("[CSP] Disabling Operator Selection menu.");
+ } else {
+ log("Not a CDMA phone");
+ Resources res = mPrefActivity.getResources();
+
+ // Determine which options to display, for GSM these are defaulted
+ // are defaulted to true in Phone/res/values/config.xml. But for
+ // some operators like verizon they maybe overriden in operator
+ // specific resources or device specifc overlays.
+ if (!res.getBoolean(R.bool.config_apn_expand)) {
+ mPrefScreen.removePreference(mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY));
+ }
+ if (!res.getBoolean(R.bool.config_operator_selection_expand)) {
mPrefScreen.removePreference(mPrefScreen
- .findPreference(BUTTON_OPERATOR_SELECTION_EXPAND_KEY));
+ .findPreference(BUTTON_OPERATOR_SELECTION_EXPAND_KEY));
+ }
+ if (!res.getBoolean(R.bool.config_prefer_2g)) {
+ mPrefScreen.removePreference(mPrefScreen.findPreference(BUTTON_PREFER_2G_KEY));
+ }
+
+ if (res.getBoolean(R.bool.csp_enabled)) {
+ if (PhoneFactory.getDefaultPhone().isCspPlmnEnabled()) {
+ log("[CSP] Enabling Operator Selection menu.");
+ mButtonOperatorSelectionExpand.setEnabled(true);
+ } else {
+ log("[CSP] Disabling Operator Selection menu.");
+ mPrefScreen.removePreference(mPrefScreen
+ .findPreference(BUTTON_OPERATOR_SELECTION_EXPAND_KEY));
+ }
}
}
}