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

Commit cd6da697 authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Add permission check and clear callers identity for setUiccApplicationsEnabled.

setUiccApplicationsEnabled is not a @SystemApi. So we need to check
modify phone state permission and clear / restore callers' identity.

Bug: 154865542
Test: manual - install test app with modify phone state and make sure
the operation can be done correctly.

Change-Id: I39fbaba46c9752491b39183743bb3af1e81e8783
parent da0712f8
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -2004,6 +2004,10 @@ public class SubscriptionController extends ISub.Stub {
    public int setUiccApplicationsEnabled(boolean enabled, int subId) {
        if (DBG) logd("[setUiccApplicationsEnabled]+ enabled:" + enabled + " subId:" + subId);

        enforceModifyPhoneState("setUiccApplicationsEnabled");

        long identity = Binder.clearCallingIdentity();
        try {
            ContentValues value = new ContentValues(1);
            value.put(SubscriptionManager.UICC_APPLICATIONS_ENABLED, enabled);

@@ -2021,6 +2025,9 @@ public class SubscriptionController extends ISub.Stub {
            }

            return result;
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    /**