[Settings] Refactor MobileNetworkUtils

Code refactor MobileNetworkUtils
    - move isWorldMode() detection to the first line
      within shouldSpeciallyUpdateGsmCdma()

Bug: 201757298
Test: presubmit pass
Change-Id: Iccffca52b2e0e48ff62ec749c0cf3faa273b0e18
This commit is contained in:
Bonian Chen
2021-10-01 18:55:52 +08:00
parent 06d312f0af
commit bc02a2d939

View File

@@ -582,6 +582,9 @@ public class MobileNetworkUtils {
*/ */
@VisibleForTesting @VisibleForTesting
static boolean shouldSpeciallyUpdateGsmCdma(Context context, int subId) { static boolean shouldSpeciallyUpdateGsmCdma(Context context, int subId) {
if (!isWorldMode(context, subId)) {
return false;
}
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class) final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
.createForSubscriptionId(subId); .createForSubscriptionId(subId);
final int networkMode = getNetworkTypeFromRaf( final int networkMode = getNetworkTypeFromRaf(
@@ -594,7 +597,7 @@ public class MobileNetworkUtils {
|| networkMode || networkMode
== TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA == TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA
|| networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA) { || networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA) {
if (!isTdscdmaSupported(context, subId) && isWorldMode(context, subId)) { if (!isTdscdmaSupported(context, subId)) {
return true; return true;
} }
} }