Implement remaining core eUICC APIs.
Includes:
-getDefaultDownloadableSubscriptionList, which returns a list of
default subscriptions available for the device.
-getEuiccInfo, which returns an EuiccInfo object containing
non-sensitive information about the eUICC device.
-deleteSubscription, to delete a subscription.
-switchToSubscription, to switch to (or away from) a subscription.
-updateSubscriptionNickname, to update the nickname of a subscription
which is saved to the eUICC.
-eraseSubscriptions, to factory reset the eUICC.
-Settings.Global#DEFAULT_SM_DP_PLUS, a default SM-DP+ server which is
used to query for default subscriptions in
getDefaultDownloadableSubscriptionList.
These APIs follow the template of the APIs which have already been
implemented.
This completes the baseline implementation as designed; any additional
APIs or tweaks to the APIs will be tracked as separate bugs.
Fixes: 33075886
Test: Build/boot
Change-Id: I8057757c874f94e0c816af1ca071d656c8f145b9
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 39f48df..e32d884 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -7652,6 +7652,21 @@
public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
/**
+ * The default SM-DP+ configured for this device.
+ *
+ * <p>An SM-DP+ is used by an LPA (see {@link android.service.euicc.EuiccService}) to
+ * download profiles. If this value is set, the LPA will query this server for any profiles
+ * available to this device. If any are available, they may be downloaded during device
+ * provisioning or in settings without needing the user to enter an activation code.
+ *
+ * @see android.service.euicc.EuiccService
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+ public static final String DEFAULT_SM_DP_PLUS = "default_sm_dp_plus";
+
+ /**
* Whether any activity can be resized. When this is true, any
* activity, regardless of manifest values, can be resized for multi-window.
* (0 = false, 1 = true)
diff --git a/core/java/android/service/euicc/DeleteResult.aidl b/core/java/android/service/euicc/DeleteResult.aidl
new file mode 100644
index 0000000..3da8b49
--- /dev/null
+++ b/core/java/android/service/euicc/DeleteResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+parcelable DeleteResult;
diff --git a/core/java/android/service/euicc/DeleteResult.java b/core/java/android/service/euicc/DeleteResult.java
new file mode 100644
index 0000000..8be9ac9
--- /dev/null
+++ b/core/java/android/service/euicc/DeleteResult.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.service.euicc;
+
+import android.annotation.IntDef;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Result of a {@link EuiccService#onDeleteSubscription} operation.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+public final class DeleteResult implements Parcelable {
+
+ public static final Creator<DeleteResult> CREATOR = new Creator<DeleteResult>() {
+ @Override
+ public DeleteResult createFromParcel(Parcel in) {
+ return new DeleteResult(in);
+ }
+
+ @Override
+ public DeleteResult[] newArray(int size) {
+ return new DeleteResult[size];
+ }
+ };
+
+ /** @hide */
+ @IntDef({
+ RESULT_OK,
+ RESULT_GENERIC_ERROR,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ResultCode {}
+
+ public static final int RESULT_OK = 0;
+ public static final int RESULT_GENERIC_ERROR = 1;
+
+ /** Result of the operation - one of the RESULT_* constants. */
+ public final @ResultCode int result;
+
+ /** Implementation-defined detailed error code in case of a failure not covered here. */
+ public final int detailedCode;
+
+ private DeleteResult(int result, int detailedCode) {
+ this.result = result;
+ this.detailedCode = detailedCode;
+ }
+
+ private DeleteResult(Parcel in) {
+ this.result = in.readInt();
+ this.detailedCode = in.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(result);
+ dest.writeInt(detailedCode);
+ }
+
+ /** Return a result indicating that the delete was successful. */
+ public static DeleteResult success() {
+ return new DeleteResult(RESULT_OK, 0);
+ }
+
+ /**
+ * Return a result indicating that an error occurred for which no other more specific error
+ * code has been defined.
+ *
+ * @param detailedCode an implemenation-defined detailed error code for debugging purposes.
+ */
+ public static DeleteResult genericError(int detailedCode) {
+ return new DeleteResult(RESULT_GENERIC_ERROR, detailedCode);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/core/java/android/service/euicc/DownloadResult.java b/core/java/android/service/euicc/DownloadResult.java
index 4e2af53..ad75bff 100644
--- a/core/java/android/service/euicc/DownloadResult.java
+++ b/core/java/android/service/euicc/DownloadResult.java
@@ -23,7 +23,7 @@
import java.lang.annotation.RetentionPolicy;
/**
- * Result of a {@link EuiccService#downloadSubscription} operation.
+ * Result of a {@link EuiccService#onDownloadSubscription} operation.
* @hide
*
* TODO(b/35851809): Make this a SystemApi.
diff --git a/core/java/android/service/euicc/EraseResult.aidl b/core/java/android/service/euicc/EraseResult.aidl
new file mode 100644
index 0000000..e28a097
--- /dev/null
+++ b/core/java/android/service/euicc/EraseResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+parcelable EraseResult;
diff --git a/core/java/android/service/euicc/EraseResult.java b/core/java/android/service/euicc/EraseResult.java
new file mode 100644
index 0000000..1cce5a9
--- /dev/null
+++ b/core/java/android/service/euicc/EraseResult.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.service.euicc;
+
+import android.annotation.IntDef;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Result of a {@link EuiccService#onEraseSubscriptions} operation.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+public final class EraseResult implements Parcelable {
+
+ public static final Creator<EraseResult> CREATOR = new Creator<EraseResult>() {
+ @Override
+ public EraseResult createFromParcel(Parcel in) {
+ return new EraseResult(in);
+ }
+
+ @Override
+ public EraseResult[] newArray(int size) {
+ return new EraseResult[size];
+ }
+ };
+
+ /** @hide */
+ @IntDef({
+ RESULT_OK,
+ RESULT_GENERIC_ERROR,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ResultCode {}
+
+ public static final int RESULT_OK = 0;
+ public static final int RESULT_GENERIC_ERROR = 1;
+
+ /** Result of the operation - one of the RESULT_* constants. */
+ public final @ResultCode int result;
+
+ /** Implementation-defined detailed error code in case of a failure not covered here. */
+ public final int detailedCode;
+
+ private EraseResult(int result, int detailedCode) {
+ this.result = result;
+ this.detailedCode = detailedCode;
+ }
+
+ private EraseResult(Parcel in) {
+ this.result = in.readInt();
+ this.detailedCode = in.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(result);
+ dest.writeInt(detailedCode);
+ }
+
+ /** Return a result indicating that the erase was successful. */
+ public static EraseResult success() {
+ return new EraseResult(RESULT_OK, 0);
+ }
+
+ /**
+ * Return a result indicating that an error occurred for which no other more specific error
+ * code has been defined.
+ *
+ * @param detailedCode an implemenation-defined detailed error code for debugging purposes.
+ */
+ public static EraseResult genericError(int detailedCode) {
+ return new EraseResult(RESULT_GENERIC_ERROR, detailedCode);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index 917cf7e..3734904 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -16,11 +16,13 @@
package android.service.euicc;
import android.annotation.CallSuper;
+import android.annotation.Nullable;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.telephony.euicc.DownloadableSubscription;
+import android.telephony.euicc.EuiccInfo;
import android.util.ArraySet;
/**
@@ -132,8 +134,8 @@
/**
* Populate {@link DownloadableSubscription} metadata for the given downloadable subscription.
*
- * @param slotId ID of the SIM slot to use when starting the download. This is currently not
- * populated but is here to future-proof the APIs.
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
* @param subscription A subscription whose metadata needs to be populated.
* @param forceDeactivateSim If true, and if an active SIM must be deactivated to access the
* eUICC, perform this action automatically. Otherwise,
@@ -142,14 +144,29 @@
* @return The result of the operation.
* @see android.telephony.euicc.EuiccManager#getDownloadableSubscriptionMetadata
*/
- public abstract GetDownloadableSubscriptionMetadataResult getDownloadableSubscriptionMetadata(
+ public abstract GetDownloadableSubscriptionMetadataResult onGetDownloadableSubscriptionMetadata(
int slotId, DownloadableSubscription subscription, boolean forceDeactivateSim);
/**
+ * Return metadata for subscriptions which are available for download for this device.
+ *
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
+ * @param forceDeactivateSim If true, and if an active SIM must be deactivated to access the
+ * eUICC, perform this action automatically. Otherwise,
+ * {@link GetDefaultDownloadableSubscriptionListResult#mustDeactivateSim()} should be
+ * returned to allow the user to consent to this operation first.
+ * @return The result of the list operation.
+ * @see android.telephony.euicc.EuiccManager#getDefaultDownloadableSubscriptionList
+ */
+ public abstract GetDefaultDownloadableSubscriptionListResult
+ onGetDefaultDownloadableSubscriptionList(int slotId, boolean forceDeactivateSim);
+
+ /**
* Download the given subscription.
*
- * @param slotId ID of the SIM slot onto which the subscription should be downloaded. This is
- * currently not populated but is here to future-proof the APIs.
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
* @param subscription The subscription to download.
* @param switchAfterDownload If true, the subscription should be enabled upon successful
* download.
@@ -160,15 +177,15 @@
* @return the result of the download operation.
* @see android.telephony.euicc.EuiccManager#downloadSubscription
*/
- public abstract DownloadResult downloadSubscription(int slotId,
+ public abstract DownloadResult onDownloadSubscription(int slotId,
DownloadableSubscription subscription, boolean switchAfterDownload,
boolean forceDeactivateSim);
/**
* Return a list of all @link EuiccProfileInfo}s.
*
- * @param slotId ID of the SIM slot to use when starting the download. This is currently not
- * populated but is here to future-proof the APIs.
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
* @return The result of the operation.
* @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList
* @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList
@@ -176,6 +193,74 @@
public abstract GetEuiccProfileInfoListResult onGetEuiccProfileInfoList(int slotId);
/**
+ * Return info about the eUICC chip/device.
+ *
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
+ * @return the {@link EuiccInfo} for the eUICC chip/device.
+ * @see android.telephony.euicc.EuiccManager#getEuiccInfo
+ */
+ public abstract EuiccInfo onGetEuiccInfo(int slotId);
+
+ /**
+ * Delete the given subscription.
+ *
+ * <p>If the subscription is currently active, it should be deactivated first (equivalent to a
+ * physical SIM being ejected).
+ *
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
+ * @param iccid the ICCID of the subscription to delete.
+ * @return the result of the delete operation.
+ * @see android.telephony.euicc.EuiccManager#deleteSubscription
+ */
+ public abstract DeleteResult onDeleteSubscription(int slotId, String iccid);
+
+ /**
+ * Switch to the given subscription.
+ *
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
+ * @param iccid the ICCID of the subscription to enable. May be null, in which case the current
+ * profile should be deactivated and no profile should be activated to replace it - this is
+ * equivalent to a physical SIM being ejected.
+ * @param forceDeactivateSim If true, and if an active SIM must be deactivated to access the
+ * eUICC, perform this action automatically. Otherwise,
+ * {@link SwitchResult#mustDeactivateSim()} should be returned to allow the user to consent
+ * to this operation first.
+ * @return the result of the switch operation.
+ * @see android.telephony.euicc.EuiccManager#switchToSubscription
+ */
+ public abstract SwitchResult onSwitchToSubscription(int slotId, @Nullable String iccid,
+ boolean forceDeactivateSim);
+
+ /**
+ * Update the nickname of the given subscription.
+ *
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
+ * @param iccid the ICCID of the subscription to update.
+ * @param nickname the new nickname to apply.
+ * @return the result of the update operation.
+ * @see android.telephony.euicc.EuiccManager#updateSubscriptionNickname
+ */
+ public abstract UpdateNicknameResult onUpdateSubscriptionNickname(int slotId, String iccid,
+ String nickname);
+
+ /**
+ * Erase all of the subscriptions on the device.
+ *
+ * <p>This is intended to be used for device resets. As such, the reset should be performed even
+ * if an active SIM must be deactivated in order to access the eUICC.
+ *
+ * @param slotId ID of the SIM slot to use for the operation. This is currently not populated
+ * but is here to future-proof the APIs.
+ * @return the result of the erase operation.
+ * @see android.telephony.euicc.EuiccManager#eraseSubscriptions
+ */
+ public abstract EraseResult onEraseSubscriptions(int slotId);
+
+ /**
* Wrapper around IEuiccService that forwards calls to implementations of {@link EuiccService}.
*/
private class IEuiccServiceWrapper extends IEuiccService.Stub {
@@ -183,7 +268,7 @@
public void downloadSubscription(int slotId, DownloadableSubscription subscription,
boolean switchAfterDownload, boolean forceDeactivateSim,
IDownloadSubscriptionCallback callback) {
- DownloadResult result = EuiccService.this.downloadSubscription(
+ DownloadResult result = EuiccService.this.onDownloadSubscription(
slotId, subscription, switchAfterDownload, forceDeactivateSim);
try {
callback.onComplete(result);
@@ -208,7 +293,7 @@
boolean forceDeactivateSim,
IGetDownloadableSubscriptionMetadataCallback callback) {
GetDownloadableSubscriptionMetadataResult result =
- EuiccService.this.getDownloadableSubscriptionMetadata(
+ EuiccService.this.onGetDownloadableSubscriptionMetadata(
slotId, subscription, forceDeactivateSim);
try {
callback.onComplete(result);
@@ -218,6 +303,19 @@
}
@Override
+ public void getDefaultDownloadableSubscriptionList(int slotId, boolean forceDeactivateSim,
+ IGetDefaultDownloadableSubscriptionListCallback callback) {
+ GetDefaultDownloadableSubscriptionListResult result =
+ EuiccService.this.onGetDefaultDownloadableSubscriptionList(
+ slotId, forceDeactivateSim);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+
+ @Override
public void getEuiccProfileInfoList(int slotId, IGetEuiccProfileInfoListCallback callback) {
GetEuiccProfileInfoListResult result =
EuiccService.this.onGetEuiccProfileInfoList(slotId);
@@ -227,5 +325,60 @@
// Can't communicate with the phone process; ignore.
}
}
+
+ @Override
+ public void getEuiccInfo(int slotId, IGetEuiccInfoCallback callback) {
+ EuiccInfo euiccInfo = EuiccService.this.onGetEuiccInfo(slotId);
+ try {
+ callback.onSuccess(euiccInfo);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+
+ @Override
+ public void deleteSubscription(int slotId, String iccid,
+ IDeleteSubscriptionCallback callback) {
+ DeleteResult result = EuiccService.this.onDeleteSubscription(slotId, iccid);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+
+ @Override
+ public void switchToSubscription(int slotId, String iccid, boolean forceDeactivateSim,
+ ISwitchToSubscriptionCallback callback) {
+ SwitchResult result =
+ EuiccService.this.onSwitchToSubscription(slotId, iccid, forceDeactivateSim);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+
+ @Override
+ public void updateSubscriptionNickname(int slotId, String iccid, String nickname,
+ IUpdateSubscriptionNicknameCallback callback) {
+ UpdateNicknameResult result =
+ EuiccService.this.onUpdateSubscriptionNickname(slotId, iccid, nickname);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+
+ @Override
+ public void eraseSubscriptions(int slotId, IEraseSubscriptionsCallback callback) {
+ EraseResult result = EuiccService.this.onEraseSubscriptions(slotId);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
}
}
diff --git a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.aidl b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.aidl
new file mode 100644
index 0000000..c2636a1
--- /dev/null
+++ b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+parcelable GetDefaultDownloadableSubscriptionListResult;
diff --git a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java
new file mode 100644
index 0000000..95569b2
--- /dev/null
+++ b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.service.euicc;
+
+import android.annotation.IntDef;
+import android.annotation.Nullable;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.telephony.euicc.DownloadableSubscription;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Result of a {@link EuiccService#onGetDefaultDownloadableSubscriptionList} operation.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+public final class GetDefaultDownloadableSubscriptionListResult implements Parcelable {
+
+ public static final Creator<GetDefaultDownloadableSubscriptionListResult> CREATOR =
+ new Creator<GetDefaultDownloadableSubscriptionListResult>() {
+ @Override
+ public GetDefaultDownloadableSubscriptionListResult createFromParcel(Parcel in) {
+ return new GetDefaultDownloadableSubscriptionListResult(in);
+ }
+
+ @Override
+ public GetDefaultDownloadableSubscriptionListResult[] newArray(int size) {
+ return new GetDefaultDownloadableSubscriptionListResult[size];
+ }
+ };
+
+ /** @hide */
+ @IntDef({
+ RESULT_OK,
+ RESULT_GENERIC_ERROR,
+ RESULT_MUST_DEACTIVATE_SIM,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ResultCode {}
+
+ public static final int RESULT_OK = 0;
+ public static final int RESULT_MUST_DEACTIVATE_SIM = 1;
+ public static final int RESULT_GENERIC_ERROR = 2;
+
+ /** Result of the operation - one of the RESULT_* constants. */
+ public final @ResultCode int result;
+
+ /**
+ * The available {@link DownloadableSubscription}s (with filled-in metadata).
+ *
+ * <p>Only non-null if {@link #result} is {@link #RESULT_OK}.
+ */
+ @Nullable
+ public final DownloadableSubscription[] subscriptions;
+
+ /** Implementation-defined detailed error code in case of a failure not covered here. */
+ public final int detailedCode;
+
+ private GetDefaultDownloadableSubscriptionListResult(int result,
+ @Nullable DownloadableSubscription[] subscriptions, int detailedCode) {
+ this.result = result;
+ this.subscriptions = subscriptions;
+ this.detailedCode = detailedCode;
+ }
+
+ private GetDefaultDownloadableSubscriptionListResult(Parcel in) {
+ this.result = in.readInt();
+ this.subscriptions = in.createTypedArray(DownloadableSubscription.CREATOR);
+ this.detailedCode = in.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(result);
+ dest.writeTypedArray(subscriptions, flags);
+ dest.writeInt(detailedCode);
+ }
+
+ /** Return a result indicating that the list operation was successful. */
+ public static GetDefaultDownloadableSubscriptionListResult success(
+ DownloadableSubscription[] subscriptions) {
+ return new GetDefaultDownloadableSubscriptionListResult(RESULT_OK, subscriptions,
+ 0 /* detailedCode */);
+ }
+
+ /**
+ * Return a result indicating that an active SIM must be deactivated to perform the operation.
+ */
+ public static GetDefaultDownloadableSubscriptionListResult mustDeactivateSim() {
+ return new GetDefaultDownloadableSubscriptionListResult(RESULT_MUST_DEACTIVATE_SIM,
+ null /* subscription */, 0 /* detailedCode */);
+ }
+
+ /**
+ * Return a result indicating that an error occurred for which no other more specific error
+ * code has been defined.
+ *
+ * @param detailedCode an implementation-defined detailed error code for debugging purposes.
+ */
+ public static GetDefaultDownloadableSubscriptionListResult genericError(int detailedCode) {
+ return new GetDefaultDownloadableSubscriptionListResult(RESULT_GENERIC_ERROR,
+ null /* subscription */, detailedCode);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java
index ca3c159..99e7614 100644
--- a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java
+++ b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java
@@ -25,7 +25,7 @@
import java.lang.annotation.RetentionPolicy;
/**
- * Result of a {@link EuiccService#getDownloadableSubscriptionMetadata} operation.
+ * Result of a {@link EuiccService#onGetDownloadableSubscriptionMetadata} operation.
* @hide
*
* TODO(b/35851809): Make this a SystemApi.
@@ -92,7 +92,7 @@
dest.writeInt(detailedCode);
}
- /** Return a result indicating that the download was successful. */
+ /** Return a result indicating that the lookup was successful. */
public static GetDownloadableSubscriptionMetadataResult success(
DownloadableSubscription subscription) {
return new GetDownloadableSubscriptionMetadataResult(RESULT_OK, subscription,
diff --git a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl
new file mode 100644
index 0000000..224cbd3
--- /dev/null
+++ b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+import android.service.euicc.DeleteResult;
+
+/** @hide */
+oneway interface IDeleteSubscriptionCallback {
+ void onComplete(in DeleteResult result);
+}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl
new file mode 100644
index 0000000..aa70e76
--- /dev/null
+++ b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+import android.service.euicc.EraseResult;
+
+/** @hide */
+oneway interface IEraseSubscriptionsCallback {
+ void onComplete(in EraseResult result);
+}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IEuiccService.aidl b/core/java/android/service/euicc/IEuiccService.aidl
index 502fc84..18ea915 100644
--- a/core/java/android/service/euicc/IEuiccService.aidl
+++ b/core/java/android/service/euicc/IEuiccService.aidl
@@ -16,10 +16,16 @@
package android.service.euicc;
+import android.service.euicc.IDeleteSubscriptionCallback;
import android.service.euicc.IDownloadSubscriptionCallback;
+import android.service.euicc.IEraseSubscriptionsCallback;
+import android.service.euicc.IGetDefaultDownloadableSubscriptionListCallback;
import android.service.euicc.IGetDownloadableSubscriptionMetadataCallback;
import android.service.euicc.IGetEidCallback;
+import android.service.euicc.IGetEuiccInfoCallback;
import android.service.euicc.IGetEuiccProfileInfoListCallback;
+import android.service.euicc.ISwitchToSubscriptionCallback;
+import android.service.euicc.IUpdateSubscriptionNicknameCallback;
import android.telephony.euicc.DownloadableSubscription;
/** @hide */
@@ -31,4 +37,13 @@
boolean forceDeactivateSim, in IGetDownloadableSubscriptionMetadataCallback callback);
void getEid(int slotId, in IGetEidCallback callback);
void getEuiccProfileInfoList(int slotId, in IGetEuiccProfileInfoListCallback callback);
+ void getDefaultDownloadableSubscriptionList(int slotId, boolean forceDeactivateSim,
+ in IGetDefaultDownloadableSubscriptionListCallback callback);
+ void getEuiccInfo(int slotId, in IGetEuiccInfoCallback callback);
+ void deleteSubscription(int slotId, String iccid, in IDeleteSubscriptionCallback callback);
+ void switchToSubscription(int slotId, String iccid, boolean forceDeactivateSim,
+ in ISwitchToSubscriptionCallback callback);
+ void updateSubscriptionNickname(int slotId, String iccid, String nickname,
+ in IUpdateSubscriptionNicknameCallback callback);
+ void eraseSubscriptions(int slotId, in IEraseSubscriptionsCallback callback);
}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl b/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl
new file mode 100644
index 0000000..0c5a0c6
--- /dev/null
+++ b/core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+import android.service.euicc.GetDefaultDownloadableSubscriptionListResult;
+
+/** @hide */
+oneway interface IGetDefaultDownloadableSubscriptionListCallback {
+ void onComplete(in GetDefaultDownloadableSubscriptionListResult result);
+}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl b/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl
new file mode 100644
index 0000000..6d28148
--- /dev/null
+++ b/core/java/android/service/euicc/IGetEuiccInfoCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+import android.telephony.euicc.EuiccInfo;
+
+/** @hide */
+oneway interface IGetEuiccInfoCallback {
+ void onSuccess(in EuiccInfo euiccInfo);
+}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl
new file mode 100644
index 0000000..970adcd
--- /dev/null
+++ b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+import android.service.euicc.SwitchResult;
+
+/** @hide */
+oneway interface ISwitchToSubscriptionCallback {
+ void onComplete(in SwitchResult result);
+}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl
new file mode 100644
index 0000000..439759d
--- /dev/null
+++ b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+import android.service.euicc.UpdateNicknameResult;
+
+/** @hide */
+oneway interface IUpdateSubscriptionNicknameCallback {
+ void onComplete(in UpdateNicknameResult result);
+}
\ No newline at end of file
diff --git a/core/java/android/service/euicc/SwitchResult.aidl b/core/java/android/service/euicc/SwitchResult.aidl
new file mode 100644
index 0000000..eb706a5
--- /dev/null
+++ b/core/java/android/service/euicc/SwitchResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+parcelable SwitchResult;
diff --git a/core/java/android/service/euicc/SwitchResult.java b/core/java/android/service/euicc/SwitchResult.java
new file mode 100644
index 0000000..f5dc4d3
--- /dev/null
+++ b/core/java/android/service/euicc/SwitchResult.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.service.euicc;
+
+import android.annotation.IntDef;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Result of a {@link EuiccService#onSwitchToSubscription} operation.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+public final class SwitchResult implements Parcelable {
+
+ public static final Creator<SwitchResult> CREATOR = new Creator<SwitchResult>() {
+ @Override
+ public SwitchResult createFromParcel(Parcel in) {
+ return new SwitchResult(in);
+ }
+
+ @Override
+ public SwitchResult[] newArray(int size) {
+ return new SwitchResult[size];
+ }
+ };
+
+ /** @hide */
+ @IntDef({
+ RESULT_OK,
+ RESULT_GENERIC_ERROR,
+ RESULT_MUST_DEACTIVATE_SIM,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ResultCode {}
+
+ public static final int RESULT_OK = 0;
+ public static final int RESULT_GENERIC_ERROR = 1;
+ public static final int RESULT_MUST_DEACTIVATE_SIM = 2;
+
+ /** Result of the operation - one of the RESULT_* constants. */
+ public final @ResultCode int result;
+
+ /** Implementation-defined detailed error code in case of a failure not covered here. */
+ public final int detailedCode;
+
+ private SwitchResult(int result, int detailedCode) {
+ this.result = result;
+ this.detailedCode = detailedCode;
+ }
+
+ private SwitchResult(Parcel in) {
+ this.result = in.readInt();
+ this.detailedCode = in.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(result);
+ dest.writeInt(detailedCode);
+ }
+
+ /** Return a result indicating that the switch was successful. */
+ public static SwitchResult success() {
+ return new SwitchResult(RESULT_OK, 0);
+ }
+
+ /**
+ * Return a result indicating that an active SIM must be deactivated to perform the operation.
+ */
+ public static SwitchResult mustDeactivateSim() {
+ return new SwitchResult(RESULT_MUST_DEACTIVATE_SIM, 0);
+ }
+
+ /**
+ * Return a result indicating that an error occurred for which no other more specific error
+ * code has been defined.
+ *
+ * @param detailedCode an implemenation-defined detailed error code for debugging purposes.
+ */
+ public static SwitchResult genericError(int detailedCode) {
+ return new SwitchResult(RESULT_GENERIC_ERROR, detailedCode);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/core/java/android/service/euicc/UpdateNicknameResult.aidl b/core/java/android/service/euicc/UpdateNicknameResult.aidl
new file mode 100644
index 0000000..08b8491
--- /dev/null
+++ b/core/java/android/service/euicc/UpdateNicknameResult.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.euicc;
+
+parcelable UpdateNicknameResult;
diff --git a/core/java/android/service/euicc/UpdateNicknameResult.java b/core/java/android/service/euicc/UpdateNicknameResult.java
new file mode 100644
index 0000000..d871fc8
--- /dev/null
+++ b/core/java/android/service/euicc/UpdateNicknameResult.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.service.euicc;
+
+import android.annotation.IntDef;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Result of a {@link EuiccService#onUpdateSubscriptionNickname} operation.
+ * @hide
+ *
+ * TODO(b/35851809): Make this a SystemApi.
+ */
+public final class UpdateNicknameResult implements Parcelable {
+
+ public static final Creator<UpdateNicknameResult> CREATOR =
+ new Creator<UpdateNicknameResult>() {
+ @Override
+ public UpdateNicknameResult createFromParcel(Parcel in) {
+ return new UpdateNicknameResult(in);
+ }
+
+ @Override
+ public UpdateNicknameResult[] newArray(int size) {
+ return new UpdateNicknameResult[size];
+ }
+ };
+
+ /** @hide */
+ @IntDef({
+ RESULT_OK,
+ RESULT_GENERIC_ERROR,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ResultCode {}
+
+ public static final int RESULT_OK = 0;
+ public static final int RESULT_GENERIC_ERROR = 1;
+
+ /** Result of the operation - one of the RESULT_* constants. */
+ public final @ResultCode int result;
+
+ /** Implementation-defined detailed error code in case of a failure not covered here. */
+ public final int detailedCode;
+
+ private UpdateNicknameResult(int result, int detailedCode) {
+ this.result = result;
+ this.detailedCode = detailedCode;
+ }
+
+ private UpdateNicknameResult(Parcel in) {
+ this.result = in.readInt();
+ this.detailedCode = in.readInt();
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(result);
+ dest.writeInt(detailedCode);
+ }
+
+ /** Return a result indicating that the update was successful. */
+ public static UpdateNicknameResult success() {
+ return new UpdateNicknameResult(RESULT_OK, 0);
+ }
+
+ /**
+ * Return a result indicating that an error occurred for which no other more specific error
+ * code has been defined.
+ *
+ * @param detailedCode an implemenation-defined detailed error code for debugging purposes.
+ */
+ public static UpdateNicknameResult genericError(int detailedCode) {
+ return new UpdateNicknameResult(RESULT_GENERIC_ERROR, detailedCode);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}