Merge "eUICC API error code cleanup." into oc-dr1-dev

This commit is contained in:
Jeff Davidson
2017-06-15 03:35:07 +00:00
committed by Android (Google) Code Review
21 changed files with 145 additions and 830 deletions

View File

@@ -773,14 +773,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 \

View File

@@ -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;

View File

@@ -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<DeleteResult> CREATOR = new Creator<DeleteResult>() {
@Override
public DeleteResult createFromParcel(Parcel in) {
return new DeleteResult(in);
}
@Override
public DeleteResult[] newArray(int size) {
return new DeleteResult[size];
}
};
/** @hide */
@IntDef({
RESULT_OK,
RESULT_GENERIC_ERROR,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ResultCode {}
public static final int RESULT_OK = 0;
public static final int RESULT_GENERIC_ERROR = 1;
/** Result of the operation - one of the RESULT_* constants. */
public final @ResultCode int result;
/** Implementation-defined detailed error code in case of a failure not covered here. */
public final int detailedCode;
private DeleteResult(int result, int detailedCode) {
this.result = result;
this.detailedCode = detailedCode;
}
private DeleteResult(Parcel in) {
this.result = in.readInt();
this.detailedCode = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(result);
dest.writeInt(detailedCode);
}
/** Return a result indicating that the delete was successful. */
public static DeleteResult success() {
return new DeleteResult(RESULT_OK, 0);
}
/**
* Return a result indicating that an error occurred for which no other more specific error
* code has been defined.
*
* @param detailedCode an implemenation-defined detailed error code for debugging purposes.
*/
public static DeleteResult genericError(int detailedCode) {
return new DeleteResult(RESULT_GENERIC_ERROR, detailedCode);
}
@Override
public int describeContents() {
return 0;
}
}

View File

@@ -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;

View File

@@ -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<DownloadResult> CREATOR = new Creator<DownloadResult>() {
@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;
}
}

View File

@@ -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;

View File

@@ -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<EraseResult> CREATOR = new Creator<EraseResult>() {
@Override
public EraseResult createFromParcel(Parcel in) {
return new EraseResult(in);
}
@Override
public EraseResult[] newArray(int size) {
return new EraseResult[size];
}
};
/** @hide */
@IntDef({
RESULT_OK,
RESULT_GENERIC_ERROR,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ResultCode {}
public static final int RESULT_OK = 0;
public static final int RESULT_GENERIC_ERROR = 1;
/** Result of the operation - one of the RESULT_* constants. */
public final @ResultCode int result;
/** Implementation-defined detailed error code in case of a failure not covered here. */
public final int detailedCode;
private EraseResult(int result, int detailedCode) {
this.result = result;
this.detailedCode = detailedCode;
}
private EraseResult(Parcel in) {
this.result = in.readInt();
this.detailedCode = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(result);
dest.writeInt(detailedCode);
}
/** Return a result indicating that the erase was successful. */
public static EraseResult success() {
return new EraseResult(RESULT_OK, 0);
}
/**
* Return a result indicating that an error occurred for which no other more specific error
* code has been defined.
*
* @param detailedCode an implemenation-defined detailed error code for debugging purposes.
*/
public static EraseResult genericError(int detailedCode) {
return new EraseResult(RESULT_GENERIC_ERROR, detailedCode);
}
@Override
public int describeContents() {
return 0;
}
}

View File

@@ -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) {

View File

@@ -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.
*
* <p>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).
*
* <p>Only non-null if {@link #result} is {@link #RESULT_OK}.
* <p>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

View File

@@ -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.
*
* <p>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.
*
* <p>Only non-null if {@link #result} is {@link #RESULT_OK}.
* <p>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

View File

@@ -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<GetEuiccProfileInfoListResult> CREATOR =
new Creator<GetEuiccProfileInfoListResult>() {
@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.
*
* <p>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;

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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<SwitchResult> CREATOR = new Creator<SwitchResult>() {
@Override
public SwitchResult createFromParcel(Parcel in) {
return new SwitchResult(in);
}
@Override
public SwitchResult[] newArray(int size) {
return new SwitchResult[size];
}
};
/** @hide */
@IntDef({
RESULT_OK,
RESULT_GENERIC_ERROR,
RESULT_MUST_DEACTIVATE_SIM,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ResultCode {}
public static final int RESULT_OK = 0;
public static final int RESULT_GENERIC_ERROR = 1;
public static final int RESULT_MUST_DEACTIVATE_SIM = 2;
/** Result of the operation - one of the RESULT_* constants. */
public final @ResultCode int result;
/** Implementation-defined detailed error code in case of a failure not covered here. */
public final int detailedCode;
private SwitchResult(int result, int detailedCode) {
this.result = result;
this.detailedCode = detailedCode;
}
private SwitchResult(Parcel in) {
this.result = in.readInt();
this.detailedCode = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(result);
dest.writeInt(detailedCode);
}
/** Return a result indicating that the switch was successful. */
public static SwitchResult success() {
return new SwitchResult(RESULT_OK, 0);
}
/**
* Return a result indicating that an active SIM must be deactivated to perform the operation.
*/
public static SwitchResult mustDeactivateSim() {
return new SwitchResult(RESULT_MUST_DEACTIVATE_SIM, 0);
}
/**
* Return a result indicating that an error occurred for which no other more specific error
* code has been defined.
*
* @param detailedCode an implemenation-defined detailed error code for debugging purposes.
*/
public static SwitchResult genericError(int detailedCode) {
return new SwitchResult(RESULT_GENERIC_ERROR, detailedCode);
}
@Override
public int describeContents() {
return 0;
}
}

View File

@@ -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;

View File

@@ -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<UpdateNicknameResult> CREATOR =
new Creator<UpdateNicknameResult>() {
@Override
public UpdateNicknameResult createFromParcel(Parcel in) {
return new UpdateNicknameResult(in);
}
@Override
public UpdateNicknameResult[] newArray(int size) {
return new UpdateNicknameResult[size];
}
};
/** @hide */
@IntDef({
RESULT_OK,
RESULT_GENERIC_ERROR,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ResultCode {}
public static final int RESULT_OK = 0;
public static final int RESULT_GENERIC_ERROR = 1;
/** Result of the operation - one of the RESULT_* constants. */
public final @ResultCode int result;
/** Implementation-defined detailed error code in case of a failure not covered here. */
public final int detailedCode;
private UpdateNicknameResult(int result, int detailedCode) {
this.result = result;
this.detailedCode = detailedCode;
}
private UpdateNicknameResult(Parcel in) {
this.result = in.readInt();
this.detailedCode = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(result);
dest.writeInt(detailedCode);
}
/** Return a result indicating that the update was successful. */
public static UpdateNicknameResult success() {
return new UpdateNicknameResult(RESULT_OK, 0);
}
/**
* Return a result indicating that an error occurred for which no other more specific error
* code has been defined.
*
* @param detailedCode an implemenation-defined detailed error code for debugging purposes.
*/
public static UpdateNicknameResult genericError(int detailedCode) {
return new UpdateNicknameResult(RESULT_GENERIC_ERROR, detailedCode);
}
@Override
public int describeContents() {
return 0;
}
}

View File

@@ -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.
*
* <p>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.
}