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

Commit 5abd5285 authored by Jiuyu Sun's avatar Jiuyu Sun Committed by Android (Google) Code Review
Browse files

Merge "Populate cardId in resolution intent."

parents 0902334d f7a30110
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -253,7 +253,8 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {
    @VisibleForTesting(visibility = PACKAGE)
    public interface GetDefaultListCommandCallback extends BaseEuiccCommandCallback {
        /** Called when the list has completed (though it may have failed). */
        void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result);
        void onGetDefaultListComplete(int cardId,
                GetDefaultDownloadableSubscriptionListResult result);
    }

    /** Callback class for {@link #getEuiccInfo}. */
@@ -674,7 +675,8 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {
            } else if (isEuiccCommand(message.what)) {
                final BaseEuiccCommandCallback callback = getCallback(message);
                onCommandStart(callback);
                final int slotId = getSlotIdFromCardId(message.arg1);
                final int cardId = message.arg1;
                final int slotId = getSlotIdFromCardId(cardId);
                try {
                    switch (message.what) {
                        case CMD_GET_EID: {
@@ -702,7 +704,7 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {
                                                GetDownloadableSubscriptionMetadataResult result) {
                                            sendMessage(CMD_COMMAND_COMPLETE, (Runnable) () -> {
                                                ((GetMetadataCommandCallback) callback)
                                                        .onGetMetadataComplete(slotId, result);
                                                        .onGetMetadataComplete(cardId, result);
                                                onCommandEnd(callback);
                                            });
                                        }
@@ -754,7 +756,7 @@ public class EuiccConnector extends StateMachine implements ServiceConnection {
                                        ) {
                                            sendMessage(CMD_COMMAND_COMPLETE, (Runnable) () -> {
                                                ((GetDefaultListCommandCallback) callback)
                                                        .onGetDefaultListComplete(result);
                                                        .onGetDefaultListComplete(cardId, result);
                                                onCommandEnd(callback);
                                            });
                                        }
+22 −12
Original line number Diff line number Diff line
@@ -291,7 +291,8 @@ public class EuiccController extends IEuiccController.Stub {
                            mCallingPackage,
                            0 /* resolvableErrors */,
                            false /* confirmationCodeRetried */,
                            getOperationForDeactivateSim());
                            getOperationForDeactivateSim(),
                            cardId);
                    break;
                default:
                    resultCode = ERROR;
@@ -376,7 +377,8 @@ public class EuiccController extends IEuiccController.Stub {
                            false /* confirmationCodeRetried */,
                            EuiccOperation.forDownloadNoPrivileges(
                                    mCallingToken, mSubscription, mSwitchAfterDownload,
                                    mCallingPackage));
                                    mCallingPackage),
                            cardId);
                sendResult(mCallbackIntent, RESOLVABLE_ERROR, extrasIntent);
                return;
            }
@@ -431,7 +433,8 @@ public class EuiccController extends IEuiccController.Stub {
                            false /* confirmationCodeRetried */,
                            EuiccOperation.forDownloadNoPrivileges(
                                    mCallingToken, subscription, mSwitchAfterDownload,
                                    mCallingPackage));
                                    mCallingPackage),
                            cardId);
                    sendResult(mCallbackIntent, RESOLVABLE_ERROR, extrasIntent);
                    return;
                }
@@ -491,7 +494,8 @@ public class EuiccController extends IEuiccController.Stub {
                                        false /* confirmationCodeRetried */,
                                        EuiccOperation.forDownloadDeactivateSim(
                                                callingToken, subscription, switchAfterDownload,
                                                callingPackage));
                                                callingPackage),
                                        cardId);
                                break;
                            case EuiccService.RESULT_RESOLVABLE_ERRORS:
                                // Same value as the deprecated
@@ -511,7 +515,8 @@ public class EuiccController extends IEuiccController.Stub {
                                            retried,
                                            EuiccOperation.forDownloadResolvableErrors(
                                                callingToken, subscription, switchAfterDownload,
                                                callingPackage, result.getResolvableErrors()));
                                                callingPackage, result.getResolvableErrors()),
                                            cardId);
                                }  else { // Deprecated case
                                    addResolutionIntent(extrasIntent,
                                            EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE,
@@ -520,7 +525,8 @@ public class EuiccController extends IEuiccController.Stub {
                                            retried /* confirmationCodeRetried */,
                                            EuiccOperation.forDownloadConfirmationCode(
                                                callingToken, subscription, switchAfterDownload,
                                                callingPackage));
                                                callingPackage),
                                            cardId);
                                }
                                break;
                            default:
