From 83f8bc81be65cb09720c6d8dac7717d4652cd931 Mon Sep 17 00:00:00 2001 From: Jeff Davidson Date: Mon, 15 May 2017 10:22:20 -0700 Subject: [PATCH] eUICC API error code cleanup. -Remove result classes in cases that a simple int will do. Split the int error code space (now shared across all calls) into two parts - predefined errors (0 or negative) and custom errors (positive). -Replace "generic error" with "error" in naming. -Remove detailed code from any result returned by the LPA. There is still a detailed code in the platform API, which is equal to the result code returned by the LPA. Fixes: 38206601 Test: TreeHugger Change-Id: I304081db2127a22d6dd67b6494b4f3279614d19c --- Android.mk | 5 - .../android/service/euicc/DeleteResult.aidl | 19 ---- .../android/service/euicc/DeleteResult.java | 97 ---------------- .../android/service/euicc/DownloadResult.aidl | 19 ---- .../android/service/euicc/DownloadResult.java | 106 ------------------ .../android/service/euicc/EraseResult.aidl | 19 ---- .../android/service/euicc/EraseResult.java | 97 ---------------- .../android/service/euicc/EuiccService.java | 66 ++++++----- ...ultDownloadableSubscriptionListResult.java | 83 +++++--------- ...ownloadableSubscriptionMetadataResult.java | 83 +++++--------- .../euicc/GetEuiccProfileInfoListResult.java | 106 +++++++----------- .../euicc/IDeleteSubscriptionCallback.aidl | 4 +- .../euicc/IDownloadSubscriptionCallback.aidl | 4 +- .../euicc/IEraseSubscriptionsCallback.aidl | 4 +- .../euicc/ISwitchToSubscriptionCallback.aidl | 4 +- .../IUpdateSubscriptionNicknameCallback.aidl | 4 +- .../android/service/euicc/SwitchResult.aidl | 19 ---- .../android/service/euicc/SwitchResult.java | 106 ------------------ .../service/euicc/UpdateNicknameResult.aidl | 19 ---- .../service/euicc/UpdateNicknameResult.java | 98 ---------------- .../android/telephony/euicc/EuiccManager.java | 13 +-- 21 files changed, 145 insertions(+), 830 deletions(-) delete mode 100644 core/java/android/service/euicc/DeleteResult.aidl delete mode 100644 core/java/android/service/euicc/DeleteResult.java delete mode 100644 core/java/android/service/euicc/DownloadResult.aidl delete mode 100644 core/java/android/service/euicc/DownloadResult.java delete mode 100644 core/java/android/service/euicc/EraseResult.aidl delete mode 100644 core/java/android/service/euicc/EraseResult.java delete mode 100644 core/java/android/service/euicc/SwitchResult.aidl delete mode 100644 core/java/android/service/euicc/SwitchResult.java delete mode 100644 core/java/android/service/euicc/UpdateNicknameResult.aidl delete mode 100644 core/java/android/service/euicc/UpdateNicknameResult.java diff --git a/Android.mk b/Android.mk index 00dc784410286..3750548e4d3e1 100644 --- a/Android.mk +++ b/Android.mk @@ -772,14 +772,9 @@ 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/service/euicc/DeleteResult.aidl b/core/java/android/service/euicc/DeleteResult.aidl deleted file mode 100644 index 3da8b49fb9ffa..0000000000000 --- a/core/java/android/service/euicc/DeleteResult.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 deleted file mode 100644 index 8be9ac9543dfd..0000000000000 --- a/core/java/android/service/euicc/DeleteResult.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.aidl b/core/java/android/service/euicc/DownloadResult.aidl deleted file mode 100644 index 66ec999b6ce8f..0000000000000 --- a/core/java/android/service/euicc/DownloadResult.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 DownloadResult; diff --git a/core/java/android/service/euicc/DownloadResult.java b/core/java/android/service/euicc/DownloadResult.java deleted file mode 100644 index ad75bff96f108..0000000000000 --- a/core/java/android/service/euicc/DownloadResult.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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#onDownloadSubscription} operation. - * @hide - * - * TODO(b/35851809): Make this a SystemApi. - */ -public final class DownloadResult implements Parcelable { - - public static final Creator CREATOR = new Creator() { - @Override - public DownloadResult createFromParcel(Parcel in) { - return new DownloadResult(in); - } - - @Override - public DownloadResult[] newArray(int size) { - return new DownloadResult[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 DownloadResult(int result, int detailedCode) { - this.result = result; - this.detailedCode = detailedCode; - } - - private DownloadResult(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 download was successful. */ - public static DownloadResult success() { - return new DownloadResult(RESULT_OK, 0); - } - - /** - * Return a result indicating that an active SIM must be deactivated to perform the operation. - */ - public static DownloadResult mustDeactivateSim() { - return new DownloadResult(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 DownloadResult genericError(int detailedCode) { - return new DownloadResult(RESULT_GENERIC_ERROR, detailedCode); - } - - @Override - public int describeContents() { - return 0; - } -} diff --git a/core/java/android/service/euicc/EraseResult.aidl b/core/java/android/service/euicc/EraseResult.aidl deleted file mode 100644 index e28a097ebb65f..0000000000000 --- a/core/java/android/service/euicc/EraseResult.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 deleted file mode 100644 index 1cce5a9213b5f..0000000000000 --- a/core/java/android/service/euicc/EraseResult.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 3734904196a36..8f61d965177e5 100644 --- a/core/java/android/service/euicc/EuiccService.java +++ b/core/java/android/service/euicc/EuiccService.java @@ -90,6 +90,16 @@ public abstract class EuiccService extends Service { */ public static final String ACTION_RESOLVE_NO_PRIVILEGES = "android.service.euicc.action.RESOLVE_NO_PRIVILEGES"; + + /** Result code for a successful operation. */ + public static final int RESULT_OK = 0; + /** Result code indicating that an active SIM must be deactivated to perform the operation. */ + public static final int RESULT_MUST_DEACTIVATE_SIM = -1; + // New predefined codes should have negative values. + + /** Start of implementation-specific error results. */ + public static final int RESULT_FIRST_USER = 1; + /** * List of all valid resolution actions for validation purposes. * @hide @@ -138,9 +148,8 @@ public abstract class EuiccService extends Service { * 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, - * {@link GetDownloadableSubscriptionMetadataResult#mustDeactivateSim()} should be returned - * to allow the user to consent to this operation first. + * eUICC, perform this action automatically. Otherwise, {@link #RESULT_MUST_DEACTIVATE_SIM)} + * should be returned to allow the user to consent to this operation first. * @return The result of the operation. * @see android.telephony.euicc.EuiccManager#getDownloadableSubscriptionMetadata */ @@ -153,9 +162,8 @@ public abstract class EuiccService extends Service { * @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. + * eUICC, perform this action automatically. Otherwise, {@link #RESULT_MUST_DEACTIVATE_SIM)} + * 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 */ @@ -171,13 +179,13 @@ public abstract class EuiccService extends Service { * @param switchAfterDownload If true, the subscription should be enabled upon successful * download. * @param forceDeactivateSim If true, and if an active SIM must be deactivated to access the - * eUICC, perform this action automatically. Otherwise, - * {@link DownloadResult#mustDeactivateSim()} should be returned to allow the user to - * consent to this operation first. - * @return the result of the download operation. + * eUICC, perform this action automatically. Otherwise, {@link #RESULT_MUST_DEACTIVATE_SIM} + * should be returned to allow the user to consent to this operation first. + * @return the result of the download operation. May be one of the predefined {@code RESULT_} + * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}. * @see android.telephony.euicc.EuiccManager#downloadSubscription */ - public abstract DownloadResult onDownloadSubscription(int slotId, + public abstract int onDownloadSubscription(int slotId, DownloadableSubscription subscription, boolean switchAfterDownload, boolean forceDeactivateSim); @@ -211,10 +219,11 @@ public abstract class EuiccService extends Service { * @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. + * @return the result of the delete operation. May be one of the predefined {@code RESULT_} + * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}. * @see android.telephony.euicc.EuiccManager#deleteSubscription */ - public abstract DeleteResult onDeleteSubscription(int slotId, String iccid); + public abstract int onDeleteSubscription(int slotId, String iccid); /** * Switch to the given subscription. @@ -225,13 +234,13 @@ public abstract class EuiccService extends Service { * 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. + * eUICC, perform this action automatically. Otherwise, {@link #RESULT_MUST_DEACTIVATE_SIM} + * should be returned to allow the user to consent to this operation first. + * @return the result of the switch operation. May be one of the predefined {@code RESULT_} + * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}. * @see android.telephony.euicc.EuiccManager#switchToSubscription */ - public abstract SwitchResult onSwitchToSubscription(int slotId, @Nullable String iccid, + public abstract int onSwitchToSubscription(int slotId, @Nullable String iccid, boolean forceDeactivateSim); /** @@ -241,10 +250,11 @@ public abstract class EuiccService extends Service { * 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. + * @return the result of the update operation. May be one of the predefined {@code RESULT_} + * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}. * @see android.telephony.euicc.EuiccManager#updateSubscriptionNickname */ - public abstract UpdateNicknameResult onUpdateSubscriptionNickname(int slotId, String iccid, + public abstract int onUpdateSubscriptionNickname(int slotId, String iccid, String nickname); /** @@ -255,10 +265,11 @@ public abstract class EuiccService extends Service { * * @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. + * @return the result of the erase operation. May be one of the predefined {@code RESULT_} + * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}. * @see android.telephony.euicc.EuiccManager#eraseSubscriptions */ - public abstract EraseResult onEraseSubscriptions(int slotId); + public abstract int onEraseSubscriptions(int slotId); /** * Wrapper around IEuiccService that forwards calls to implementations of {@link EuiccService}. @@ -268,7 +279,7 @@ public abstract class EuiccService extends Service { public void downloadSubscription(int slotId, DownloadableSubscription subscription, boolean switchAfterDownload, boolean forceDeactivateSim, IDownloadSubscriptionCallback callback) { - DownloadResult result = EuiccService.this.onDownloadSubscription( + int result = EuiccService.this.onDownloadSubscription( slotId, subscription, switchAfterDownload, forceDeactivateSim); try { callback.onComplete(result); @@ -339,7 +350,7 @@ public abstract class EuiccService extends Service { @Override public void deleteSubscription(int slotId, String iccid, IDeleteSubscriptionCallback callback) { - DeleteResult result = EuiccService.this.onDeleteSubscription(slotId, iccid); + int result = EuiccService.this.onDeleteSubscription(slotId, iccid); try { callback.onComplete(result); } catch (RemoteException e) { @@ -350,7 +361,7 @@ public abstract class EuiccService extends Service { @Override public void switchToSubscription(int slotId, String iccid, boolean forceDeactivateSim, ISwitchToSubscriptionCallback callback) { - SwitchResult result = + int result = EuiccService.this.onSwitchToSubscription(slotId, iccid, forceDeactivateSim); try { callback.onComplete(result); @@ -362,8 +373,7 @@ public abstract class EuiccService extends Service { @Override public void updateSubscriptionNickname(int slotId, String iccid, String nickname, IUpdateSubscriptionNicknameCallback callback) { - UpdateNicknameResult result = - EuiccService.this.onUpdateSubscriptionNickname(slotId, iccid, nickname); + int result = EuiccService.this.onUpdateSubscriptionNickname(slotId, iccid, nickname); try { callback.onComplete(result); } catch (RemoteException e) { @@ -373,7 +383,7 @@ public abstract class EuiccService extends Service { @Override public void eraseSubscriptions(int slotId, IEraseSubscriptionsCallback callback) { - EraseResult result = EuiccService.this.onEraseSubscriptions(slotId); + int result = EuiccService.this.onEraseSubscriptions(slotId); try { callback.onComplete(result); } catch (RemoteException e) { diff --git a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java index 95569b27e7632..5a24492007f3f 100644 --- a/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java +++ b/core/java/android/service/euicc/GetDefaultDownloadableSubscriptionListResult.java @@ -15,15 +15,11 @@ */ 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 @@ -45,77 +41,54 @@ public final class GetDefaultDownloadableSubscriptionListResult implements Parce } }; - /** @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; + /** + * Result of the operation. + * + *

