A overloaded API for downloadSubscription with portIndex for LPA

Most of cases, download opperation is port agnostic we don't need
to specify the portIndex. However if this is triggered from carier
apps and apps specify download followed with esim activation, then
platform need to resolve a portIndex(maybe through UX) and need to
pass this portIndex to LPA app. thus we need to add an overloaded
version of download API for LPA.

Bug: 214055002
Test: Build & atest EuiccServiceTest
Change-Id: If127224ca7ca696c8eb512dc80c27f54e4f25b38
This commit is contained in:
Chen Xu
2022-02-09 20:34:37 -08:00
parent 58956e4afc
commit 3c22236cda
3 changed files with 41 additions and 5 deletions

View File

@@ -11065,7 +11065,8 @@ package android.service.euicc {
method public int encodeSmdxSubjectAndReasonCode(@Nullable String, @Nullable String);
method @CallSuper public android.os.IBinder onBind(android.content.Intent);
method public abstract int onDeleteSubscription(int, String);
method public android.service.euicc.DownloadSubscriptionResult onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean, @Nullable android.os.Bundle);
method @Deprecated public android.service.euicc.DownloadSubscriptionResult onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean, @Nullable android.os.Bundle);
method @NonNull public android.service.euicc.DownloadSubscriptionResult onDownloadSubscription(int, int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean, @NonNull android.os.Bundle);
method @Deprecated public int onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean);
method @Deprecated public abstract int onEraseSubscriptions(int);
method public int onEraseSubscriptions(int, @android.telephony.euicc.EuiccCardManager.ResetOption int);

View File

@@ -524,13 +524,47 @@ public abstract class EuiccService extends Service {
* defined in {@code RESOLVABLE_ERROR_}. A subclass should override this method. Otherwise,
* this method does nothing and returns null by default.
* @see android.telephony.euicc.EuiccManager#downloadSubscription
* @deprecated prefer {@link #onDownloadSubscription(int, int,
* DownloadableSubscription, boolean, boolean, Bundle)}
*/
@Deprecated
public DownloadSubscriptionResult onDownloadSubscription(int slotId,
@NonNull DownloadableSubscription subscription, boolean switchAfterDownload,
boolean forceDeactivateSim, @Nullable Bundle resolvedBundle) {
return null;
}
/**
* Download the given subscription.
*
* @param slotIndex Index of the SIM slot to use for the operation.
* @param portIndex Index of the port from the slot. portIndex is used when
* switchAfterDownload is set to {@code true}, otherwise download is port agnostic.
* @param subscription The subscription to download.
* @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 #RESULT_MUST_DEACTIVATE_SIM}
* should be returned to allow the user to consent to this operation first.
* @param resolvedBundle The bundle containing information on resolved errors. It can contain
* a string of confirmation code for the key {@link #EXTRA_RESOLUTION_CONFIRMATION_CODE},
* and a boolean for key {@link #EXTRA_RESOLUTION_ALLOW_POLICY_RULES} indicating whether
* the user allows profile policy rules or not.
* @return a DownloadSubscriptionResult instance including a result code, a resolvable errors
* bit map, and original the card Id. The result code may be one of the predefined
* {@code RESULT_} constants or any implementation-specific code starting with
* {@link #RESULT_FIRST_USER}. The resolvable error bit map can be either 0 or values
* defined in {@code RESOLVABLE_ERROR_}.
* @see android.telephony.euicc.EuiccManager#downloadSubscription
*/
@NonNull
public DownloadSubscriptionResult onDownloadSubscription(int slotIndex, int portIndex,
@NonNull DownloadableSubscription subscription, boolean switchAfterDownload,
boolean forceDeactivateSim, @NonNull Bundle resolvedBundle) {
// stub implementation, LPA needs to implement this
throw new UnsupportedOperationException("LPA must override onDownloadSubscription");
}
/**
* Download the given subscription.
*
@@ -701,7 +735,8 @@ public abstract class EuiccService extends Service {
*/
private class IEuiccServiceWrapper extends IEuiccService.Stub {
@Override
public void downloadSubscription(int slotId, DownloadableSubscription subscription,
public void downloadSubscription(int slotId, int portIndex,
DownloadableSubscription subscription,
boolean switchAfterDownload, boolean forceDeactivateSim, Bundle resolvedBundle,
IDownloadSubscriptionCallback callback) {
mExecutor.execute(new Runnable() {

View File

@@ -35,9 +35,9 @@ import android.os.Bundle;
/** @hide */
oneway interface IEuiccService {
void downloadSubscription(int slotId, in DownloadableSubscription subscription,
boolean switchAfterDownload, boolean forceDeactivateSim, in Bundle resolvedBundle,
in IDownloadSubscriptionCallback callback);
void downloadSubscription(int slotId, int portIndex, in DownloadableSubscription subscription,
boolean switchAfterDownload, boolean forceDeactivateSim, in Bundle resolvedBundle,
in IDownloadSubscriptionCallback callback);
void getDownloadableSubscriptionMetadata(int slotId, in DownloadableSubscription subscription,
boolean forceDeactivateSim, in IGetDownloadableSubscriptionMetadataCallback callback);
void getEid(int slotId, in IGetEidCallback callback);