Loading src/java/com/android/internal/telephony/euicc/EuiccController.java +9 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,15 @@ public class EuiccController extends IEuiccController.Stub { callingToken, subscription, switchAfterDownload, callingPackage)); break; case EuiccService.RESULT_NEED_CONFIRMATION_CODE: resultCode = RESOLVABLE_ERROR; addResolutionIntent(extrasIntent, EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE, callingPackage, EuiccOperation.forDownloadConfirmationCode( callingToken, subscription, switchAfterDownload, callingPackage)); break; default: resultCode = ERROR; extrasIntent.putExtra( Loading src/java/com/android/internal/telephony/euicc/EuiccOperation.java +36 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Parcelable; import android.service.euicc.EuiccService; import android.telephony.euicc.DownloadableSubscription; import android.telephony.euicc.EuiccManager; import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -60,6 +61,7 @@ public class EuiccOperation implements Parcelable { ACTION_GET_METADATA_DEACTIVATE_SIM, ACTION_DOWNLOAD_DEACTIVATE_SIM, ACTION_DOWNLOAD_NO_PRIVILEGES, ACTION_DOWNLOAD_CONFIRMATION_CODE, }) @interface Action {} Loading @@ -75,6 +77,8 @@ public class EuiccOperation implements Parcelable { static final int ACTION_SWITCH_DEACTIVATE_SIM = 5; @VisibleForTesting static final int ACTION_SWITCH_NO_PRIVILEGES = 6; @VisibleForTesting static final int ACTION_DOWNLOAD_CONFIRMATION_CODE = 7; @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public final @Action int mAction; Loading Loading @@ -123,6 +127,17 @@ public class EuiccOperation implements Parcelable { subscription, 0 /* subscriptionId */, switchAfterDownload, callingPackage); } /** * {@link EuiccManager#downloadSubscription} failed with * {@link EuiccService#RESULT_NEED_CONFIRMATION_CODE} error. */ public static EuiccOperation forDownloadConfirmationCode(long callingToken, DownloadableSubscription subscription, boolean switchAfterDownload, String callingPackage) { return new EuiccOperation(ACTION_DOWNLOAD_CONFIRMATION_CODE, callingToken, subscription, 0 /* subscriptionId */, switchAfterDownload, callingPackage); } static EuiccOperation forGetDefaultListDeactivateSim(long callingToken, String callingPackage) { return new EuiccOperation(ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM, callingToken, null /* downloadableSubscription */, 0 /* subscriptionId */, Loading Loading @@ -205,6 +220,11 @@ public class EuiccOperation implements Parcelable { resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_CONFIRMATION_CODE: resolvedDownloadConfirmationCode( resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE), callbackIntent); break; case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM: resolvedGetDefaultListDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), Loading Loading @@ -284,6 +304,22 @@ public class EuiccOperation implements Parcelable { } } private void resolvedDownloadConfirmationCode(String confirmationCode, PendingIntent callbackIntent) { if (TextUtils.isEmpty(confirmationCode)) { fail(callbackIntent); } else { mDownloadableSubscription.setConfirmationCode(confirmationCode); EuiccController.get() .downloadSubscription( mDownloadableSubscription, mSwitchAfterDownload, mCallingPackage, true /* forceDeactivateSim */, callbackIntent); } } private void resolvedGetDefaultListDeactivateSim( boolean consent, PendingIntent callbackIntent) { if (consent) { Loading tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,17 @@ public class EuiccControllerTest extends TelephonyTest { EuiccOperation.ACTION_DOWNLOAD_DEACTIVATE_SIM); } @Test public void testDownloadSubscription_needConfirmationCode() throws Exception { setHasWriteEmbeddedPermission(true); callDownloadSubscription(SUBSCRIPTION, false /* switchAfterDownload */, true /* complete */, EuiccService.RESULT_NEED_CONFIRMATION_CODE, "whatever" /* callingPackage */); verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR, 0 /* detailedCode */); verifyResolutionIntent(EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE, EuiccOperation.ACTION_DOWNLOAD_CONFIRMATION_CODE); } @Test public void testDownloadSubscription_success() throws Exception { setHasWriteEmbeddedPermission(true); Loading Loading
src/java/com/android/internal/telephony/euicc/EuiccController.java +9 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,15 @@ public class EuiccController extends IEuiccController.Stub { callingToken, subscription, switchAfterDownload, callingPackage)); break; case EuiccService.RESULT_NEED_CONFIRMATION_CODE: resultCode = RESOLVABLE_ERROR; addResolutionIntent(extrasIntent, EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE, callingPackage, EuiccOperation.forDownloadConfirmationCode( callingToken, subscription, switchAfterDownload, callingPackage)); break; default: resultCode = ERROR; extrasIntent.putExtra( Loading
src/java/com/android/internal/telephony/euicc/EuiccOperation.java +36 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.Parcelable; import android.service.euicc.EuiccService; import android.telephony.euicc.DownloadableSubscription; import android.telephony.euicc.EuiccManager; import android.text.TextUtils; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -60,6 +61,7 @@ public class EuiccOperation implements Parcelable { ACTION_GET_METADATA_DEACTIVATE_SIM, ACTION_DOWNLOAD_DEACTIVATE_SIM, ACTION_DOWNLOAD_NO_PRIVILEGES, ACTION_DOWNLOAD_CONFIRMATION_CODE, }) @interface Action {} Loading @@ -75,6 +77,8 @@ public class EuiccOperation implements Parcelable { static final int ACTION_SWITCH_DEACTIVATE_SIM = 5; @VisibleForTesting static final int ACTION_SWITCH_NO_PRIVILEGES = 6; @VisibleForTesting static final int ACTION_DOWNLOAD_CONFIRMATION_CODE = 7; @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public final @Action int mAction; Loading Loading @@ -123,6 +127,17 @@ public class EuiccOperation implements Parcelable { subscription, 0 /* subscriptionId */, switchAfterDownload, callingPackage); } /** * {@link EuiccManager#downloadSubscription} failed with * {@link EuiccService#RESULT_NEED_CONFIRMATION_CODE} error. */ public static EuiccOperation forDownloadConfirmationCode(long callingToken, DownloadableSubscription subscription, boolean switchAfterDownload, String callingPackage) { return new EuiccOperation(ACTION_DOWNLOAD_CONFIRMATION_CODE, callingToken, subscription, 0 /* subscriptionId */, switchAfterDownload, callingPackage); } static EuiccOperation forGetDefaultListDeactivateSim(long callingToken, String callingPackage) { return new EuiccOperation(ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM, callingToken, null /* downloadableSubscription */, 0 /* subscriptionId */, Loading Loading @@ -205,6 +220,11 @@ public class EuiccOperation implements Parcelable { resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), callbackIntent); break; case ACTION_DOWNLOAD_CONFIRMATION_CODE: resolvedDownloadConfirmationCode( resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE), callbackIntent); break; case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM: resolvedGetDefaultListDeactivateSim( resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT), Loading Loading @@ -284,6 +304,22 @@ public class EuiccOperation implements Parcelable { } } private void resolvedDownloadConfirmationCode(String confirmationCode, PendingIntent callbackIntent) { if (TextUtils.isEmpty(confirmationCode)) { fail(callbackIntent); } else { mDownloadableSubscription.setConfirmationCode(confirmationCode); EuiccController.get() .downloadSubscription( mDownloadableSubscription, mSwitchAfterDownload, mCallingPackage, true /* forceDeactivateSim */, callbackIntent); } } private void resolvedGetDefaultListDeactivateSim( boolean consent, PendingIntent callbackIntent) { if (consent) { Loading
tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,17 @@ public class EuiccControllerTest extends TelephonyTest { EuiccOperation.ACTION_DOWNLOAD_DEACTIVATE_SIM); } @Test public void testDownloadSubscription_needConfirmationCode() throws Exception { setHasWriteEmbeddedPermission(true); callDownloadSubscription(SUBSCRIPTION, false /* switchAfterDownload */, true /* complete */, EuiccService.RESULT_NEED_CONFIRMATION_CODE, "whatever" /* callingPackage */); verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR, 0 /* detailedCode */); verifyResolutionIntent(EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE, EuiccOperation.ACTION_DOWNLOAD_CONFIRMATION_CODE); } @Test public void testDownloadSubscription_success() throws Exception { setHasWriteEmbeddedPermission(true); Loading