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

Commit c09e57a1 authored by sqian's avatar sqian
Browse files

Check permission for SubscriptionController.isActiveSubId

Test: Treehugger
Bug: 113072551
Change-Id: I77d365ed5a689cf99cd710264eebf2729ff0cede
parent 95268b13
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);