From b0eaecdfeeaedc39ec8af6799572c7d549b59f8b Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sat, 29 Dec 2018 07:05:47 -0500
Subject: [PATCH] More preferred network modes

Change-Id: Ibd97b5209c002547da714cb176094fee57a18f6d
---
 res/values/strings.xml                        | 47 +++++++++++++++++++
 .../android/phone/MobileNetworkSettings.java  | 31 ++++++++++--
 2 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5be5e1c7..b8c4b9c6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -423,6 +423,8 @@
     <string name="preferred_network_mode_cdma_evdo_gsm_wcdma_summary">Preferred network mode: CDMA/EvDo/GSM/WCDMA</string>
     <!-- Mobile network settings, summary for preferred network mode LTE [CHAR LIMIT=100] -->
     <string name="preferred_network_mode_lte_summary">Preferred network mode: LTE </string>
+    <!-- Mobile network settings, summary for preferred network mode LTE only [CHAR LIMIT=100] -->
+    <string name="preferred_network_mode_lte_only_summary">Preferred network mode: LTE only</string>
     <!-- Mobile network settings, summary for preferred network mode GSM/WCDMA/LTE [CHAR LIMIT=100] -->
     <string name="preferred_network_mode_lte_gsm_wcdma_summary">Preferred network mode: GSM/WCDMA/LTE</string>
     <!-- Mobile network settings, summary for preferred network mode CDMA+LTE/EVDO[CHAR LIMIT=100] -->
@@ -431,6 +433,8 @@
     <string name="preferred_network_mode_global_summary">Preferred network mode: Global</string>
     <!-- Mobile network settings, summary for preferred network mode LTE / WCDMA[CHAR LIMIT=100] -->
     <string name="preferred_network_mode_lte_wcdma_summary">Preferred network mode: LTE / WCDMA</string>
+    <!-- Mobile network settings, summary for preferred network mode LTE / WCDMA only [CHAR LIMIT=100] -->
+    <string name="preferred_network_mode_lte_wcdma_only_summary">Preferred network mode: LTE / WCDMA only</string>
      <!-- Mobile network settings, summary for preferred network mode LTE / GSM / UMTS [CHAR LIMIT=100] -->
      <string name="preferred_network_mode_lte_gsm_umts_summary">Preferred network mode: LTE / GSM / UMTS</string>
      <!-- Mobile network settings, summary for preferred network mode LTE / CDMA [CHAR LIMIT=100] -->
@@ -449,6 +453,8 @@
     <string name="preferred_network_mode_tdscdma_gsm_wcdma_summary">Preferred network mode: TDSCDMA/GSM/WCDMA</string>
     <!-- Mobile network settings, summary for preferred network mode LTE / TDSCDMA / WCDMA[CHAR LIMIT=100] -->
     <string name="preferred_network_mode_lte_tdscdma_wcdma_summary">Preferred network mode: LTE/TDSCDMA/WCDMA</string>
+    <!-- Mobile network settings, summary for preferred network mode LTE / TDSCDMA / WCDMA only [CHAR LIMIT=100] -->
+    <string name="preferred_network_mode_lte_tdscdma_wcdma_only_summary">Preferred network mode: LTE/TDSCDMA/WCDMA only</string>
     <!-- Mobile network settings, summary for preferred network mode LTE / TDSCDMA / GSM / WCDMA[CHAR LIMIT=100] -->
     <string name="preferred_network_mode_lte_tdscdma_gsm_wcdma_summary">Preferred network mode: LTE/TDSCDMA/GSM/WCDMA</string>
     <!-- Mobile network settings, summary for preferred network mode TDSCDMA / CDMA / EvDo / GSM / WCDMA[CHAR LIMIT=100] -->
@@ -680,96 +686,137 @@
     <string name="multi_category_enable">Multi-category enabled</string>
     <string name="multi_category_disable">Multi-category disabled</string>
 
+    <string name="network_3G_lte_only">LTE/3G only</string>
+    <string name="network_lte_only">LTE only</string>
     <string name="network_lte">LTE (recommended)</string>
