Merge "Merge "Merge "Add check for slot index value" am: d8148b6c8c am: e7d03a6ff1" into pi-dev-plus-aosp am: 894ee44b53"
This commit is contained in:
committed by
Android (Google) Code Review
commit
478561d5f9
@@ -9095,6 +9095,9 @@ public class TelephonyManager {
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||
public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
|
||||
if (carriers == null || !SubscriptionManager.isValidPhoneId(slotIndex)) {
|
||||
return -1;
|
||||
}
|
||||
// Execute the method setCarrierRestrictionRules with an empty excluded list and
|
||||
// indicating priority for the allowed list.
|
||||
CarrierRestrictionRules carrierRestrictionRules = CarrierRestrictionRules.newBuilder()
|
||||
@@ -9105,7 +9108,7 @@ public class TelephonyManager {
|
||||
|
||||
int result = setCarrierRestrictionRules(carrierRestrictionRules);
|
||||
|
||||
// Convert boolean result into int, as required by this method.
|
||||
// Convert result into int, as required by this method.
|
||||
if (result == SET_CARRIER_RESTRICTION_SUCCESS) {
|
||||
return carriers.size();
|
||||
} else {
|
||||
@@ -9198,9 +9201,11 @@ public class TelephonyManager {
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
|
||||
CarrierRestrictionRules carrierRestrictionRule = getCarrierRestrictionRules();
|
||||
if (carrierRestrictionRule != null) {
|
||||
return carrierRestrictionRule.getAllowedCarriers();
|
||||
if (SubscriptionManager.isValidPhoneId(slotIndex)) {
|
||||
CarrierRestrictionRules carrierRestrictionRule = getCarrierRestrictionRules();
|
||||
if (carrierRestrictionRule != null) {
|
||||
return carrierRestrictionRule.getAllowedCarriers();
|
||||
}
|
||||
}
|
||||
return new ArrayList<CarrierIdentifier>(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user