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

Commit 2938f11d authored by Jeff Davidson's avatar Jeff Davidson
Browse files

Bypass consent dialogs for privileged eUICC switches.

Privileged code should only be triggering switches in response to user
action or at other trusted times. Don't require user consent so the
code can have finer-grained control over its consent UI as needed.

Change-Id: If1ce4cf4de4d1d1287d801812de4109c505c7799
Fixes: 63134740
Test: Unit test
parent 17a99fb6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -623,6 +623,13 @@ public class EuiccController extends IEuiccController.Stub {

        long token = Binder.clearCallingIdentity();
        try {
            if (callerCanWriteEmbeddedSubscriptions) {
                // Assume that if a privileged caller is calling us, we don't need to prompt the
                // user about changing carriers, because the caller would only be acting in response
                // to user action.
                forceDeactivateSim = true;
            }

            final String iccid;
            if (subscriptionId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
                // Switch to "no" subscription. Only the system can do this.
+0 −13
Original line number Diff line number Diff line
@@ -579,19 +579,6 @@ public class EuiccControllerTest extends TelephonyTest {
                42 /* detailedCode */);
    }

    @Test
    public void testSwitchToSubscription_mustDeactivateSim() throws Exception {
        setHasWriteEmbeddedPermission(true);
        prepareOperationSubscription(false /* hasPrivileges */);
        callSwitchToSubscription(
                SUBSCRIPTION_ID, ICC_ID, true /* complete */,
                EuiccService.RESULT_MUST_DEACTIVATE_SIM, "whatever" /* callingPackage */);
        verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR,
                0 /* detailedCode */);
        verifyResolutionIntent(EuiccService.ACTION_RESOLVE_DEACTIVATE_SIM,
                EuiccOperation.ACTION_SWITCH_DEACTIVATE_SIM);
    }

    @Test
    public void testSwitchToSubscription_success() throws Exception {
        setHasWriteEmbeddedPermission(true);