From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sat, 29 Dec 2018 06:58:18 -0500
Subject: [PATCH] Change UpdateEnabledNetworksValueAndSummary to handle all
 modes

Change-Id: I25bab65a6b3743a05f2d76395e59dc3f241a14d3
---
 .../android/phone/MobileNetworkSettings.java  | 50 ++++---------------
 1 file changed, 11 insertions(+), 39 deletions(-)

diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index d5c099241..8241b9728 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -1085,35 +1085,31 @@ public class MobileNetworkSettings extends PreferenceActivity
     }
 
     private void UpdateEnabledNetworksValueAndSummary(int NetworkMode) {
+        boolean invalidMode = false;
         switch (NetworkMode) {
             case Phone.NT_MODE_TDSCDMA_WCDMA:
             case Phone.NT_MODE_TDSCDMA_GSM_WCDMA:
             case Phone.NT_MODE_TDSCDMA_GSM:
-                mButtonEnabledNetworks.setValue(
-                        Integer.toString(Phone.NT_MODE_TDSCDMA_GSM_WCDMA));
+            case Phone.NT_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
+            case Phone.NT_MODE_CDMA:
+            case Phone.NT_MODE_EVDO_NO_CDMA:
+            case Phone.NT_MODE_GLOBAL:
+            case Phone.NT_MODE_TDSCDMA_ONLY:
                 mButtonEnabledNetworks.setSummary(R.string.network_3G);
                 break;
             case Phone.NT_MODE_WCDMA_ONLY:
             case Phone.NT_MODE_GSM_UMTS:
             case Phone.NT_MODE_WCDMA_PREF:
                 if (!mIsGlobalCdma) {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_WCDMA_PREF));
                     mButtonEnabledNetworks.setSummary(R.string.network_3G);
                 } else {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
                     mButtonEnabledNetworks.setSummary(R.string.network_global);
                 }
                 break;
             case Phone.NT_MODE_GSM_ONLY:
                 if (!mIsGlobalCdma) {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_GSM_ONLY));
                     mButtonEnabledNetworks.setSummary(R.string.network_2G);
                 } else {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
                     mButtonEnabledNetworks.setSummary(R.string.network_global);
                 }
                 break;
@@ -1128,13 +1124,9 @@ public class MobileNetworkSettings extends PreferenceActivity
             case Phone.NT_MODE_LTE_ONLY:
             case Phone.NT_MODE_LTE_WCDMA:
                 if (!mIsGlobalCdma) {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_GSM_WCDMA));
                     mButtonEnabledNetworks.setSummary((mShow4GForLTE == true)
                             ? R.string.network_4G : R.string.network_lte);
                 } else {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
                     mButtonEnabledNetworks.setSummary(R.string.network_global);
                 }
                 break;
@@ -1145,33 +1137,12 @@ public class MobileNetworkSettings extends PreferenceActivity
                     controlCdmaOptions(true);
                     controlGsmOptions(false);
                 } else {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_CDMA_AND_EVDO));
                     mButtonEnabledNetworks.setSummary(R.string.network_lte);
                 }
                 break;
-            case Phone.NT_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
-                mButtonEnabledNetworks.setValue(
-                        Integer.toString(Phone.NT_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
-                mButtonEnabledNetworks.setSummary(R.string.network_3G);
-                break;
-            case Phone.NT_MODE_CDMA:
-            case Phone.NT_MODE_EVDO_NO_CDMA:
-            case Phone.NT_MODE_GLOBAL:
-                mButtonEnabledNetworks.setValue(
-                        Integer.toString(Phone.NT_MODE_CDMA));
-                mButtonEnabledNetworks.setSummary(R.string.network_3G);
-                break;
             case Phone.NT_MODE_CDMA_NO_EVDO:
-                mButtonEnabledNetworks.setValue(
-                        Integer.toString(Phone.NT_MODE_CDMA_NO_EVDO));
                 mButtonEnabledNetworks.setSummary(R.string.network_1x);
                 break;
-            case Phone.NT_MODE_TDSCDMA_ONLY:
-                mButtonEnabledNetworks.setValue(
-                        Integer.toString(Phone.NT_MODE_TDSCDMA_ONLY));
-                mButtonEnabledNetworks.setSummary(R.string.network_3G);
-                break;
             case Phone.NT_MODE_LTE_TDSCDMA_GSM:
             case Phone.NT_MODE_LTE_TDSCDMA_GSM_WCDMA:
             case Phone.NT_MODE_LTE_TDSCDMA:
@@ -1179,16 +1150,12 @@ public class MobileNetworkSettings extends PreferenceActivity
             case Phone.NT_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
             case Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
                 if (isSupportTdscdma()) {
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
                     mButtonEnabledNetworks.setSummary(R.string.network_lte);
                 } else {
                     if (isWorldMode()) {
                         controlCdmaOptions(true);
                         controlGsmOptions(false);
                     }
-                    mButtonEnabledNetworks.setValue(
-                            Integer.toString(Phone.NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
                     if (mPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA ||
                             mIsGlobalCdma ||
                             isWorldMode()) {
@@ -1200,10 +1167,15 @@ public class MobileNetworkSettings extends PreferenceActivity
                 }
                 break;
             default:
+                invalidMode = true;
                 String errMsg = "Invalid Network Mode (" + NetworkMode + "). Ignore.";
                 loge(errMsg);
                 mButtonEnabledNetworks.setSummary(errMsg);
         }
+        if (!invalidMode) {
+            mButtonEnabledNetworks.setValue(
+                Integer.toString(NetworkMode));
+        }
     }
 
     @Override
