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

Commit bd394035 authored by Shuo Qian's avatar Shuo Qian Committed by Gerrit Code Review
Browse files

Merge "Check permission for SubscriptionController.isActiveSubId"

parents 15d535ee c09e57a1
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1954,6 +1954,20 @@ public class SubscriptionController extends ISub.Stub {
    }

    @Override
    public boolean isActiveSubId(int subId, String callingPackage) {
        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mContext, subId, callingPackage,
              "isActiveSubId")) {
            throw new SecurityException("Requires READ_PHONE_STATE permission.");
        }
        final long identity = Binder.clearCallingIdentity();
        try {
            return isActiveSubId(subId);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    @Deprecated // This should be moved into isActiveSubId(int, String)
    public boolean isActiveSubId(int subId) {
        boolean retVal = SubscriptionManager.isValidSubscriptionId(subId)
                && getActiveSubIdArrayList().contains(subId);