Merge "[Settings] Refactor MobileNetworkUtils"
This commit is contained in:
committed by
Android (Google) Code Review
commit
96b9e1560a
@@ -355,21 +355,22 @@ public class MobileNetworkUtils {
|
|||||||
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
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_CDMA) {
|
|
||||||
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_CDMA) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isWorldMode(context, subId)) {
|
if (isWorldMode(context, subId)) {
|
||||||
final int settingsNetworkMode = getNetworkTypeFromRaf(
|
final int settingsNetworkMode = getNetworkTypeFromRaf(
|
||||||
(int) telephonyManager.getAllowedNetworkTypesForReason(
|
(int) telephonyManager.getAllowedNetworkTypesForReason(
|
||||||
|
Reference in New Issue
Block a user