DO NOT MERGE ANYWHERE 1x options be removed from specific preferred network list.

specific carrier does not support 1x network,so remove 1x option
from preferred network mode settings to avoid user select it.

Bug: 124000556
Test: manual - test step as below :
1. inset USCC sim card
2. check preferred network settings list
3. switch preferred network for each option and check all another UI
in mobile network page.

Change-Id: I1890182fc0e5c5553785893a8c7d3159c7769b44
diff --git a/res/values-mcc204-mnc04/strings.xml b/res/values-mcc204-mnc04/strings.xml
index fec694f..9708836 100644
--- a/res/values-mcc204-mnc04/strings.xml
+++ b/res/values-mcc204-mnc04/strings.xml
@@ -16,4 +16,6 @@
 
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string translatable="false" name="config_world_mode">true;BAE0000000000000</string>
+    <string translatable="false" name="config_world_mode_spn">true;U.S. CELLULAR</string>
+    <string translatable="false" name="config_show_gsm_option">true;U.S. CELLULAR</string>
 </resources>
diff --git a/res/values-mcc311-mnc220/strings.xml b/res/values-mcc311-mnc220/strings.xml
new file mode 100644
index 0000000..52ba286
--- /dev/null
+++ b/res/values-mcc311-mnc220/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string translatable="false" name="config_world_mode">true</string>
+    <string translatable="false" name="config_show_gsm_option">true</string>
+</resources>
diff --git a/res/values-mcc311-mnc225/strings.xml b/res/values-mcc311-mnc225/strings.xml
new file mode 100644
index 0000000..52ba286
--- /dev/null
+++ b/res/values-mcc311-mnc225/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string translatable="false" name="config_world_mode">true</string>
+    <string translatable="false" name="config_show_gsm_option">true</string>
+</resources>
diff --git a/res/values-mcc311-mnc580/strings.xml b/res/values-mcc311-mnc580/strings.xml
new file mode 100644
index 0000000..52ba286
--- /dev/null
+++ b/res/values-mcc311-mnc580/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string translatable="false" name="config_world_mode">true</string>
+    <string translatable="false" name="config_show_gsm_option">true</string>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9053520..62c03ca 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1797,4 +1797,8 @@
     <!-- Message displayed to the user to indicate that a held call has been released /
          disconnected. -->
     <string name="supp_service_held_call_released">Held call has been released.</string>
+    <!-- Configuration setting for world mode Format is <true;SPN if any to be checked>-->
+    <string translatable="false" name="config_world_mode_spn">false</string>
+    <!-- Configuration setting for mobile network settings show network option by phoneType. Format is <true;SPN if any to be checked>-->
+    <string translatable="false" name="config_show_gsm_option">false</string>
 </resources>
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index f128f9a..745a7ff 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -1708,7 +1708,12 @@
                     } else {
                         if (isWorldMode()) {
                             controlCdmaOptions(true);
-                            controlGsmOptions(false);
+                            if (showNetworkOptionByPhoneType()
+                                    && mPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
+                                controlGsmOptions(true);
+                            } else {
+                                controlGsmOptions(false);
+                            }
                         }
                         mButtonEnabledNetworks.setValue(
                                 Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
@@ -1931,20 +1936,59 @@
             return super.onOptionsItemSelected(item);
         }
 
-        private boolean isWorldMode() {
-            boolean worldModeOn = false;
-            final String configString = getResources().getString(R.string.config_world_mode);
+        private boolean showNetworkOptionByPhoneType() {
+            boolean showByPhoneType = false;
+            final String configString = getResources().getString(
+                    R.string.config_show_gsm_option);
 
             if (!TextUtils.isEmpty(configString)) {
                 String[] configArray = configString.split(";");
-                // Check if we have World mode configuration set to True only or config is set to True
-                // and SIM GID value is also set and matches to the current SIM GID.
+                // Check if we have showNetworkOptionByPhoneType configuration set to True only
+                // or config is set to True and SIM SPN value is also set and matches to the
+                // current SIM SPN.
+                if (configArray != null && (
+                        (configArray.length == 1 && configArray[0].equalsIgnoreCase("true"))
+                                || (configArray.length == 2 && !TextUtils.isEmpty(configArray[1])
+                                && mTelephonyManager != null
+                                && configArray[1].equalsIgnoreCase(
+                                mTelephonyManager.getSimOperatorName())))) {
+                    showByPhoneType = true;
+                }
+            }
+            Log.d(LOG_TAG, "showNetworkOptionByPhoneType=" + showByPhoneType);
+
+            return showByPhoneType;
+        }
+
+        private boolean isWorldMode() {
+            boolean worldModeOn = false;
+            final String configString = getResources().getString(R.string.config_world_mode);
+            final String configStringSpn = getResources().getString(R.string.config_world_mode_spn);
+
+            if (!TextUtils.isEmpty(configString)) {
+                String[] configArray = configString.split(";");
+                // Check if we have World mode configuration set to True only or config is set to
+                // True and SIM GID value is also set and matches to the current SIM GID.
                 if (configArray != null &&
                         ((configArray.length == 1 && configArray[0].equalsIgnoreCase("true"))
                                 || (configArray.length == 2 && !TextUtils.isEmpty(configArray[1])
                                 && mTelephonyManager != null
                                 && configArray[1].equalsIgnoreCase(
-                                        mTelephonyManager.getGroupIdLevel1())))) {
+                                mTelephonyManager.getGroupIdLevel1())))) {
+                    worldModeOn = true;
+                }
+            }
+            if (!worldModeOn && !TextUtils.isEmpty(configStringSpn)) {
+                String[] configArray = configStringSpn.split(";");
+                // Check if we have World mode configuration set to True only or config is set to
+                // True and SIM SPN value is also set and matches to the current SIM SPN.
+                if (configArray != null
+                        && configArray.length == 2 && !TextUtils.isEmpty(configArray[0])
+                        && !TextUtils.isEmpty(configArray[1])
+                        && configArray[0].equalsIgnoreCase("true")
+                        && mTelephonyManager != null
+                        && configArray[1].equalsIgnoreCase(
+                        mTelephonyManager.getSimOperatorName())) {
                     worldModeOn = true;
                 }
             }