[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) {
|
private static boolean isGsmBasicOptions(Context context, int subId) {
|
||||||
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
|
|
||||||
.createForSubscriptionId(subId);
|
|
||||||
final PersistableBundle carrierConfig = context.getSystemService(
|
final PersistableBundle carrierConfig = context.getSystemService(
|
||||||
CarrierConfigManager.class).getConfigForSubId(subId);
|
CarrierConfigManager.class).getConfigForSubId(subId);
|
||||||
|
if (carrierConfig != null
|
||||||
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
|
|
||||||
return true;
|
|
||||||
} else if (carrierConfig != null
|
|
||||||
&& !carrierConfig.getBoolean(
|
&& !carrierConfig.getBoolean(
|
||||||
CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
|
CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
|
||||||
&& carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL)) {
|
&& carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
|
||||||
|
.createForSubscriptionId(subId);
|
||||||
|
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user