Merge "improve euiccManager API doc" into tm-dev

This commit is contained in:
Chen Xu
2022-02-22 17:50:28 +00:00
committed by Android (Google) Code Review
5 changed files with 67 additions and 20 deletions

View File

@@ -4189,7 +4189,8 @@ public class TelephonyManager {
* {@link UiccSlotMapping} which consist of both physical slot index and port index. * {@link UiccSlotMapping} which consist of both physical slot index and port index.
* Logical slot is the slot that is seen by modem. Physical slot is the actual physical slot. * Logical slot is the slot that is seen by modem. Physical slot is the actual physical slot.
* Port index is the index (enumerated value) for the associated port available on the SIM. * Port index is the index (enumerated value) for the associated port available on the SIM.
* Each physical slot can have multiple ports if multi-enabled profile(MEP) is supported. * Each physical slot can have multiple ports if
* {@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP} is supported.
* *
* Example: no. of logical slots 1 and physical slots 2 do not support MEP, each physical slot * Example: no. of logical slots 1 and physical slots 2 do not support MEP, each physical slot
* has one port: * has one port:
@@ -4285,11 +4286,11 @@ public class TelephonyManager {
/** /**
* Get the mapping from logical slots to physical sim slots and port indexes. Initially the * Get the mapping from logical slots to physical sim slots and port indexes. Initially the
* logical slot index was mapped to physical slot index, but with support for multi-enabled * logical slot index was mapped to physical slot index, but with support for multi-enabled
* profile(MEP) logical slot is now mapped to port index. * profile(MEP){@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP},logical slot is now mapped to
* port index.
* *
* @return a collection of {@link UiccSlotMapping} which indicates the mapping from logical * @return a collection of {@link UiccSlotMapping} which indicates the mapping from logical
* slots to ports and physical slots. * slots to ports and physical slots.
*
* @hide * @hide
*/ */
@SystemApi @SystemApi

View File

@@ -17,6 +17,7 @@ package android.telephony;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.content.pm.PackageManager;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -147,9 +148,10 @@ public final class UiccCardInfo implements Parcelable {
* Note that this field may be omitted if the caller does not have the correct permissions * Note that this field may be omitted if the caller does not have the correct permissions
* (see {@link TelephonyManager#getUiccCardsInfo()}). * (see {@link TelephonyManager#getUiccCardsInfo()}).
* *
* @deprecated with support for MEP(multiple enabled profile), a SIM card can have more than one * @deprecated with support for MEP(multiple enabled profile)
* ICCID active at the same time.Instead use {@link UiccPortInfo#getIccId()} to retrieve ICCID. * {@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP}, a SIM card can have more than one
* To find {@link UiccPortInfo} use {@link UiccCardInfo#getPorts()} * ICCID active at the same time. Instead use {@link UiccPortInfo#getIccId()} to retrieve ICCID.
* To find {@link UiccPortInfo} use {@link UiccCardInfo#getPorts()}.
* *
* @throws UnsupportedOperationException if the calling app's target SDK is T and beyond. * @throws UnsupportedOperationException if the calling app's target SDK is T and beyond.
*/ */
@@ -192,11 +194,11 @@ public final class UiccCardInfo implements Parcelable {
} }
/* /*
* Whether the UICC card supports multiple enable profile(MEP) * Whether the UICC card supports multiple enabled profile(MEP)
* UICCs are generally MEP disabled, there can be only one active profile on the physical * UICCs are generally MEP disabled, there can be only one active profile on the physical
* sim card. * sim card.
* *
* @return {@code true} if the eUICC is supporting multiple enabled profile(MEP). * @return {@code true} if the UICC is supporting multiple enabled profile(MEP).
*/ */
public boolean isMultipleEnabledProfilesSupported() { public boolean isMultipleEnabledProfilesSupported() {
return mIsMultipleEnabledProfilesSupported; return mIsMultipleEnabledProfilesSupported;
@@ -205,6 +207,9 @@ public final class UiccCardInfo implements Parcelable {
/** /**
* Get information regarding port, ICCID and its active status. * Get information regarding port, ICCID and its active status.
* *
* For device which support {@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP}, it should return
* more than one {@link UiccPortInfo} object if the card is eUICC.
*
* @return Collection of {@link UiccPortInfo} * @return Collection of {@link UiccPortInfo}
*/ */
public @NonNull Collection<UiccPortInfo> getPorts() { public @NonNull Collection<UiccPortInfo> getPorts() {

View File

@@ -29,7 +29,9 @@ import java.util.Objects;
* Per GSMA SGP.22 V3.0, a port is a logical entity to which an active UICC profile can be bound on * Per GSMA SGP.22 V3.0, a port is a logical entity to which an active UICC profile can be bound on
* a UICC card. If UICC supports 2 ports, then the port index is numbered 0,1. * a UICC card. If UICC supports 2 ports, then the port index is numbered 0,1.
* Each port index is unique within an UICC, but not necessarily unique across UICC’s. * Each port index is unique within an UICC, but not necessarily unique across UICC’s.
* For UICC's does not support MEP(Multi-enabled profile), just return the default port index 0. * For UICC's does not support MEP(Multi-enabled profile)
* {@link android.content.pm.PackageManager#FEATURE_TELEPHONY_EUICC_MEP}, just return the default
* port index 0.
*/ */
public final class UiccPortInfo implements Parcelable{ public final class UiccPortInfo implements Parcelable{
private final String mIccId; private final String mIccId;

View File

@@ -19,6 +19,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.content.pm.PackageManager;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -225,6 +226,9 @@ public class UiccSlotInfo implements Parcelable {
/** /**
* Get Information regarding port, iccid and its active status. * Get Information regarding port, iccid and its active status.
* *
* For device which support {@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP}, it should return
* more than one {@link UiccPortInfo} object if the card is eUICC.
*
* @return Collection of {@link UiccPortInfo} * @return Collection of {@link UiccPortInfo}
*/ */
public @NonNull Collection<UiccPortInfo> getPorts() { public @NonNull Collection<UiccPortInfo> getPorts() {

View File

@@ -37,6 +37,7 @@ import android.os.RemoteException;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyFrameworkInitializer; import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.telephony.UiccCardInfo;
import android.telephony.euicc.EuiccCardManager.ResetOption; import android.telephony.euicc.EuiccCardManager.ResetOption;
import android.util.Log; import android.util.Log;
@@ -931,6 +932,21 @@ public class EuiccManager {
* intent to prompt the user to accept the download. The caller should also be authorized to * intent to prompt the user to accept the download. The caller should also be authorized to
* manage the subscription to be downloaded. * manage the subscription to be downloaded.
* *
* <p>If device support {@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP} and
* switchAfterDownload is {@code true}, the subscription will be enabled on an esim port based
* on the following selection rules:
* <ul>
* <li>In SS(Single SIM) mode, if the embedded slot already has an active port, then download
* and enable the subscription on this port.
* <li>In SS mode, if the embedded slot is not active, then try to download and enable the
* subscription on the default port 0 of eUICC.
* <li>In DSDS mode, find first available port to download and enable the subscription.
* (see {@link #isSimPortAvailable(int)})
*</ul>
* If there is no available port, an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR}
* will be returned in the callback intent to prompt the user to disable an already-active
* subscription.
*
* @param subscription the subscription to download. * @param subscription the subscription to download.
* @param switchAfterDownload if true, the profile will be activated upon successful download. * @param switchAfterDownload if true, the profile will be activated upon successful download.
* @param callbackIntent a PendingIntent to launch when the operation completes. * @param callbackIntent a PendingIntent to launch when the operation completes.
@@ -1141,14 +1157,25 @@ public class EuiccManager {
* intent to prompt the user to accept the download. The caller should also be authorized to * intent to prompt the user to accept the download. The caller should also be authorized to
* manage the subscription to be enabled. * manage the subscription to be enabled.
* *
* <p> From Android T, devices might support MEP(Multiple Enabled Profiles), the subscription * <p> From Android T, devices might support {@link PackageManager#FEATURE_TELEPHONY_EUICC_MEP},
* can be installed on different port from the eUICC. Calling apps with carrier privilege * the subscription can be installed on different port from the eUICC. Calling apps with
* (see {@link TelephonyManager#hasCarrierPrivileges}) over the currently active subscriptions * carrier privilege (see {@link TelephonyManager#hasCarrierPrivileges}) over the currently
* can use {@link #switchToSubscription(int, int, PendingIntent)} to specify which port to * active subscriptions can use {@link #switchToSubscription(int, int, PendingIntent)} to
* enable the subscription. Otherwise, use this API to enable the subscription on the eUICC * specify which port to enable the subscription. Otherwise, use this API to enable the
* and the platform will internally resolve a port. If there is no available port, * subscription on the eUICC and the platform will internally resolve a port based on following
* an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} might be returned in the callback * rules:
* intent to prompt the user to disable an already-active subscription. * <ul>
* <li>always use the default port 0 is eUICC does not support MEP.
* <li>In SS(Single SIM) mode, if the embedded slot already has an active port, then enable
* the subscription on this port.
* <li>In SS mode, if the embedded slot is not active, then try to enable the subscription on
* the default port 0 of eUICC.
* <li>In DSDS mode, find first available port to enable the subscription.
* (see {@link #isSimPortAvailable(int)})
*</ul>
* If there is no available port, an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR}
* will be returned in the callback intent to prompt the user to disable an already-active
* subscription.
* *
* @param subscriptionId the ID of the subscription to enable. May be * @param subscriptionId the ID of the subscription to enable. May be
* {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} to deactivate the * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} to deactivate the
@@ -1197,7 +1224,15 @@ public class EuiccManager {
* *
* <p> If the caller is passing invalid port index, * <p> If the caller is passing invalid port index,
* an {@link #EMBEDDED_SUBSCRIPTION_RESULT_ERROR} with detailed error code * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_ERROR} with detailed error code
* {@link #ERROR_INVALID_PORT} will be returned. * {@link #ERROR_INVALID_PORT} will be returned. The port index is invalid if one of the
* following requirements is met:
* <ul>
* <li>index is beyond the range of {@link UiccCardInfo#getPorts()}.
* <li>In SS(Single SIM) mode, the embedded slot already has an active port with different
* port index.
* <li>In DSDS mode, if the psim slot is active and the embedded slot already has an active
* empty port with different port index.
* </ul>
* *
* <p> Depending on the target port and permission check, * <p> Depending on the target port and permission check,
* an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} might be returned to the callback * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} might be returned to the callback
@@ -1522,8 +1557,8 @@ public class EuiccManager {
/** /**
* Returns whether the passing portIndex is available. * Returns whether the passing portIndex is available.
* A port is available if it has no profiles enabled on it or calling app has carrier privilege * A port is available if it is active without enabled profile on it or
* over the profile installed on the selected port. * calling app has carrier privilege over the profile installed on the selected port.
* Always returns false if the cardId is a physical card. * Always returns false if the cardId is a physical card.
* *
* @param portIndex is an enumeration of the ports available on the UICC. * @param portIndex is an enumeration of the ports available on the UICC.