[Settings] Refactor MobileNetworkUtils
Code refactor MobileNetworkUtils - Access CarrierConfig API prior to Telephony API Bug: 201757298 Test: presubmit pass Change-Id: I0b9c05d1d45bdf26dd456172976a0994719fab86
This commit is contained in:
@@ -421,20 +421,21 @@ public class MobileNetworkUtils {
|
||||
}
|
||||
|
||||
private static boolean isGsmBasicOptions(Context context, int subId) {
|
||||
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(subId);
|
||||
final PersistableBundle carrierConfig = context.getSystemService(
|
||||
CarrierConfigManager.class).getConfigForSubId(subId);
|
||||
|
||||
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
|
||||
return true;
|
||||
} else if (carrierConfig != null
|
||||
if (carrierConfig != null
|
||||
&& !carrierConfig.getBoolean(
|
||||
CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
|
||||
&& carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(subId);
|
||||
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user