+    <string name="network_3G_4G_only">4G/3G only</string>
+    <string name="network_4G_only">4G only</string>
     <string name="network_4G">4G (recommended)</string>
+    <string name="network_3G_only">3G only</string>
     <string name="network_3G" translatable="false">3G</string>
     <string name="network_2G" translatable="false">2G</string>
     <string name="network_1x" translatable="false">1x</string>
     <string name="network_global">Global</string>
 
     <string-array name="enabled_networks_except_gsm_choices" translatable="false">
+        <item>@string/network_3G_lte_only</item>
+        <item>@string/network_lte_only</item>
         <item>@string/network_lte</item>
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
     </string-array>
     <string-array name="enabled_networks_except_gsm_4g_choices" translatable="false">
+        <item>@string/network_3G_4G_only</item>
+        <item>@string/network_4G_only</item>
         <item>@string/network_4G</item>
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
     </string-array>
     <string-array name="enabled_networks_except_gsm_values" translatable="false">
+        <item>"12"</item>
+        <item>"11"</item>
         <item>"9"</item>
+        <item>"2"</item>
         <item>"0"</item>
     </string-array>
 
     <string-array name="enabled_networks_except_lte_choices" translatable="false">
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
         <item>@string/network_2G</item>
     </string-array>
     <string-array name="enabled_networks_except_lte_values" translatable="false">
+        <item>"2"</item>
         <item>"0"</item>
         <item>"1"</item>
     </string-array>
 
     <string-array name="enabled_networks_except_gsm_lte_choices" translatable="false">
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
     </string-array>
     <string-array name="enabled_networks_except_gsm_lte_values" translatable="false">
+        <item>"2"</item>
         <item>"0"</item>
     </string-array>
 
     <string-array name="enabled_networks_choices" translatable="false">
+        <item>@string/network_3G_lte_only</item>
+        <item>@string/network_lte_only</item>
         <item>@string/network_lte</item>
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
         <item>@string/network_2G</item>
     </string-array>
     <string-array name="enabled_networks_4g_choices" translatable="false">
+        <item>@string/network_3G_4G_only</item>
+        <item>@string/network_4G_only</item>
         <item>@string/network_4G</item>
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
         <item>@string/network_2G</item>
     </string-array>
     <string-array name="enabled_networks_values" translatable="false">
+        <item>"12"</item>
+        <item>"11"</item>
         <item>"9"</item>
+        <item>"2"</item>
         <item>"0"</item>
         <item>"1"</item>
     </string-array>
 
     <string-array name="enabled_networks_cdma_choices" translatable="false">
+        <item>@string/network_lte_only</item>
         <item>@string/network_lte</item>
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
         <item>@string/network_1x</item>
         <item>@string/network_global</item>
     </string-array>
     <string-array name="enabled_networks_cdma_values" translatable="false">
+        <item>"11"</item>
         <item>"8"</item>
+        <item>"6"</item>
         <item>"4"</item>
         <item>"5"</item>
         <item>"10"</item>
     </string-array>
 
     <string-array name="enabled_networks_cdma_no_lte_choices" translatable="false">
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
         <item>@string/network_1x</item>
     </string-array>
     <string-array name="enabled_networks_cdma_no_lte_values" translatable="false">
+        <item>"6"</item>
         <item>"4"</item>
         <item>"5"</item>
     </string-array>
 
     <string-array name="enabled_networks_cdma_only_lte_choices" translatable="false">
+        <item>@string/network_lte_only</item>
         <item>@string/network_lte</item>
         <item>@string/network_global</item>
     </string-array>
     <string-array name="enabled_networks_cdma_only_lte_values" translatable="false">
+        <item>"11"</item>
         <item>"8"</item>
         <item>"10"</item>
     </string-array>
 
     <string-array name="enabled_networks_tdscdma_choices" translatable="false">
+        <item>@string/network_3G_lte_only</item>
+        <item>@string/network_lte_only</item>
         <item>@string/network_lte</item>
+        <item>@string/network_3G_only</item>
         <item>@string/network_3G</item>
         <item>@string/network_2G</item>
     </string-array>
     <string-array name="enabled_networks_tdscdma_values" translatable="false">
