Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 894ee44b authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Add check for slot index value" am: d8148b6c am: e7d03a6f" into pi-dev-plus-aosp

parents 8c8249d1 ef96c449
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -8751,6 +8751,9 @@ public class TelephonyManager {
    @SystemApi
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
    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
        // Execute the method setCarrierRestrictionRules with an empty excluded list and
        // indicating priority for the allowed list.
        // indicating priority for the allowed list.
        CarrierRestrictionRules carrierRestrictionRules = CarrierRestrictionRules.newBuilder()
        CarrierRestrictionRules carrierRestrictionRules = CarrierRestrictionRules.newBuilder()
@@ -8761,7 +8764,7 @@ public class TelephonyManager {


        int result = setCarrierRestrictionRules(carrierRestrictionRules);
        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) {
        if (result == SET_CARRIER_RESTRICTION_SUCCESS) {
            return carriers.size();
            return carriers.size();
        } else {
        } else {
@@ -8854,10 +8857,12 @@ public class TelephonyManager {
    @SystemApi
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
    public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
        if (SubscriptionManager.isValidPhoneId(slotIndex)) {
            CarrierRestrictionRules carrierRestrictionRule = getCarrierRestrictionRules();
            CarrierRestrictionRules carrierRestrictionRule = getCarrierRestrictionRules();
            if (carrierRestrictionRule != null) {
            if (carrierRestrictionRule != null) {
                return carrierRestrictionRule.getAllowedCarriers();
                return carrierRestrictionRule.getAllowedCarriers();
            }
            }
        }
        return new ArrayList<CarrierIdentifier>(0);
        return new ArrayList<CarrierIdentifier>(0);
    }
    }