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

Commit 738abf60 authored by Jiashen Wang's avatar Jiashen Wang
Browse files

Init DownloadableSubscription with Confirmation Code

Currently carrier apps are not able to pass the confirmation code along
with the downloadable subscription because carrier apps do not have the
permission to set the CC. So carrier apps have to rely on LUI's scree
for entering the confirmation code. In order to make the process more
flexable for carriers, we decided to add a method to initialize a
Downloadable Subscription with the confirmation code.

Test: ag/13028582
Bug: 169276772
Change-Id: Icfa8b0f5b1699d24d8e39c3297ed25c7d1607739
Merged-In: Icfa8b0f5b1699d24d8e39c3297ed25c7d1607739
parent 62bdf8c0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -41712,6 +41712,14 @@ package android.telephony.euicc {
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.DownloadableSubscription> CREATOR;
  }
  public static final class DownloadableSubscription.Builder {
    ctor public DownloadableSubscription.Builder(@NonNull android.telephony.euicc.DownloadableSubscription);
    ctor public DownloadableSubscription.Builder(@NonNull String);
    method @NonNull public android.telephony.euicc.DownloadableSubscription build();
    method @NonNull public android.telephony.euicc.DownloadableSubscription.Builder setConfirmationCode(@NonNull String);
    method @NonNull public android.telephony.euicc.DownloadableSubscription.Builder setEncodedActivationCode(@NonNull String);
  }
  public final class EuiccInfo implements android.os.Parcelable {
    ctor public EuiccInfo(@Nullable String);
    method public int describeContents();
+2 −6
Original line number Diff line number Diff line
@@ -10878,12 +10878,8 @@ package android.telephony.euicc {
  public static final class DownloadableSubscription.Builder {
    ctor public DownloadableSubscription.Builder();
    ctor public DownloadableSubscription.Builder(android.telephony.euicc.DownloadableSubscription);
    method public android.telephony.euicc.DownloadableSubscription build();
    method public android.telephony.euicc.DownloadableSubscription.Builder setAccessRules(java.util.List<android.telephony.UiccAccessRule>);
    method public android.telephony.euicc.DownloadableSubscription.Builder setCarrierName(String);
    method public android.telephony.euicc.DownloadableSubscription.Builder setConfirmationCode(String);
    method public android.telephony.euicc.DownloadableSubscription.Builder setEncodedActivationCode(String);
    method @NonNull public android.telephony.euicc.DownloadableSubscription.Builder setAccessRules(@NonNull java.util.List<android.telephony.UiccAccessRule>);
    method @NonNull public android.telephony.euicc.DownloadableSubscription.Builder setCarrierName(@NonNull String);
  }
  public class EuiccCardManager {
+50 −7
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package android.telephony.euicc;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.PendingIntent;
@@ -102,44 +103,86 @@ public final class DownloadableSubscription implements Parcelable {
        this.accessRules = accessRules;
    }

    /** @hide */
    @SystemApi
    public static final class Builder {
        @Nullable private String encodedActivationCode;
        @Nullable private String confirmationCode;
        @Nullable private String carrierName;
        List<UiccAccessRule> accessRules;

        /** @hide */
        @SystemApi
        public Builder() {}

        public Builder(DownloadableSubscription baseSubscription) {
        public Builder(@NonNull DownloadableSubscription baseSubscription) {
            encodedActivationCode = baseSubscription.getEncodedActivationCode();
            confirmationCode = baseSubscription.getConfirmationCode();
            carrierName = baseSubscription.getCarrierName();
            accessRules = baseSubscription.getAccessRules();
        }

        public Builder(@NonNull String encodedActivationCode) {
            Preconditions.checkNotNull(encodedActivationCode, "Activation code may not be null");
            this.encodedActivationCode = encodedActivationCode;
        }

        /**
         * Builds a {@link DownloadableSubscription} object. If the encoded activation code is
         * {@code null}, a {@link NullPointerException} will be thrown.
         * @return a non-null {@link DownloadableSubscription} object.
         */
        @NonNull
        public DownloadableSubscription build() {
            Preconditions.checkNotNull(encodedActivationCode, "Activation code may not be null");
            return new DownloadableSubscription(encodedActivationCode, confirmationCode,
                    carrierName, accessRules);
        }

        public Builder setEncodedActivationCode(String value) {
        /**
         * Sets the encoded activation code. If the encoded activation code is {@code null}, a
         * {@link NullPointerException} will be thrown.
         * @param value the activation code to use. An activation code can be parsed from a user
         *              scanned QR code. The format of activation code is defined in SGP.22. For
         *              example, "1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$1.3.6.1.4.1.31746". For
         *              detail, see {@code com.android.euicc.data.ActivationCode}. Must not be null.
         */
        @NonNull
        public Builder setEncodedActivationCode(@NonNull String value) {
            Preconditions.checkNotNull(encodedActivationCode, "Activation code may not be null");
            encodedActivationCode = value;
            return this;
        }

        public Builder setConfirmationCode(String value) {
        /**
         * Sets the confirmation code.
         * @param value the confirmation code to use to authenticate the carrier server got
         *              subscription download.
         */
        @NonNull
        public Builder setConfirmationCode(@NonNull String value) {
            confirmationCode = value;
            return this;
        }

        public Builder setCarrierName(String value) {
        /**
         * Sets the user-visible carrier name.
         * @param value carrier name.
         * @hide
         */
        @NonNull
        @SystemApi
        public Builder setCarrierName(@NonNull String value) {
            carrierName = value;
            return this;
        }

        public Builder setAccessRules(List<UiccAccessRule> value) {
        /**
         * Sets the {@link UiccAccessRule}s dictating access to this subscription.
         * @param value A list of {@link UiccAccessRule}s.
         * @hide
         */
        @NonNull
        @SystemApi
        public Builder setAccessRules(@NonNull List<UiccAccessRule> value) {
            accessRules = value;
            return this;
        }