[Settings] Refactor MobileNetworkUtils

Code refactor MobileNetworkUtils
  - reduce number of accessing to isWorldMode()

Bug: 201757298
Test: presubmit pass
Change-Id: I710255887b5ba8038c3faf5471a88a02a15c015e
This commit is contained in:
Bonian Chen
2021-10-01 19:10:28 +08:00
parent bc02a2d939
commit b74ccf7f33

View File

@@ -468,11 +468,14 @@ public class MobileNetworkUtils {
return false;
}
if (!isWorldMode(context, subId)) {
return isGsmBasicOptions(context, subId);
}
final int networkMode = getNetworkTypeFromRaf(
(int) telephonyManager.getAllowedNetworkTypesForReason(
TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER));
if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO
&& isWorldMode(context, subId)) {
if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO) {
return false;
}
if (shouldSpeciallyUpdateGsmCdma(context, subId)) {
@@ -483,10 +486,8 @@ public class MobileNetworkUtils {
return true;
}
if (isWorldMode(context, subId)) {
if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) {
return true;
}
if (networkMode == TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA) {
return true;
}
return false;