From 6a2877e5a9ee1563afdc3f1c0469e76bc3a79fad Mon Sep 17 00:00:00 2001 From: Holly Jiuyu Sun Date: Fri, 13 Oct 2017 19:06:34 -0700 Subject: [PATCH] Carrier confirmation code. If confirmation code is null and required during downloading a profile, returns a resovable error, and show ConfirmationCodeActivity. After we get the confirmation code from the user, continue the operation. Add the confirmationCode as a member in DownloadableSubscription. Test: unit test, e2e on phone Bug: 36730837 Change-Id: Ibe1e0fc5ddb736b411faf48ec9bea3c68972bb99 --- core/java/android/service/euicc/EuiccService.java | 9 +++++++++ .../telephony/euicc/DownloadableSubscription.java | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java index 0c2e4b7ada26..cd233b831522 100644 --- a/core/java/android/service/euicc/EuiccService.java +++ b/core/java/android/service/euicc/EuiccService.java @@ -97,6 +97,10 @@ public abstract class EuiccService extends Service { public static final String ACTION_RESOLVE_NO_PRIVILEGES = "android.service.euicc.action.RESOLVE_NO_PRIVILEGES"; + /** Ask the user to input carrier confirmation code. */ + public static final String ACTION_RESOLVE_CONFIRMATION_CODE = + "android.service.euicc.action.RESOLVE_CONFIRMATION_CODE"; + /** Intent extra set for resolution requests containing the package name of the calling app. */ public static final String EXTRA_RESOLUTION_CALLING_PACKAGE = "android.service.euicc.extra.RESOLUTION_CALLING_PACKAGE"; @@ -105,6 +109,8 @@ public abstract class EuiccService extends Service { public static final int RESULT_OK = 0; /** Result code indicating that an active SIM must be deactivated to perform the operation. */ public static final int RESULT_MUST_DEACTIVATE_SIM = -1; + /** Result code indicating that the user must input a carrier confirmation code. */ + public static final int RESULT_NEED_CONFIRMATION_CODE = -2; // New predefined codes should have negative values. /** Start of implementation-specific error results. */ @@ -119,10 +125,13 @@ public abstract class EuiccService extends Service { RESOLUTION_ACTIONS = new ArraySet<>(); RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_DEACTIVATE_SIM); RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_NO_PRIVILEGES); + RESOLUTION_ACTIONS.add(EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE); } /** Boolean extra for resolution actions indicating whether the user granted consent. */ public static final String RESOLUTION_EXTRA_CONSENT = "consent"; + /** String extra for resolution actions indicating the carrier confirmation code. */ + public static final String RESOLUTION_EXTRA_CONFIRMATION_CODE = "confirmation_code"; private final IEuiccService.Stub mStubWrapper; diff --git a/telephony/java/android/telephony/euicc/DownloadableSubscription.java b/telephony/java/android/telephony/euicc/DownloadableSubscription.java index b5484e344a1c..01041c8b1360 100644 --- a/telephony/java/android/telephony/euicc/DownloadableSubscription.java +++ b/telephony/java/android/telephony/euicc/DownloadableSubscription.java @@ -53,6 +53,8 @@ public final class DownloadableSubscription implements Parcelable { @Nullable public final String encodedActivationCode; + @Nullable private String confirmationCode; + // see getCarrierName and setCarrierName @Nullable private String carrierName; @@ -66,6 +68,7 @@ public final class DownloadableSubscription implements Parcelable { private DownloadableSubscription(Parcel in) { encodedActivationCode = in.readString(); + confirmationCode = in.readString(); carrierName = in.readString(); accessRules = in.createTypedArray(UiccAccessRule.CREATOR); } @@ -83,6 +86,21 @@ public final class DownloadableSubscription implements Parcelable { } /** + * Sets the confirmation code. + */ + public void setConfirmationCode(String confirmationCode) { + this.confirmationCode = confirmationCode; + } + + /** + * Returns the confirmation code. + */ + @Nullable + public String getConfirmationCode() { + return confirmationCode; + } + + /** * Set the user-visible carrier name. * @hide * @@ -134,6 +152,7 @@ public final class DownloadableSubscription implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(encodedActivationCode); + dest.writeString(confirmationCode); dest.writeString(carrierName); dest.writeTypedArray(accessRules, flags); } -- 2.11.0