Permalink
Browse files

Allow configuration of GsmUmtsOptions based on mcc/mnc.

Bug: 9283641
Bug: 9287637
Change-Id: I57ab608efa6d7c3f07c41b01a73b64c2e19828f7
  • Loading branch information...
1 parent 43e0932 commit 720e662fcc384a85333f73ff23141b5c5c31446d Wink Saville committed Jul 6, 2013
Showing with 35 additions and 7 deletions.
  1. +7 −0 res/values/config.xml
  2. +28 −7 src/com/android/phone/GsmUmtsOptions.java
View
7 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>
View
35 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 @@ protected void create() {
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));
+ }
}
}
}

0 comments on commit 720e662

Please sign in to comment.