May be one of the predefined {@code RESULT_} constants in EuiccService or any + * implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}. + */ + public final int result; /** * The available {@link DownloadableSubscription}s (with filled-in metadata). * - *

Only non-null if {@link #result} is {@link #RESULT_OK}. + *

Only non-null if {@link #result} is {@link EuiccService#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) { + /** + * Construct a new {@link GetDefaultDownloadableSubscriptionListResult}. + * + * @param result Result of the operation. May be one of the predefined {@code RESULT_} constants + * in EuiccService or any implementation-specific code starting with + * {@link EuiccService#RESULT_FIRST_USER}. + * @param subscriptions The available subscriptions. Should only be provided if the result is + * {@link EuiccService#RESULT_OK}. + */ + public GetDefaultDownloadableSubscriptionListResult(int result, + @Nullable DownloadableSubscription[] subscriptions) { this.result = result; - this.subscriptions = subscriptions; - this.detailedCode = detailedCode; + if (this.result == EuiccService.RESULT_OK) { + this.subscriptions = subscriptions; + } else { + if (subscriptions != null) { + throw new IllegalArgumentException( + "Error result with non-null subscriptions: " + result); + } + this.subscriptions = null; + } } 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 diff --git a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java index 99e7614cbf08a..de8a30706945d 100644 --- a/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java +++ b/core/java/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java @@ -15,15 +15,11 @@ */ 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#onGetDownloadableSubscriptionMetadata} operation. * @hide @@ -45,77 +41,54 @@ public final class GetDownloadableSubscriptionMetadataResult implements Parcelab } }; - /** @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; + /** + * Result of the operation. + * + *

