Display carrier settings menu in GSM Phone if needs

Some carriers use their setting menu in CDMA. Furthermore, use in GSM
when roaming.
So change to show carrier settings menu in both CDMA and GSM Phone.

Bug: 11354773
Change-Id: Ifb329971df16351768fe14e6801cc83631e60971
diff --git a/res/xml/gsm_umts_options.xml b/res/xml/gsm_umts_options.xml
index df7f2d5..b2539a7 100644
--- a/res/xml/gsm_umts_options.xml
+++ b/res/xml/gsm_umts_options.xml
@@ -40,4 +40,12 @@
 
     </PreferenceScreen>
 
+    <PreferenceScreen
+        android:key="carrier_settings_key"
+        android:title="@string/carrier_settings_title">
+        <intent android:action="android.intent.action.MAIN"
+                android:targetPackage="@string/carrier_settings"
+                android:targetClass="@string/carrier_settings_menu" />
+    </PreferenceScreen>
+
 </PreferenceScreen>
diff --git a/src/com/android/phone/CdmaOptions.java b/src/com/android/phone/CdmaOptions.java
index 8971fa4..3e3c8b5 100644
--- a/src/com/android/phone/CdmaOptions.java
+++ b/src/com/android/phone/CdmaOptions.java
@@ -43,7 +43,6 @@
     private static final String BUTTON_CDMA_SYSTEM_SELECT_KEY = "cdma_system_select_key";
     private static final String BUTTON_CDMA_SUBSCRIPTION_KEY = "cdma_subscription_key";
     private static final String BUTTON_CDMA_ACTIVATE_DEVICE_KEY = "cdma_activate_device_key";
-    private static final String BUTTON_CARRIER_SETTINGS_KEY = "carrier_settings_key";
 
     private PreferenceActivity mPrefActivity;
     private PreferenceScreen mPrefScreen;
@@ -84,16 +83,6 @@
             mPrefScreen.removePreference(
                     mPrefScreen.findPreference(BUTTON_CDMA_ACTIVATE_DEVICE_KEY));
         }
-
-        // Read platform settings for carrier settings
-        final boolean isCarrierSettingsEnabled = mPrefActivity.getResources().getBoolean(
-                R.bool.config_carrier_settings_enable);
-        if (!isCarrierSettingsEnabled) {
-            Preference pref = mPrefScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY);
-            if (pref != null) {
-                mPrefScreen.removePreference(pref);
-            }
-        }
     }
 
     private boolean deviceSupportsNvAndRuim() {
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 7e43a55..9c82b60 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -70,6 +70,7 @@
     private static final String BUTTON_ROAMING_KEY = "button_roaming_key";
     private static final String BUTTON_CDMA_LTE_DATA_SERVICE_KEY = "cdma_lte_data_service_key";
     private static final String BUTTON_ENABLED_NETWORKS_KEY = "enabled_networks_key";
+    private static final String BUTTON_CARRIER_SETTINGS_KEY = "carrier_settings_key";
 
     static final int preferredNetworkMode = Phone.PREFERRED_NT_MODE;
 
@@ -317,6 +318,16 @@
             android.util.Log.d(LOG_TAG, "keep ltePref");
         }
 
+        // Read platform settings for carrier settings
+        final boolean isCarrierSettingsEnabled = getResources().getBoolean(
+                R.bool.config_carrier_settings_enable);
+        if (!isCarrierSettingsEnabled) {
+            Preference pref = prefSet.findPreference(BUTTON_CARRIER_SETTINGS_KEY);
+            if (pref != null) {
+                prefSet.removePreference(pref);
+            }
+        }
+
         ActionBar actionBar = getActionBar();
         if (actionBar != null) {
             // android.R.id.home will be triggered in onOptionsItemSelected()