@@ -610,7 +616,8 @@ public class EuiccController extends IEuiccController.Stub {
        }

        @Override
        public void onGetDefaultListComplete(GetDefaultDownloadableSubscriptionListResult result) {
        public void onGetDefaultListComplete(int cardId,
                GetDefaultDownloadableSubscriptionListResult result) {
            Intent extrasIntent = new Intent();
            final int resultCode;
            switch (result.getResult()) {
@@ -631,7 +638,8 @@ public class EuiccController extends IEuiccController.Stub {
                            0 /* resolvableErrors */,
                            false /* confirmationCodeRetried */,
                            EuiccOperation.forGetDefaultListDeactivateSim(
                                    mCallingToken, mCallingPackage));
                                    mCallingToken, mCallingPackage),
                            cardId);
                    break;
                default:
                    resultCode = ERROR;
@@ -786,7 +794,8 @@ public class EuiccController extends IEuiccController.Stub {
                        0 /* resolvableErrors */,
                        false /* confirmationCodeRetried */,
                        EuiccOperation.forSwitchNoPrivileges(
                                token, subscriptionId, callingPackage));
                                token, subscriptionId, callingPackage),
                        cardId);
                sendResult(callbackIntent, RESOLVABLE_ERROR, extrasIntent);
                return;
            }
@@ -834,7 +843,8 @@ public class EuiccController extends IEuiccController.Stub {
                                        0 /* resolvableErrors */,
                                        false /* confirmationCodeRetried */,
                                        EuiccOperation.forSwitchDeactivateSim(
                                                callingToken, subscriptionId, callingPackage));
                                                callingToken, subscriptionId, callingPackage),
                                        cardId);
                                break;
                            default:
                                resultCode = ERROR;
@@ -1010,13 +1020,13 @@ public class EuiccController extends IEuiccController.Stub {
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    public void addResolutionIntent(Intent extrasIntent, String resolutionAction,
            String callingPackage, int resolvableErrors, boolean confirmationCodeRetried,
            EuiccOperation op) {
            EuiccOperation op, int cardId) {
        Intent intent = new Intent(EuiccManager.ACTION_RESOLVE_ERROR);
        intent.putExtra(EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_RESOLUTION_ACTION,
                resolutionAction);
        intent.putExtra(EuiccService.EXTRA_RESOLUTION_CALLING_PACKAGE, callingPackage);
        // TODO(jiuyu): Also pass cardId in the intent.
        intent.putExtra(EuiccService.EXTRA_RESOLVABLE_ERRORS, resolvableErrors);
        intent.putExtra(EuiccService.EXTRA_RESOLUTION_CARD_ID, cardId);
        intent.putExtra(EuiccService.EXTRA_RESOLUTION_CONFIRMATION_CODE_RETRIED,
                confirmationCodeRetried);
        intent.putExtra(EXTRA_OPERATION, op);
+3 −2
Original line number Diff line number Diff line
@@ -142,7 +142,8 @@ public class EuiccControllerTest extends TelephonyTest {
        @Override
        public void addResolutionIntent(
                Intent extrasIntent, String resolutionAction, String callingPackage,
                int resolvableErrors, boolean confirmationCodeRetried, EuiccOperation op) {
                int resolvableErrors, boolean confirmationCodeRetried, EuiccOperation op,
                int cardId) {
            mResolutionAction = resolutionAction;
            mOp = op;
        }
@@ -984,7 +985,7 @@ public class EuiccControllerTest extends TelephonyTest {
                EuiccConnector.GetDefaultListCommandCallback cb = invocation
                        .getArgument(2 /* resultCallBack */);
                if (complete) {
                    cb.onGetDefaultListComplete(result);
                    cb.onGetDefaultListComplete(CARD_ID, result);
                } else {
                    cb.onEuiccServiceUnavailable();
                }