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

Commit 8dca2105 authored by Michele's avatar Michele
Browse files

[DO NOT MERGE]Add check for slot index value

Verify that slot index passed in setAllowedCarrier() and in
getAllowedCarrier() has a valid value or return error code.

Bug: 123097251
Test: compilation
Change-Id: I58e5447f2232d6aa096ddb7a8594d762ca74d22f
parent dee98726
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -7581,6 +7581,9 @@ public class TelephonyManager {
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
        if (!SubscriptionManager.isValidPhoneId(slotIndex)) {
            return -1;
        }
        try {
            ITelephony service = getITelephony();
            if (service != null) {
@@ -7608,6 +7611,7 @@ public class TelephonyManager {
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
        if (SubscriptionManager.isValidPhoneId(slotIndex)) {
            try {
                ITelephony service = getITelephony();
                if (service != null) {
@@ -7618,6 +7622,7 @@ public class TelephonyManager {
            } catch (NullPointerException e) {
                Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
            }
        }
        return new ArrayList<CarrierIdentifier>(0);
    }