+        <item>"19"</item>
+        <item>"11"</item>
         <item>"22"</item>
+        <item>"14"</item>
         <item>"18"</item>
         <item>"1"</item>
     </string-array>
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 8241b972..8f926bd3 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -831,8 +831,11 @@ public class MobileNetworkSettings extends PreferenceActivity
             if (DBG) log("buttonNetworkMode: " + buttonNetworkMode);
             // if new mode is invalid ignore it
             switch (buttonNetworkMode) {
+                case Phone.NT_MODE_WCDMA_ONLY:
                 case Phone.NT_MODE_WCDMA_PREF:
                 case Phone.NT_MODE_GSM_ONLY:
+                case Phone.NT_MODE_LTE_ONLY:
+                case Phone.NT_MODE_LTE_WCDMA:
                 case Phone.NT_MODE_LTE_GSM_WCDMA:
                 case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
                 case Phone.NT_MODE_CDMA:
@@ -1025,7 +1028,7 @@ public class MobileNetworkSettings extends PreferenceActivity
                 break;
             case Phone.NT_MODE_LTE_ONLY:
                 mButtonPreferredNetworkMode.setSummary(
-                        R.string.preferred_network_mode_lte_summary);
+                        R.string.preferred_network_mode_lte_only_summary);
                 break;
             case Phone.NT_MODE_LTE_TDSCDMA_GSM:
                 mButtonPreferredNetworkMode.setSummary(
@@ -1072,11 +1075,11 @@ public class MobileNetworkSettings extends PreferenceActivity
                 break;
             case Phone.NT_MODE_LTE_TDSCDMA_WCDMA:
                 mButtonPreferredNetworkMode.setSummary(
-                        R.string.preferred_network_mode_lte_tdscdma_wcdma_summary);
+                        R.string.preferred_network_mode_lte_tdscdma_wcdma_only_summary);
                 break;
             case Phone.NT_MODE_LTE_WCDMA:
                 mButtonPreferredNetworkMode.setSummary(
-                        R.string.preferred_network_mode_lte_wcdma_summary);
+                        R.string.preferred_network_mode_lte_wcdma_only_summary);
                 break;
             default:
                 mButtonPreferredNetworkMode.setSummary(
@@ -1098,6 +1101,12 @@ public class MobileNetworkSettings extends PreferenceActivity
                 mButtonEnabledNetworks.setSummary(R.string.network_3G);
                 break;
             case Phone.NT_MODE_WCDMA_ONLY:
+                if (!mIsGlobalCdma) {
+                    mButtonEnabledNetworks.setSummary(R.string.network_3G_only);
+                } else {
+                    mButtonEnabledNetworks.setSummary(R.string.network_global);
+                }
+                break;
             case Phone.NT_MODE_GSM_UMTS:
             case Phone.NT_MODE_WCDMA_PREF:
                 if (!mIsGlobalCdma) {
@@ -1121,11 +1130,25 @@ public class MobileNetworkSettings extends PreferenceActivity
                     controlGsmOptions(true);
                     break;
                 }
+                if (!mIsGlobalCdma) {
+                    mButtonEnabledNetworks.setSummary((mShow4GForLTE == true)
+                            ? R.string.network_4G : R.string.network_lte);
+                } else {
+                    mButtonEnabledNetworks.setSummary(R.string.network_global);
+                }
+                break;
             case Phone.NT_MODE_LTE_ONLY:
+                if (!mIsGlobalCdma) {
+                    mButtonEnabledNetworks.setSummary((mShow4GForLTE == true)
+                            ? R.string.network_4G_only : R.string.network_lte_only);
+                } else {
+                    mButtonEnabledNetworks.setSummary(R.string.network_global);
+                }
+                break;
             case Phone.NT_MODE_LTE_WCDMA:
                 if (!mIsGlobalCdma) {
                     mButtonEnabledNetworks.setSummary((mShow4GForLTE == true)
-                            ? R.string.network_4G : R.string.network_lte);
+                            ? R.string.network_3G_4G_only : R.string.network_3G_lte_only);
                 } else {
                     mButtonEnabledNetworks.setSummary(R.string.network_global);
                 }
-- 
2.20.1

