From 1eef718549f57fe8cbcb9a78adcfb9db867808e8 Mon Sep 17 00:00:00 2001 From: Bonian Chen Date: Fri, 1 Oct 2021 23:00:03 +0800 Subject: [PATCH] [Settings] Refactor MobileNetworkUtils Code refactor MobileNetworkUtils - reorder the rule within #shouldDisplayNetworkSelectOptions() Bug: 201757298 Test: presubmit pass Change-Id: Idba39ca806263b850fa23aa8bb2dd423860bc043 --- .../network/telephony/MobileNetworkUtils.java | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java index 49acd3926ac..a5e4197968f 100644 --- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java +++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java @@ -468,29 +468,23 @@ public class MobileNetworkUtils { return false; } - if (!isWorldMode(context, subId)) { - return isGsmBasicOptions(context, subId); + if (isWorldMode(context, subId)) { + final int networkMode = getNetworkTypeFromRaf( + (int) telephonyManager.getAllowedNetworkTypesForReason( + TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER)); + if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO) { + return false; + } + if (shouldSpeciallyUpdateGsmCdma(context, subId)) { + return false; + } + + if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) { + return true; + } } - final int networkMode = getNetworkTypeFromRaf( - (int) telephonyManager.getAllowedNetworkTypesForReason( - TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER)); - if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO) { - return false; - } - if (shouldSpeciallyUpdateGsmCdma(context, subId)) { - return false; - } - - if (isGsmBasicOptions(context, subId)) { - return true; - } - - if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) { - return true; - } - - return false; + return isGsmBasicOptions(context, subId); } /**