Fix bug1783355, The "Use 2G only" setting has disappeared.
Wink Saville [Fri, 10 Jul 2009 04:56:43 +0000 (21:56 -0700)]
The problem was actually on GSM the Settings -> Call settings
menu had both GSM and CDMA settings when it should only have
GSM Settings, this is now fixed.

res/xml/call_feature_setting.xml
src/com/android/phone/CallFeaturesSetting.java

index 0b26b2e..16279a4 100644 (file)
            
     </PreferenceScreen>
 
-    <!-- Rearranged to allow for lazy queries. -->
-    <PreferenceScreen
-        android:key="button_cdma_more_expand_key"
-        android:title="@string/labelCDMAMore"
-        android:summary="@string/sum_cdma_call_settings"
-        android:persistent="false">
-        
-        <PreferenceCategory
-            android:title="@string/additional_cdma_call_settings"/>
-            
-        <CheckBoxPreference 
-            android:key="button_voice_privacy_key"
-            android:title="@string/voice_privacy"
-            android:persistent="false"
-            android:summary="@string/voice_privacy_summary"/>
-            
-<!--         <CheckBoxPreference 
-            android:key="button_tty_mode_key"
-            android:title="@string/tty_mode_title"
-            android:persistent="true"
-            android:summary="@string/tty_mode_summary"/>
--->            
-        <!-- CDMA TTY Options -->
-        <ListPreference
-            android:key="button_tty_mode_key"
-            android:title="@string/tty_mode_option_title"
-            android:summary="@string/tty_mode_option_summary"
-            android:persistent="false"
-            android:entries="@array/tty_mode_entries"
-            android:entryValues="@array/tty_mode_values" />
-
-    </PreferenceScreen>
-                    
-
 </PreferenceScreen>
index 8b69671..25a358a 100755 (executable)
@@ -193,7 +193,6 @@ public class CallFeaturesSetting extends PreferenceActivity
     private EditPhoneNumberPreference mSubMenuVoicemailSettings;
     private PreferenceScreen mButtonCFExpand;
     private PreferenceScreen mButtonGSMMoreExpand;
-    private PreferenceScreen mButtonCDMAMoreExpand;
     private CheckBoxPreference mButtonVoicePrivacy;
     private ListPreference mButtonTTY;
     private ListPreference mButtonDS;
@@ -1367,10 +1366,6 @@ public class CallFeaturesSetting extends PreferenceActivity
             handleSetVPMessage();
             mPhone.queryTTYMode(Message.obtain(mQueryTTYComplete, EVENT_TTY_EXECUTED));
             // TODO(Moto): Re-launch DTMF settings if necessary onResume
-        } else {
-            mButtonTTY.setEnabled(false);
-            mButtonVoicePrivacy.setChecked(false);
-            mButtonVoicePrivacy.setEnabled(false);
         }
 
     }
@@ -1397,27 +1392,27 @@ public class CallFeaturesSetting extends PreferenceActivity
         mSubMenuVoicemailSettings = (EditPhoneNumberPreference)
                 prefSet.findPreference(BUTTON_VOICEMAIL_KEY);
         mSubMenuFDNSettings = (PreferenceScreen) prefSet.findPreference(BUTTON_FDN_KEY);
-        mButtonVoicePrivacy = (CheckBoxPreference) findPreference(BUTTON_VP_KEY);
 
