diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/euicc/EuiccManager.java | 63 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl | 31 |
3 files changed, 62 insertions, 33 deletions
diff --git a/api/current.txt b/api/current.txt index 0f8409abb10b..7894e3a5d026 100644 --- a/api/current.txt +++ b/api/current.txt @@ -45079,6 +45079,7 @@ package android.telephony.euicc { } public class EuiccManager { + method public android.telephony.euicc.EuiccManager createForCardId(int); method public void deleteSubscription(int, android.app.PendingIntent); method public void downloadSubscription(android.telephony.euicc.DownloadableSubscription, boolean, android.app.PendingIntent); method public java.lang.String getEid(); diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java index cc9befedcdf7..42a788d0cc8e 100644 --- a/telephony/java/android/telephony/euicc/EuiccManager.java +++ b/telephony/java/android/telephony/euicc/EuiccManager.java @@ -30,6 +30,7 @@ import android.content.pm.PackageManager; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; +import android.telephony.TelephonyManager; import com.android.internal.telephony.euicc.IEuiccController; @@ -40,7 +41,11 @@ import java.lang.annotation.RetentionPolicy; * EuiccManager is the application interface to eUICCs, or eSIMs/embedded SIMs. * * <p>You do not instantiate this class directly; instead, you retrieve an instance through - * {@link Context#getSystemService(String)} and {@link Context#EUICC_SERVICE}. + * {@link Context#getSystemService(String)} and {@link Context#EUICC_SERVICE}. This instance will be + * created using the default eUICC. + * + * <p>On a device with multiple eUICCs, you may want to create multiple EuiccManagers. To do this + * you can call {@link #createForCardId}. * * <p>See {@link #isEnabled} before attempting to use these APIs. */ @@ -318,10 +323,29 @@ public class EuiccManager { public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; private final Context mContext; + private final int mCardId; /** @hide */ public EuiccManager(Context context) { mContext = context; + TelephonyManager tm = (TelephonyManager) + context.getSystemService(Context.TELEPHONY_SERVICE); + mCardId = tm.getCardIdForDefaultEuicc(); + } + + /** @hide */ + private EuiccManager(Context context, int cardId) { + mContext = context; + mCardId = cardId; + } + + /** + * Create a new EuiccManager object pinned to the given card ID. + * + * @return an EuiccManager that uses the given card ID for all calls. + */ + public EuiccManager createForCardId(int cardId) { + return new EuiccManager(mContext, cardId); } /** @@ -344,7 +368,8 @@ public class EuiccManager { * Returns the EID identifying the eUICC hardware. * * <p>Requires that the calling app has carrier privileges on the active subscription on the - * eUICC. + * current eUICC. A calling app with carrier privileges for one eUICC may not necessarily have + * access to the EID of another eUICC. * * @return the EID. May be null if {@link #isEnabled()} is false or the eUICC is not ready. */ @@ -354,7 +379,7 @@ public class EuiccManager { return null; } try { - return getIEuiccController().getEid(); + return getIEuiccController().getEid(mCardId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -377,7 +402,7 @@ public class EuiccManager { return EUICC_OTA_STATUS_UNAVAILABLE; } try { - return getIEuiccController().getOtaStatus(); + return getIEuiccController().getOtaStatus(mCardId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -387,10 +412,10 @@ public class EuiccManager { * Attempt to download the given {@link DownloadableSubscription}. * * <p>Requires the {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission, - * or the calling app must be authorized to manage both the currently-active subscription and - * the subscription to be downloaded according to the subscription metadata. Without the former, - * an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be returned in the callback - * intent to prompt the user to accept the download. + * or the calling app must be authorized to manage both the currently-active subscription on the + * current eUICC and the subscription to be downloaded according to the subscription metadata. + * Without the former, an {@link #EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR} will be + * returned in the callback intent to prompt the user to accept the download. * * @param subscription the subscription to download. * @param switchAfterDownload if true, the profile will be activated upon successful download. @@ -404,7 +429,7 @@ public class EuiccManager { return; } try { - getIEuiccController().downloadSubscription(subscription, switchAfterDownload, + getIEuiccController().downloadSubscription(mCardId, subscription, switchAfterDownload, mContext.getOpPackageName(), null /* resolvedBundle */, callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -471,7 +496,7 @@ public class EuiccManager { return; } try { - getIEuiccController().continueOperation(resolutionIntent, resolutionExtras); + getIEuiccController().continueOperation(mCardId, resolutionIntent, resolutionExtras); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -503,8 +528,8 @@ public class EuiccManager { return; } try { - getIEuiccController().getDownloadableSubscriptionMetadata( - subscription, mContext.getOpPackageName(), callbackIntent); + getIEuiccController().getDownloadableSubscriptionMetadata(mCardId, subscription, + mContext.getOpPackageName(), callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -533,7 +558,7 @@ public class EuiccManager { return; } try { - getIEuiccController().getDefaultDownloadableSubscriptionList( + getIEuiccController().getDefaultDownloadableSubscriptionList(mCardId, mContext.getOpPackageName(), callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -552,7 +577,7 @@ public class EuiccManager { return null; } try { - return getIEuiccController().getEuiccInfo(); + return getIEuiccController().getEuiccInfo(mCardId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -578,7 +603,7 @@ public class EuiccManager { return; } try { - getIEuiccController().deleteSubscription( + getIEuiccController().deleteSubscription(mCardId, subscriptionId, mContext.getOpPackageName(), callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -606,7 +631,7 @@ public class EuiccManager { return; } try { - getIEuiccController().switchToSubscription( + getIEuiccController().switchToSubscription(mCardId, subscriptionId, mContext.getOpPackageName(), callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -632,7 +657,7 @@ public class EuiccManager { return; } try { - getIEuiccController().updateSubscriptionNickname( + getIEuiccController().updateSubscriptionNickname(mCardId, subscriptionId, nickname, mContext.getOpPackageName(), callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -656,7 +681,7 @@ public class EuiccManager { return; } try { - getIEuiccController().eraseSubscriptions(callbackIntent); + getIEuiccController().eraseSubscriptions(mCardId, callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -686,7 +711,7 @@ public class EuiccManager { return; } try { - getIEuiccController().retainSubscriptionsForFactoryReset(callbackIntent); + getIEuiccController().retainSubscriptionsForFactoryReset(mCardId, callbackIntent); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl index dd40d560250d..14a36c8c840d 100644 --- a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl +++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl @@ -24,22 +24,25 @@ import android.telephony.euicc.EuiccInfo; /** @hide */ interface IEuiccController { - oneway void continueOperation(in Intent resolutionIntent, in Bundle resolutionExtras); - oneway void getDownloadableSubscriptionMetadata(in DownloadableSubscription subscription, + oneway void continueOperation(int cardId, in Intent resolutionIntent, + in Bundle resolutionExtras); + oneway void getDownloadableSubscriptionMetadata(int cardId, + in DownloadableSubscription subscription, String callingPackage, in PendingIntent callbackIntent); - oneway void getDefaultDownloadableSubscriptionList( + oneway void getDefaultDownloadableSubscriptionList(int cardId, String callingPackage, in PendingIntent callbackIntent); - String getEid(); - int getOtaStatus(); - oneway void downloadSubscription(in DownloadableSubscription subscription, - boolean switchAfterDownload, String callingPackage, in Bundle resolvedBundle, in PendingIntent callbackIntent); - EuiccInfo getEuiccInfo(); - oneway void deleteSubscription(int subscriptionId, String callingPackage, + String getEid(int cardId); + int getOtaStatus(int cardId); + oneway void downloadSubscription(int cardId, in DownloadableSubscription subscription, + boolean switchAfterDownload, String callingPackage, in Bundle resolvedBundle, in PendingIntent callbackIntent); - oneway void switchToSubscription(int subscriptionId, String callingPackage, + EuiccInfo getEuiccInfo(int cardId); + oneway void deleteSubscription(int cardId, int subscriptionId, String callingPackage, in PendingIntent callbackIntent); - oneway void updateSubscriptionNickname(int subscriptionId, String nickname, + oneway void switchToSubscription(int cardId, int subscriptionId, String callingPackage, + in PendingIntent callbackIntent); + oneway void updateSubscriptionNickname(int cardId, int subscriptionId, String nickname, String callingPackage, in PendingIntent callbackIntent); - oneway void eraseSubscriptions(in PendingIntent callbackIntent); - oneway void retainSubscriptionsForFactoryReset(in PendingIntent callbackIntent); -}
\ No newline at end of file + oneway void eraseSubscriptions(int cardId, in PendingIntent callbackIntent); + oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent); +} |