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

Commit 0d6178db authored by Muralidhar Reddy Mule's avatar Muralidhar Reddy Mule Committed by Android (Google) Code Review
Browse files

Merge "Add portIndex to EuiccService#GetMetaData API"

parents f333b9b4 be93e4de
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -225,6 +225,8 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {
    static class GetMetadataRequest {
        DownloadableSubscription mSubscription;
        boolean mForceDeactivateSim;
        boolean mSwitchAfterDownload;
        int mPortIndex;
        GetMetadataCommandCallback mCallback;
    }

@@ -447,13 +449,15 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {

    /** Asynchronously fetch metadata for the given downloadable subscription. */
    @VisibleForTesting(visibility = PACKAGE)
    public void getDownloadableSubscriptionMetadata(int cardId,
            DownloadableSubscription subscription,
    public void getDownloadableSubscriptionMetadata(int cardId, int portIndex,
            DownloadableSubscription subscription, boolean switchAfterDownload,
            boolean forceDeactivateSim, GetMetadataCommandCallback callback) {
        GetMetadataRequest request =
                new GetMetadataRequest();
        request.mSubscription = subscription;
        request.mForceDeactivateSim = forceDeactivateSim;
        request.mSwitchAfterDownload = switchAfterDownload;
        request.mPortIndex = portIndex;
        request.mCallback = callback;
        sendMessage(CMD_GET_DOWNLOADABLE_SUBSCRIPTION_METADATA, cardId, 0 /* arg2 */, request);
    }
@@ -752,7 +756,9 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {
                        case CMD_GET_DOWNLOADABLE_SUBSCRIPTION_METADATA: {
                            GetMetadataRequest request = (GetMetadataRequest) message.obj;
                            mEuiccService.getDownloadableSubscriptionMetadata(slotId,
                                    request.mPortIndex,
                                    request.mSubscription,
                                    request.mSwitchAfterDownload,
                                    request.mForceDeactivateSim,
                                    new IGetDownloadableSubscriptionMetadataCallback.Stub() {
                                        @Override
+8 −4
Original line number Diff line number Diff line
@@ -386,6 +386,7 @@ public class EuiccController extends IEuiccController.Stub {

    void getDownloadableSubscriptionMetadata(int cardId, DownloadableSubscription subscription,
            boolean forceDeactivateSim, String callingPackage, PendingIntent callbackIntent) {
        Log.d(TAG, " getDownloadableSubscriptionMetadata callingPackage: " + callingPackage);
        if (!callerCanWriteEmbeddedSubscriptions()) {
            throw new SecurityException("Must have WRITE_EMBEDDED_SUBSCRIPTIONS to get metadata");
        }
@@ -393,7 +394,8 @@ public class EuiccController extends IEuiccController.Stub {
        long token = Binder.clearCallingIdentity();
        try {
            mConnector.getDownloadableSubscriptionMetadata(cardId,
                    subscription, forceDeactivateSim,
                    TelephonyManager.DEFAULT_PORT_INDEX, subscription,
                    false /* switchAfterDownload */, forceDeactivateSim,
                    new GetMetadataCommandCallback(
                            token, subscription, callingPackage, callbackIntent));
        } finally {
@@ -602,8 +604,8 @@ public class EuiccController extends IEuiccController.Stub {
            if (!isConsentNeededToResolvePortIndex
                    && canManageSubscriptionOnTargetSim(cardId, callingPackage, true,
                    portIndex)) {
                mConnector.getDownloadableSubscriptionMetadata(cardId, subscription,
                    forceDeactivateSim,
                mConnector.getDownloadableSubscriptionMetadata(cardId, portIndex,
                        subscription, switchAfterDownload, forceDeactivateSim,
                    new DownloadSubscriptionGetMetadataCommandCallback(token, subscription,
                        switchAfterDownload, callingPackage, forceDeactivateSim,
                        callbackIntent, false /* withUserConsent */, portIndex));
@@ -714,7 +716,8 @@ public class EuiccController extends IEuiccController.Stub {
        Log.d(TAG, " downloadSubscriptionPrivilegedCheckMetadata cardId: " + cardId
                + " switchAfterDownload: " + switchAfterDownload + " portIndex: " + portIndex
                + " forceDeactivateSim: " + forceDeactivateSim);
        mConnector.getDownloadableSubscriptionMetadata(cardId, subscription, forceDeactivateSim,
        mConnector.getDownloadableSubscriptionMetadata(cardId, portIndex,
                subscription, switchAfterDownload, forceDeactivateSim,
                new DownloadSubscriptionGetMetadataCommandCallback(callingToken, subscription,
                        switchAfterDownload, callingPackage, forceDeactivateSim, callbackIntent,
                        true /* withUserConsent */, portIndex));
@@ -863,6 +866,7 @@ public class EuiccController extends IEuiccController.Stub {

    void getDefaultDownloadableSubscriptionList(int cardId,
            boolean forceDeactivateSim, String callingPackage, PendingIntent callbackIntent) {
        Log.d(TAG, " getDefaultDownloadableSubscriptionList callingPackage: " + callingPackage);
        if (!callerCanWriteEmbeddedSubscriptions()) {
            throw new SecurityException(
                    "Must have WRITE_EMBEDDED_SUBSCRIPTIONS to get default list");
+5 −5
Original line number Diff line number Diff line
@@ -318,8 +318,8 @@ public class EuiccControllerTest extends TelephonyTest {
                SUBSCRIPTION, false /* complete */, null /* result */);
        verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_ERROR,
                0 /* detailedCode */);
        verify(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), any(), anyBoolean(),
                any());
        verify(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), anyInt(), any(),
                anyBoolean(), anyBoolean(), any());
    }

    @Test
@@ -1492,7 +1492,7 @@ public class EuiccControllerTest extends TelephonyTest {
            @Override
            public Void answer(InvocationOnMock invocation) throws Exception {
                EuiccConnector.GetMetadataCommandCallback cb = invocation
                        .getArgument(3 /* resultCallback */);
                        .getArgument(5 /* resultCallback */);
                if (complete) {
                    cb.onGetMetadataComplete(CARD_ID, result);
                } else {
@@ -1500,8 +1500,8 @@ public class EuiccControllerTest extends TelephonyTest {
                }
                return null;
            }
        }).when(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), any(), anyBoolean(),
                any());
        }).when(mMockConnector).getDownloadableSubscriptionMetadata(anyInt(), anyInt(), any(),
                anyBoolean(), anyBoolean(), any());
    }

    private void callGetDownloadableSubscriptionMetadata(DownloadableSubscription subscription,