-        mButtonTTY = (ListPreference) prefSet.findPreference(BUTTON_TTY_KEY);
-        mButtonTTY.setOnPreferenceChangeListener(this);
+        if (mPhone.getPhoneName().equals("CDMA")) {
+            mButtonVoicePrivacy = (CheckBoxPreference) findPreference(BUTTON_VP_KEY);
 
-        // Get the ttyMode from Settings.System and displays it
-        int settingsTtyMode = android.provider.Settings.Secure.getInt(
-                mPhone.getContext().getContentResolver(),
-                android.provider.Settings.Secure.PREFERRED_TTY_MODE,
-                preferredTtyMode);
-        mButtonTTY.setValue(Integer.toString(settingsTtyMode));
-        UpdatePreferredTtyModeSummary(settingsTtyMode);
+            mButtonTTY = (ListPreference) prefSet.findPreference(BUTTON_TTY_KEY);
+            mButtonTTY.setOnPreferenceChangeListener(this);
+
+            // Get the ttyMode from Settings.System and displays it
+            int settingsTtyMode = android.provider.Settings.Secure.getInt(
+                    mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.PREFERRED_TTY_MODE,
+                    preferredTtyMode);
+            mButtonTTY.setValue(Integer.toString(settingsTtyMode));
+            UpdatePreferredTtyModeSummary(settingsTtyMode);
 
-        if (mPhone.getPhoneName().equals("CDMA")) {
             mButtonDS = (ListPreference) findPreference(BUTTON_DS_KEY);
             int index = Settings.System.getInt(getContentResolver(),
                     Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, preferredDtmfMode);
             mButtonDS.setValueIndex(index);
             mButtonDS.setOnPreferenceChangeListener(this);
-        }
-        if (mPhone.getPhoneName().equals("GSM")) {
+        } else if (mPhone.getPhoneName().equals("GSM")) {
             mButtonCLIR  = (ListPreference) prefSet.findPreference(BUTTON_CLIR_KEY);
             mButtonCW    = (CheckBoxPreference) prefSet.findPreference(BUTTON_CW_KEY);
             mButtonCFU   = (EditPhoneNumberPreference) prefSet.findPreference(BUTTON_CFU_KEY);
@@ -1429,14 +1424,10 @@ public class CallFeaturesSetting extends PreferenceActivity
             mButtonCFExpand = (PreferenceScreen) prefSet.findPreference(BUTTON_CF_EXPAND_KEY);
             mButtonGSMMoreExpand = (PreferenceScreen) prefSet.findPreference(
                     BUTTON_GSM_MORE_EXPAND_KEY);
-            mButtonCDMAMoreExpand = (PreferenceScreen) prefSet.findPreference(
-                    BUTTON_CDMA_MORE_EXPAND_KEY);
 
             // The intent code that resided here in the past has been moved into the
             // more conventional location in network_setting.xml
 
-            mButtonVoicePrivacy.setEnabled(false);
-
             // Set links to the current activity and any UI settings that
             // effect the dialog for each preference.  Also set the
             // dependencies between the child (CFB, CFNRy, CFNRc)
@@ -1500,10 +1491,9 @@ public class CallFeaturesSetting extends PreferenceActivity
         mAppState = AppState.INPUT_READY;
 
         if (icicle != null) {
-            if (mButtonVoicePrivacy != null) {
+            if (mPhone.getPhoneName().equals("CDMA")) {
                 mButtonVoicePrivacy.setChecked(icicle.getBoolean(BUTTON_VP_KEY));
-            }
-            if (mPhone.getPhoneName().equals("GSM")) {
+            } else if (mPhone.getPhoneName().equals("GSM")) {
                 // retrieve number state
                 mDialingNumCFU = icicle.getString(SUMMARY_CFU_KEY);
                 mDialingNumCFB = icicle.getString(SUMMARY_CFB_KEY);
@@ -1525,9 +1515,7 @@ public class CallFeaturesSetting extends PreferenceActivity
                 if (mButtonCW != null) {
                     mButtonCW.setChecked(icicle.getBoolean(BUTTON_CW_KEY));
                 }
-                if (mButtonVoicePrivacy != null) {
-                    mButtonVoicePrivacy.setEnabled(false);
-                }
+
                 mCFDataStale = icicle.getBoolean(BUTTON_CF_EXPAND_KEY);
                 mMoreDataStale = icicle.getBoolean(BUTTON_GSM_MORE_EXPAND_KEY);
             }
@@ -1559,15 +1547,11 @@ public class CallFeaturesSetting extends PreferenceActivity
 
         if (DBG) log("onSaveInstanceState: saving relevant UI state.");
 
-        if (mButtonVoicePrivacy != null) {
+        // save button state
+        if (mPhone.getPhoneName().equals("CDMA")) {
             outState.putBoolean(BUTTON_VP_KEY, mButtonVoicePrivacy.isChecked());
-        }
-        if (mButtonTTY != null) {
             outState.putInt(BUTTON_TTY_KEY, mButtonTTY.findIndexOfValue(mButtonTTY.getValue()));
-        }
-
-        // save button state
-        if (mPhone.getPhoneName().equals("GSM")) {
+        } else if (mPhone.getPhoneName().equals("GSM")) {
             if (mButtonCLIR != null) {
                 outState.putInt(BUTTON_CLIR_KEY, mButtonCLIR.findIndexOfValue(mButtonCLIR.getValue()));
             }