diff --git a/Android.mk b/Android.mk index a4d1107286b3d..5529bfcfe787b 100644 --- a/Android.mk +++ b/Android.mk @@ -283,11 +283,17 @@ LOCAL_SRC_FILES += \ core/java/android/service/carrier/ICarrierService.aidl \ core/java/android/service/carrier/ICarrierMessagingCallback.aidl \ core/java/android/service/carrier/ICarrierMessagingService.aidl \ + core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl \ core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl \ + core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl \ core/java/android/service/euicc/IEuiccService.aidl \ + core/java/android/service/euicc/IGetDefaultDownloadableSubscriptionListCallback.aidl \ core/java/android/service/euicc/IGetDownloadableSubscriptionMetadataCallback.aidl \ core/java/android/service/euicc/IGetEidCallback.aidl \ + core/java/android/service/euicc/IGetEuiccInfoCallback.aidl \ core/java/android/service/euicc/IGetEuiccProfileInfoListCallback.aidl \ + core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl \ + core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl \ core/java/android/service/gatekeeper/IGateKeeperService.aidl \ core/java/android/service/notification/INotificationListener.aidl \ core/java/android/service/notification/IStatusBarNotificationHolder.aidl \ @@ -640,6 +646,7 @@ aidl_files := \ frameworks/base/telephony/java/android/telephony/ModemActivityInfo.aidl \ frameworks/base/telephony/java/android/telephony/UiccAccessRule.aidl \ frameworks/base/telephony/java/android/telephony/euicc/DownloadableSubscription.aidl \ + frameworks/base/telephony/java/android/telephony/euicc/EuiccInfo.aidl \ frameworks/base/location/java/android/location/Location.aidl \ frameworks/base/location/java/android/location/Address.aidl \ frameworks/base/location/java/android/location/Criteria.aidl \ @@ -753,9 +760,14 @@ aidl_files := \ frameworks/base/core/java/android/view/textservice/SuggestionsInfo.aidl \ frameworks/base/core/java/android/service/carrier/CarrierIdentifier.aidl \ frameworks/base/core/java/android/service/carrier/MessagePdu.aidl \ + frameworks/base/core/java/android/service/euicc/DeleteResult.aidl \ frameworks/base/core/java/android/service/euicc/DownloadResult.aidl \ + frameworks/base/core/java/android/service/euicc/EraseResult.aidl \ + frameworks/base/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.aidl \ frameworks/base/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.aidl \ frameworks/base/core/java/android/service/euicc/GetEuiccProfileInfoListResult.aidl \ + frameworks/base/core/java/android/service/euicc/SwitchResult.aidl \ + frameworks/base/core/java/android/service/euicc/UpdateNicknameResult.aidl \ frameworks/base/core/java/android/service/notification/Adjustment.aidl \ frameworks/base/core/java/android/service/notification/Condition.aidl \ frameworks/base/core/java/android/service/notification/SnoozeCriterion.aidl \ diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 39f48df6d946e..e32d884f471fe 100755 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7651,6 +7651,21 @@ public final class Settings { */ public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external"; + /** + * The default SM-DP+ configured for this device. + * + *

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. diff --git a/core/java/android/service/euicc/DeleteResult.aidl b/core/java/android/service/euicc/DeleteResult.aidl new file mode 100644 index 0000000000000..3da8b49fb9ffa --- /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 0000000000000..8be9ac9543dfd --- /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 CREATOR = new Creator() { + @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 4e2af53432326..ad75bff96f108 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.Retention; 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 0000000000000..e28a097ebb65f --- /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 0000000000000..1cce5a9213b5f --- /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 CREATOR = new Creator() { + @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 917cf7e588877..3734904196a36 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 @@ public abstract class EuiccService extends Service { /** * 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 @@ public abstract class EuiccService extends Service { * @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,21 +177,89 @@ public abstract class EuiccService extends Service { * @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 */ 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. + * + *

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. + * + *

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}. */ @@ -183,7 +268,7 @@ public abstract class EuiccService extends Service { 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 @@ public abstract class EuiccService extends Service { boolean forceDeactivateSim, IGetDownloadableSubscriptionMetadataCallback callback) { GetDownloadableSubscriptionMetadataResult result = - EuiccService.this.getDownloadableSubscriptionMetadata( + EuiccService.this.onGetDownloadableSubscriptionMetadata( slotId, subscription, forceDeactivateSim); try { callback.onComplete(result); @@ -217,6 +302,19 @@ public abstract class EuiccService extends Service { } } + @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 = @@ -227,5 +325,60 @@ public abstract class EuiccService extends Service { // 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 0000000000000..c2636a16edee6 --- /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 0000000000000..95569b27e7632 --- /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 CREATOR = + new Creator() { + @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). + * + *

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 ca3c1597fa58b..99e7614cbf08a 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.Retention; 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 @@ public final class GetDownloadableSubscriptionMetadataResult implements Parcelab 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 0000000000000..224cbd3bd6418 --- /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 0000000000000..aa70e767242e7 --- /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 502fc844977ed..18ea915d5dc7c 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 @@ oneway interface IEuiccService { 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 0000000000000..0c5a0c692cb55 --- /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 0000000000000..6d281487602af --- /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 0000000000000..970adcd8bef50 --- /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 0000000000000..439759d957476 --- /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 0000000000000..eb706a5c65d37 --- /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 0000000000000..f5dc4d3399c13 --- /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 CREATOR = new Creator() { + @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 0000000000000..08b849127857f --- /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 0000000000000..d871fc8829333 --- /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 CREATOR = + new Creator() { + @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; + } +} diff --git a/telephony/java/android/telephony/euicc/EuiccInfo.aidl b/telephony/java/android/telephony/euicc/EuiccInfo.aidl new file mode 100644 index 0000000000000..3cfba752328dc --- /dev/null +++ b/telephony/java/android/telephony/euicc/EuiccInfo.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.telephony.euicc; + +parcelable EuiccInfo; diff --git a/telephony/java/android/telephony/euicc/EuiccInfo.java b/telephony/java/android/telephony/euicc/EuiccInfo.java new file mode 100644 index 0000000000000..5bfff08f8d454 --- /dev/null +++ b/telephony/java/android/telephony/euicc/EuiccInfo.java @@ -0,0 +1,72 @@ +/* + * 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.telephony.euicc; + +import android.annotation.Nullable; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Information about an eUICC chip/device. + * + * @see EuiccManager#getEuiccInfo + * @hide + * + * TODO(b/35851809): Make this public. + */ +// WARNING: Do not add any privacy-sensitive fields to this class (such as an eUICC identifier)! +// This API is accessible to all applications. Privacy-sensitive fields should be returned in their +// own APIs guarded with appropriate permission checks. +public final class EuiccInfo implements Parcelable { + + public static final Creator CREATOR = + new Creator() { + @Override + public EuiccInfo createFromParcel(Parcel in) { + return new EuiccInfo(in); + } + + @Override + public EuiccInfo[] newArray(int size) { + return new EuiccInfo[size]; + } + }; + + /** + * Version of the operating system running on the eUICC. This field is hardware-specific and is + * not guaranteed to match any particular format. + */ + @Nullable + public final String osVersion; + + public EuiccInfo(@Nullable String osVersion) { + this.osVersion = osVersion; + } + + private EuiccInfo(Parcel in) { + osVersion = in.readString(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(osVersion); + } + + @Override + public int describeContents() { + return 0; + } +} diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index 8bc0be636ddbe..be32f72fe1452 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -17,7 +17,6 @@ package android.telephony.euicc; import android.annotation.Nullable; import android.annotation.SdkConstant; -import android.annotation.SystemApi; import android.app.Activity; import android.app.PendingIntent; import android.content.Context; @@ -123,6 +122,16 @@ public class EuiccManager { public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION"; + /** + * Key for an extra set on {@link #getDefaultDownloadableSubscriptionList} PendingIntent result + * callbacks providing the list of available downloadable subscriptions. + * @hide + * + * TODO(b/35851809): Make this a SystemApi. + */ + public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS = + "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS"; + /** * Key for an extra set on {@link PendingIntent} result callbacks providing the resolution * pending intent for {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR}s. @@ -195,10 +204,11 @@ public class EuiccManager { /** * Attempt to download the given {@link DownloadableSubscription}. * - *

Requires the calling app to be authorized to manage both the currently-active subscription - * and the subscription to be downloaded according to the subscription metadata. Without the - * former, a {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be returned in the - * callback intent to prompt the user to accept the download. + *

Requires the {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, + * or the calling app must be authorized to manage both the currently-active subscription and + * the subscription to be downloaded according to the subscription metadata. Without the former, + * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be returned in the callback + * intent to prompt the user to accept the download. * * @param subscription the subscription to download. * @param switchAfterDownload if true, the profile will be activated upon successful download. @@ -261,8 +271,9 @@ public class EuiccManager { * For example, this may indicate whether the user has consented or may include the input * they provided. * @hide + * + * TODO(b/35851809): Make this a SystemApi. */ - @SystemApi public void continueOperation(Intent resolutionIntent, Bundle resolutionExtras) { if (!isEnabled()) { PendingIntent callbackIntent = @@ -299,7 +310,6 @@ public class EuiccManager { * * TODO(b/35851809): Make this a SystemApi. */ - @SystemApi public void getDownloadableSubscriptionMetadata( DownloadableSubscription subscription, PendingIntent callbackIntent) { if (!isEnabled()) { @@ -313,6 +323,153 @@ public class EuiccManager { } } + /** + * Gets metadata for subscription which are available for download on this device. + * + *

Subscriptions returned here may be passed to {@link #downloadSubscription}. They may have + * been pre-assigned to this particular device, for example. The callback will be triggered with + * an Intent with {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS} set to the + * list of available subscriptions upon success. + * + *

Requires that the calling app has the + * {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. This is for + * internal system use only. + * + * @param callbackIntent a PendingIntent to launch when the operation completes. + * @hide + * + * TODO(b/35851809): Make this a SystemApi. + */ + public void getDefaultDownloadableSubscriptionList(PendingIntent callbackIntent) { + if (!isEnabled()) { + sendUnavailableError(callbackIntent); + return; + } + try { + mController.getDefaultDownloadableSubscriptionList(callbackIntent); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Returns information about the eUICC chip/device. + * + * @return the {@link EuiccInfo}. May be null if {@link #isEnabled()} is false or the eUICC is + * not ready. + */ + @Nullable + public EuiccInfo getEuiccInfo() { + if (!isEnabled()) { + return null; + } + try { + return mController.getEuiccInfo(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Deletes the given subscription. + * + *

If this subscription is currently active, the device will first switch away from it onto + * an "empty" subscription. + * + *

Requires that the calling app has carrier privileges according to the metadata of the + * profile to be deleted, or the + * {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. + * + * @param subscriptionId the ID of the subscription to delete. + * @param callbackIntent a PendingIntent to launch when the operation completes. + */ + public void deleteSubscription(int subscriptionId, PendingIntent callbackIntent) { + if (!isEnabled()) { + sendUnavailableError(callbackIntent); + return; + } + try { + mController.deleteSubscription( + subscriptionId, mContext.getOpPackageName(), callbackIntent); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Switch to (enable) the given subscription. + * + *

Requires the {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, + * or the calling app must be authorized to manage both the currently-active subscription and + * the subscription to be enabled according to the subscription metadata. Without the former, + * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be returned in the callback + * intent to prompt the user to accept the download. + * + * @param subscriptionId the ID of the subscription to enable. May be + * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} to deactivate the + * current profile without activating another profile to replace it. + * @param callbackIntent a PendingIntent to launch when the operation completes. + */ + public void switchToSubscription(int subscriptionId, PendingIntent callbackIntent) { + if (!isEnabled()) { + sendUnavailableError(callbackIntent); + return; + } + try { + mController.switchToSubscription( + subscriptionId, mContext.getOpPackageName(), callbackIntent); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Update the nickname for the given subscription. + * + *

Requires that the calling app has the + * {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. This is for + * internal system use only. + * + * @param subscriptionId the ID of the subscription to update. + * @param nickname the new nickname to apply. + * @param callbackIntent a PendingIntent to launch when the operation completes. + * @hide + */ + public void updateSubscriptionNickname( + int subscriptionId, String nickname, PendingIntent callbackIntent) { + if (!isEnabled()) { + sendUnavailableError(callbackIntent); + return; + } + try { + mController.updateSubscriptionNickname(subscriptionId, nickname, callbackIntent); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Erase all subscriptions and reset the eUICC. + * + *

Requires that the calling app has the + * {@link android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission. This is for + * internal system use only. + * + * @param callbackIntent a PendingIntent to launch when the operation completes. + * @hide + */ + public void eraseSubscriptions(PendingIntent callbackIntent) { + if (!isEnabled()) { + sendUnavailableError(callbackIntent); + return; + } + try { + mController.eraseSubscriptions(callbackIntent); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + private static void sendUnavailableError(PendingIntent callbackIntent) { try { callbackIntent.send(EMBEDDED_SUBSCRIPTION_RESULT_GENERIC_ERROR); diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl index 5f03dd97d785e..725b89bcf3513 100644 --- a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl +++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl @@ -20,13 +20,23 @@ import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.telephony.euicc.DownloadableSubscription; +import android.telephony.euicc.EuiccInfo; /** @hide */ interface IEuiccController { oneway void continueOperation(in Intent resolutionIntent, in Bundle resolutionExtras); oneway void getDownloadableSubscriptionMetadata(in DownloadableSubscription subscription, in PendingIntent callbackIntent); + oneway void getDefaultDownloadableSubscriptionList(in PendingIntent callbackIntent); String getEid(); oneway void downloadSubscription(in DownloadableSubscription subscription, boolean switchAfterDownload, String callingPackage, in PendingIntent callbackIntent); + EuiccInfo getEuiccInfo(); + oneway void deleteSubscription(int subscriptionId, String callingPackage, + in PendingIntent callbackIntent); + oneway void switchToSubscription(int subscriptionId, String callingPackage, + in PendingIntent callbackIntent); + oneway void updateSubscriptionNickname(int subscriptionId, String nickname, + in PendingIntent callbackIntent); + oneway void eraseSubscriptions(in PendingIntent callbackIntent); } \ No newline at end of file