May be one of the predefined {@code RESULT_} constants in EuiccService or any + * implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}. + */ + public final int result; /** * The {@link DownloadableSubscription} with filled-in metadata. * - *

Only non-null if {@link #result} is {@link #RESULT_OK}. + *

Only non-null if {@link #result} is {@link EuiccService#RESULT_OK}. */ @Nullable public final DownloadableSubscription subscription; - /** Implementation-defined detailed error code in case of a failure not covered here. */ - public final int detailedCode; - - private GetDownloadableSubscriptionMetadataResult(int result, - @Nullable DownloadableSubscription subscription, int detailedCode) { + /** + * Construct a new {@link GetDownloadableSubscriptionMetadataResult}. + * + * @param result Result of the operation. May be one of the predefined {@code RESULT_} constants + * in EuiccService or any implementation-specific code starting with + * {@link EuiccService#RESULT_FIRST_USER}. + * @param subscription The subscription with filled-in metadata. Should only be provided if the + * result is {@link EuiccService#RESULT_OK}. + */ + public GetDownloadableSubscriptionMetadataResult(int result, + @Nullable DownloadableSubscription subscription) { this.result = result; - this.subscription = subscription; - this.detailedCode = detailedCode; + if (this.result == EuiccService.RESULT_OK) { + this.subscription = subscription; + } else { + if (subscription != null) { + throw new IllegalArgumentException( + "Error result with non-null subscription: " + result); + } + this.subscription = null; + } } private GetDownloadableSubscriptionMetadataResult(Parcel in) { this.result = in.readInt(); this.subscription = in.readTypedObject(DownloadableSubscription.CREATOR); - this.detailedCode = in.readInt(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(result); dest.writeTypedObject(this.subscription, flags); - dest.writeInt(detailedCode); - } - - /** Return a result indicating that the lookup was successful. */ - public static GetDownloadableSubscriptionMetadataResult success( - DownloadableSubscription subscription) { - return new GetDownloadableSubscriptionMetadataResult(RESULT_OK, subscription, - 0 /* detailedCode */); - } - - /** - * Return a result indicating that an active SIM must be deactivated to perform the operation. - */ - public static GetDownloadableSubscriptionMetadataResult mustDeactivateSim() { - return new GetDownloadableSubscriptionMetadataResult(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 GetDownloadableSubscriptionMetadataResult genericError(int detailedCode) { - return new GetDownloadableSubscriptionMetadataResult(RESULT_GENERIC_ERROR, - null /* subscription */, detailedCode); } @Override diff --git a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java index 5ac10fef3c233..7ad84888dc829 100644 --- a/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java +++ b/core/java/android/service/euicc/GetEuiccProfileInfoListResult.java @@ -15,14 +15,10 @@ */ package android.service.euicc; -import android.annotation.IntDef; import android.annotation.Nullable; import android.os.Parcel; import android.os.Parcelable; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - /** * Result of a {@link EuiccService#onGetEuiccProfileInfoList} operation. * @hide @@ -33,33 +29,24 @@ public final class GetEuiccProfileInfoListResult implements Parcelable { public static final Creator CREATOR = new Creator() { - @Override - public GetEuiccProfileInfoListResult createFromParcel(Parcel in) { - return new GetEuiccProfileInfoListResult(in); - } + @Override + public GetEuiccProfileInfoListResult createFromParcel(Parcel in) { + return new GetEuiccProfileInfoListResult(in); + } - @Override - public GetEuiccProfileInfoListResult[] newArray(int size) { - return new GetEuiccProfileInfoListResult[size]; - } - }; + @Override + public GetEuiccProfileInfoListResult[] newArray(int size) { + return new GetEuiccProfileInfoListResult[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; + /** + * Result of the operation. + * + *

May be one of the predefined {@code RESULT_} constants in EuiccService or any + * implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}. + */ + public final int result; /** The profile list (only upon success). */ @Nullable @@ -68,17 +55,37 @@ public final class GetEuiccProfileInfoListResult implements Parcelable { /** Whether the eUICC is removable. */ public final boolean isRemovable; - private GetEuiccProfileInfoListResult(int result, int detailedCode, EuiccProfileInfo[] profiles, - boolean isRemovable) { + /** + * Construct a new {@link GetEuiccProfileInfoListResult}. + * + * @param result Result of the operation. May be one of the predefined {@code RESULT_} constants + * in EuiccService or any implementation-specific code starting with + * {@link EuiccService#RESULT_FIRST_USER}. + * @param profiles the list of profiles. Should only be provided if the result is + * {@link EuiccService#RESULT_OK}. + * @param isRemovable whether the eUICC in this slot is removable. If true, the profiles + * returned here will only be considered accessible as long as this eUICC is present. + * Otherwise, they will remain accessible until the next time a response with isRemovable + * set to false is returned. + */ + public GetEuiccProfileInfoListResult( + int result, @Nullable EuiccProfileInfo[] profiles, boolean isRemovable) { this.result = result; - this.detailedCode = detailedCode; - this.profiles = profiles; this.isRemovable = isRemovable; + if (this.result == EuiccService.RESULT_OK) { + this.profiles = profiles; + } else { + if (profiles != null) { + throw new IllegalArgumentException( + "Error result with non-null profiles: " + result); + } + this.profiles = null; + } + } private GetEuiccProfileInfoListResult(Parcel in) { this.result = in.readInt(); - this.detailedCode = in.readInt(); this.profiles = in.createTypedArray(EuiccProfileInfo.CREATOR); this.isRemovable = in.readBoolean(); } @@ -86,41 +93,10 @@ public final class GetEuiccProfileInfoListResult implements Parcelable { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(result); - dest.writeInt(detailedCode); dest.writeTypedArray(profiles, flags); dest.writeBoolean(isRemovable); } - /** - * Return a result indicating that the listing was successful. - * - * @param profiles the list of profiles - * @param isRemovable whether the eUICC in this slot is removable. If true, the profiles - * returned here will only be considered accessible as long as this eUICC is present. - * Otherwise, they will remain accessible until the next time a response with isRemovable - * set to false is returned. - */ - public static GetEuiccProfileInfoListResult success( - EuiccProfileInfo[] profiles, boolean isRemovable) { - return new GetEuiccProfileInfoListResult( - RESULT_OK, 0 /* detailedCode */, profiles, isRemovable); - } - - /** - * 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. - * @param isRemovable whether the eUICC in this slot is removable. If true, only removable - * profiles will be made inaccessible. Otherwise, all embedded profiles will be - * considered inaccessible. - */ - public static GetEuiccProfileInfoListResult genericError( - int detailedCode, boolean isRemovable) { - return new GetEuiccProfileInfoListResult( - RESULT_GENERIC_ERROR, detailedCode, null /* profiles */, isRemovable); - } - @Override public int describeContents() { return 0; diff --git a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl index 224cbd3bd6418..4667066df8664 100644 --- a/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl +++ b/core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl @@ -16,9 +16,7 @@ package android.service.euicc; -import android.service.euicc.DeleteResult; - /** @hide */ oneway interface IDeleteSubscriptionCallback { - void onComplete(in DeleteResult result); + void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl b/core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl index 0677cbe3ca1c9..6893c8559d9db 100644 --- a/core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl +++ b/core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl @@ -16,9 +16,7 @@ package android.service.euicc; -import android.service.euicc.DownloadResult; - /** @hide */ oneway interface IDownloadSubscriptionCallback { - void onComplete(in DownloadResult result); + void onComplete(int 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 index aa70e767242e7..c975f1894aa2a 100644 --- a/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl +++ b/core/java/android/service/euicc/IEraseSubscriptionsCallback.aidl @@ -16,9 +16,7 @@ package android.service.euicc; -import android.service.euicc.EraseResult; - /** @hide */ oneway interface IEraseSubscriptionsCallback { - void onComplete(in EraseResult result); + void onComplete(int result); } \ No newline at end of file diff --git a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl index 970adcd8bef50..0f91a6b29e26c 100644 --- a/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl +++ b/core/java/android/service/euicc/ISwitchToSubscriptionCallback.aidl @@ -16,9 +16,7 @@ package android.service.euicc; -import android.service.euicc.SwitchResult; - /** @hide */ oneway interface ISwitchToSubscriptionCallback { - void onComplete(in SwitchResult result); + void onComplete(int 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 index 439759d957476..66669330c8c0a 100644 --- a/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl +++ b/core/java/android/service/euicc/IUpdateSubscriptionNicknameCallback.aidl @@ -16,9 +16,7 @@ package android.service.euicc; -import android.service.euicc.UpdateNicknameResult; - /** @hide */ oneway interface IUpdateSubscriptionNicknameCallback { - void onComplete(in UpdateNicknameResult result); + void onComplete(int 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 deleted file mode 100644 index eb706a5c65d37..0000000000000 --- a/core/java/android/service/euicc/SwitchResult.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 deleted file mode 100644 index f5dc4d3399c13..0000000000000 --- a/core/java/android/service/euicc/SwitchResult.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 deleted file mode 100644 index 08b849127857f..0000000000000 --- a/core/java/android/service/euicc/UpdateNicknameResult.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 deleted file mode 100644 index d871fc8829333..0000000000000 --- a/core/java/android/service/euicc/UpdateNicknameResult.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index be32f72fe1452..6367772b20011 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -92,15 +92,12 @@ public class EuiccManager { public static final int EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR = 1; /** - * Result code for an operation indicating that a generic error occurred. + * Result code for an operation indicating that an unresolvable error occurred. * - *

Note that in the future, other result codes may be returned indicating more specific - * errors. Thus, the caller should check for {@link #EMBEDDED_SUBSCRIPTION_RESULT_OK} or - * {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} to determine if the operation - * succeeded or failed with a user-resolvable error, and assume the operation failed for any - * other result, rather than checking for this specific value. + * {@link #EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE} will be populated with a detailed error + * code for logging/debugging purposes only. */ - public static final int EMBEDDED_SUBSCRIPTION_RESULT_GENERIC_ERROR = 2; + public static final int EMBEDDED_SUBSCRIPTION_RESULT_ERROR = 2; /** * Key for an extra set on {@link PendingIntent} result callbacks providing a detailed result @@ -472,7 +469,7 @@ public class EuiccManager { private static void sendUnavailableError(PendingIntent callbackIntent) { try { - callbackIntent.send(EMBEDDED_SUBSCRIPTION_RESULT_GENERIC_ERROR); + callbackIntent.send(EMBEDDED_SUBSCRIPTION_RESULT_ERROR); } catch (PendingIntent.CanceledException e) { // Caller canceled the callback; do nothing. }