summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chen Xu <fionaxu@google.com> 2021-12-16 06:26:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-12-16 06:26:55 +0000
commitd20446a3976c3bf86b6a36822ee6547b471927c3 (patch)
tree9f61af7adbe619ed84ac8fa42b1e580709a65e43
parentfa21499347843631676c9d489dc6d4bb4c8dc0be (diff)
parentf75bb1348075d3bc757ca3c9a242f57b55f43bf4 (diff)
Merge "Add EuiccCardManager requestEnabledProfileForPort"
-rw-r--r--core/api/current.txt1
-rw-r--r--core/api/system-current.txt2
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java9
-rw-r--r--telephony/java/android/telephony/euicc/EuiccCardManager.java97
-rw-r--r--telephony/java/com/android/internal/telephony/euicc/IEuiccCardController.aidl2
5 files changed, 79 insertions, 32 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index c406970726e7..e12e567cc048 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -43446,6 +43446,7 @@ package android.telephony {
field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
field public static final int DATA_SUSPENDED = 3; // 0x3
field public static final int DATA_UNKNOWN = -1; // 0xffffffff
+ field public static final int DEFAULT_PORT_INDEX = 0; // 0x0
field public static final int ERI_FLASH = 2; // 0x2
field public static final int ERI_OFF = 1; // 0x1
field public static final int ERI_ON = 0; // 0x0
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 917738d1314b..85b3bd11972d 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -13192,6 +13192,7 @@ package android.telephony.euicc {
method public void removeNotificationFromList(String, int, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.Void>);
method public void requestAllProfiles(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo[]>);
method public void requestDefaultSmdpAddress(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<java.lang.String>);
+ method public void requestEnabledProfileForPort(@NonNull String, int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.euicc.EuiccCardManager.ResultCallback<android.service.euicc.EuiccProfileInfo>);
method public void requestEuiccChallenge(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
method public void requestEuiccInfo1(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
method public void requestEuiccInfo2(String, java.util.concurrent.Executor, android.telephony.euicc.EuiccCardManager.ResultCallback<byte[]>);
@@ -13215,6 +13216,7 @@ package android.telephony.euicc {
field public static final int RESULT_CALLER_NOT_ALLOWED = -3; // 0xfffffffd
field public static final int RESULT_EUICC_NOT_FOUND = -2; // 0xfffffffe
field public static final int RESULT_OK = 0; // 0x0
+ field public static final int RESULT_PROFILE_NOT_FOUND = -4; // 0xfffffffc
field public static final int RESULT_UNKNOWN_ERROR = -1; // 0xffffffff
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 315fb0a72bf8..7f10d644a53e 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -321,8 +321,13 @@ public class TelephonyManager {
public static final int UNINITIALIZED_CARD_ID = -2;
/**
- * Default port index for the UICC Card
- * @hide
+ * Default port index for a UICC.
+ *
+ * On physical SIM cards the only available port is 0.
+ * See {@link android.telephony.UiccPortInfo} for more information on ports.
+ *
+ * See {@link android.telephony.euicc.EuiccManager#isSimPortAvailable(int)} for information on
+ * how portIndex is used on eUICCs.
*/
public static final int DEFAULT_PORT_INDEX = 0;
diff --git a/telephony/java/android/telephony/euicc/EuiccCardManager.java b/telephony/java/android/telephony/euicc/EuiccCardManager.java
index ab35d77c0b4d..885244ede4f1 100644
--- a/telephony/java/android/telephony/euicc/EuiccCardManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccCardManager.java
@@ -66,14 +66,15 @@ public class EuiccCardManager {
/** Reason for canceling a profile download session */
@Retention(RetentionPolicy.SOURCE)
- @IntDef(prefix = { "CANCEL_REASON_" }, value = {
+ @IntDef(prefix = {"CANCEL_REASON_"}, value = {
CANCEL_REASON_END_USER_REJECTED,
CANCEL_REASON_POSTPONED,
CANCEL_REASON_TIMEOUT,
CANCEL_REASON_PPR_NOT_ALLOWED
})
/** @hide */
- public @interface CancelReason {}
+ public @interface CancelReason {
+ }
/**
* The end user has rejected the download. The profile will be put into the error state and
@@ -96,13 +97,14 @@ public class EuiccCardManager {
/** Options for resetting eUICC memory */
@Retention(RetentionPolicy.SOURCE)
- @IntDef(flag = true, prefix = { "RESET_OPTION_" }, value = {
+ @IntDef(flag = true, prefix = {"RESET_OPTION_"}, value = {
RESET_OPTION_DELETE_OPERATIONAL_PROFILES,
RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES,
RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS
})
/** @hide */
- public @interface ResetOption {}
+ public @interface ResetOption {
+ }
/** Deletes all operational profiles. */
public static final int RESET_OPTION_DELETE_OPERATIONAL_PROFILES = 1;
@@ -124,6 +126,10 @@ public class EuiccCardManager {
/** Result code indicating the caller is not the active LPA. */
public static final int RESULT_CALLER_NOT_ALLOWED = -3;
+
+ /** Result code when the requested profile is not found */
+ public static final int RESULT_PROFILE_NOT_FOUND = -4;
+
/**
* Callback to receive the result of an eUICC card API.
*
@@ -134,9 +140,9 @@ public class EuiccCardManager {
* This method will be called when an eUICC card API call is completed.
*
* @param resultCode This can be {@link #RESULT_OK} or other positive values returned by the
- * eUICC.
- * @param result The result object. It can be null if the {@code resultCode} is not
- * {@link #RESULT_OK}.
+ * eUICC.
+ * @param result The result object. It can be null if the {@code resultCode} is not
+ * {@link #RESULT_OK}.
*/
void onComplete(int resultCode, T result);
}
@@ -159,7 +165,7 @@ public class EuiccCardManager {
/**
* Requests all the profiles on eUicc.
*
- * @param cardId The Id of the eUICC.
+ * @param cardId The Id of the eUICC.
* @param executor The executor through which the callback should be invoked.
* @param callback The callback to get the result code and all the profiles.
*/
@@ -187,8 +193,8 @@ public class EuiccCardManager {
/**
* Requests the profile of the given iccid.
*
- * @param cardId The Id of the eUICC.
- * @param iccid The iccid of the profile.
+ * @param cardId The Id of the eUICC.
+ * @param iccid The iccid of the profile.
* @param executor The executor through which the callback should be invoked.
* @param callback The callback to get the result code and profile.
*/
@@ -214,16 +220,47 @@ public class EuiccCardManager {
}
/**
+ * Requests the enabled profile for a given port on an eUicc.
+ *
+ * @param cardId The Id of the eUICC.
+ * @param portIndex The portIndex to use. The port may be active or inactive. As long as the
+ * ICCID is known, an APDU will be sent through to read the enabled profile.
+ * @param executor The executor through which the callback should be invoked.
+ * @param callback The callback to get the result code and the profile.
+ */
+ public void requestEnabledProfileForPort(@NonNull String cardId, int portIndex,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull ResultCallback<EuiccProfileInfo> callback) {
+ try {
+ getIEuiccCardController().getEnabledProfile(mContext.getOpPackageName(), cardId,
+ portIndex,
+ new IGetProfileCallback.Stub() {
+ @Override
+ public void onComplete(int resultCode, EuiccProfileInfo profile) {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ executor.execute(() -> callback.onComplete(resultCode, profile));
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+ });
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling requestEnabledProfileForPort", e);
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Disables the profile of the given iccid.
*
- * @param cardId The Id of the eUICC.
- * @param iccid The iccid of the profile.
- * @param refresh Whether sending the REFRESH command to modem.
+ * @param cardId The Id of the eUICC.
+ * @param iccid The iccid of the profile.
+ * @param refresh Whether sending the REFRESH command to modem.
* @param executor The executor through which the callback should be invoked.
* @param callback The callback to get the result code.
- *
* @deprecated instead use {@link #disableProfile(String, String, int, boolean, Executor,
- * ResultCallback)}
+ * ResultCallback)}
*/
@Deprecated
public void disableProfile(String cardId, String iccid, boolean refresh,
@@ -247,15 +284,16 @@ public class EuiccCardManager {
throw e.rethrowFromSystemServer();
}
}
+
/**
* Disables the profile of the given ICCID.
*
- * @param cardId The Id of the eUICC.
- * @param iccid The iccid of the profile.
+ * @param cardId The Id of the eUICC.
+ * @param iccid The iccid of the profile.
* @param portIndex the Port index is the unique index referring to a port.
- * @param refresh Whether sending the REFRESH command to modem.
- * @param executor The executor through which the callback should be invoked.
- * @param callback The callback to get the result code.
+ * @param refresh Whether sending the REFRESH command to modem.
+ * @param executor The executor through which the callback should be invoked.
+ * @param callback The callback to get the result code.
*/
public void disableProfile(@Nullable String cardId, @Nullable String iccid, int portIndex,
boolean refresh, @NonNull @CallbackExecutor Executor executor,
@@ -283,14 +321,13 @@ public class EuiccCardManager {
* Switches from the current profile to another profile. The current profile will be disabled
* and the specified profile will be enabled.
*
- * @param cardId The Id of the eUICC.
- * @param iccid The iccid of the profile to switch to.
- * @param refresh Whether sending the REFRESH command to modem.
+ * @param cardId The Id of the eUICC.
+ * @param iccid The iccid of the profile to switch to.
+ * @param refresh Whether sending the REFRESH command to modem.
* @param executor The executor through which the callback should be invoked.
* @param callback The callback to get the result code and the EuiccProfileInfo enabled.
- *
* @deprecated instead use {@link #switchToProfile(String, String, int, boolean, Executor,
- * ResultCallback)}
+ * ResultCallback)}
*/
@Deprecated
public void switchToProfile(String cardId, String iccid, boolean refresh,
@@ -320,12 +357,12 @@ public class EuiccCardManager {
* and the specified profile will be enabled. Here portIndex specifies on which port the
* profile is to be enabled.
*
- * @param cardId The Id of the eUICC.
- * @param iccid The iccid of the profile to switch to.
+ * @param cardId The Id of the eUICC.
+ * @param iccid The iccid of the profile to switch to.
* @param portIndex The Port index is the unique index referring to a port.
- * @param refresh Whether sending the REFRESH command to modem.
- * @param executor The executor through which the callback should be invoked.
- * @param callback The callback to get the result code and the EuiccProfileInfo enabled.
+ * @param refresh Whether sending the REFRESH command to modem.
+ * @param executor The executor through which the callback should be invoked.
+ * @param callback The callback to get the result code and the EuiccProfileInfo enabled.
*/
public void switchToProfile(@Nullable String cardId, @Nullable String iccid, int portIndex,
boolean refresh, @NonNull @CallbackExecutor Executor executor,
diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccCardController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccCardController.aidl
index c717c092cbed..1734c982ffb4 100644
--- a/telephony/java/com/android/internal/telephony/euicc/IEuiccCardController.aidl
+++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccCardController.aidl
@@ -45,6 +45,8 @@ interface IEuiccCardController {
in IGetAllProfilesCallback callback);
oneway void getProfile(String callingPackage, String cardId, String iccid,
in IGetProfileCallback callback);
+ oneway void getEnabledProfile(String callingPackage, String cardId, int portIndex,
+ in IGetProfileCallback callback);
oneway void disableProfile(String callingPackage, String cardId, String iccid, int portIndex,
boolean refresh, in IDisableProfileCallback callback);
oneway void switchToProfile(String callingPackage, String cardId, String iccid, int portIndex,