Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca01a7ee authored by Peter Wang's avatar Peter Wang Committed by Gerrit Code Review
Browse files

Merge "Add EuiccCardManager.ResetOption to eraseSubscriptions"

parents 149ad21f 2ab852d4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -6497,7 +6497,8 @@ package android.service.euicc {
    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 int onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean);
    method public abstract int onEraseSubscriptions(int);
    method @Deprecated public abstract int onEraseSubscriptions(int);
    method public int onEraseSubscriptionsWithOptions(int, @android.telephony.euicc.EuiccCardManager.ResetOption int);
    method public abstract android.service.euicc.GetDefaultDownloadableSubscriptionListResult onGetDefaultDownloadableSubscriptionList(int, boolean);
    method public abstract android.service.euicc.GetDownloadableSubscriptionMetadataResult onGetDownloadableSubscriptionMetadata(int, android.telephony.euicc.DownloadableSubscription, boolean);
    method public abstract String onGetEid(int);
@@ -8537,7 +8538,8 @@ package android.telephony.euicc {
  public class EuiccManager {
    method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void continueOperation(android.content.Intent, android.os.Bundle);
    method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptions(android.app.PendingIntent);
    method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptions(@NonNull android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptionsWithOptions(@android.telephony.euicc.EuiccCardManager.ResetOption int, @NonNull android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent);
    method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public int getOtaStatus();
+41 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package android.service.euicc;

import static android.telephony.euicc.EuiccCardManager.ResetOption;

import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -503,7 +505,7 @@ public abstract class EuiccService extends Service {
            String nickname);

    /**
     * Erase all of the subscriptions on the device.
     * Erase all operational subscriptions on the device.
     *
     * <p>This is intended to be used for device resets. As such, the reset should be performed even
     * if an active SIM must be deactivated in order to access the eUICC.
@@ -512,9 +514,30 @@ public abstract class EuiccService extends Service {
     * @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
     *
     * @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
     * and use @link{onEraseSubscriptionsWithOptions} instead
     */
    @Deprecated
    public abstract int onEraseSubscriptions(int slotId);

    /**
     * Erase specific subscriptions on the device.
     *
     * <p>This is intended to be used for device resets. As such, the reset should be performed even
     * if an active SIM must be deactivated in order to access the eUICC.
     *
     * @param slotIndex index of the SIM slot to use for the operation.
     * @param options flag for specific group of subscriptions to erase
     * @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#eraseSubscriptionsWithOptions
     */
    public int onEraseSubscriptionsWithOptions(int slotIndex, @ResetOption int options) {
        throw new UnsupportedOperationException(
                "This method must be overridden to enable the ResetOption parameter");
    }

    /**
     * Ensure that subscriptions will be retained on the next factory reset.
     *
@@ -750,6 +773,23 @@ public abstract class EuiccService extends Service {
            });
        }

        @Override
        public void eraseSubscriptionsWithOptions(
                int slotIndex, @ResetOption int options, IEraseSubscriptionsCallback callback) {
            mExecutor.execute(new Runnable() {
                @Override
                public void run() {
                    int result = EuiccService.this.onEraseSubscriptionsWithOptions(
                            slotIndex, options);
                    try {
                        callback.onComplete(result);
                    } catch (RemoteException e) {
                        // Can't communicate with the phone process; ignore.
                    }
                }
            });
        }

        @Override
        public void retainSubscriptionsForFactoryReset(int slotId,
                IRetainSubscriptionsForFactoryResetCallback callback) {
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ oneway interface IEuiccService {
    void updateSubscriptionNickname(int slotId, String iccid, String nickname,
            in IUpdateSubscriptionNicknameCallback callback);
    void eraseSubscriptions(int slotId, in IEraseSubscriptionsCallback callback);
    void eraseSubscriptionsWithOptions(
            int slotIndex, int options, in IEraseSubscriptionsCallback callback);
    void retainSubscriptionsForFactoryReset(
            int slotId, in IRetainSubscriptionsForFactoryResetCallback callback);
}
 No newline at end of file
+34 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccCardManager.ResetOption;

import com.android.internal.telephony.euicc.IEuiccController;

@@ -821,17 +822,22 @@ public class EuiccManager {
    }

    /**
     * Erase all subscriptions and reset the eUICC.
     * Erase all operational subscriptions and reset the eUICC.
     *
     * <p>Requires that the calling app has the
     * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
     *
     * @param callbackIntent a PendingIntent to launch when the operation completes.
     *
     * @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
     * and use @link{eraseSubscriptionsWithOptions} instead
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
    public void eraseSubscriptions(PendingIntent callbackIntent) {
    @Deprecated
    public void eraseSubscriptions(@NonNull PendingIntent callbackIntent) {
        if (!isEnabled()) {
            sendUnavailableError(callbackIntent);
            return;
@@ -843,6 +849,32 @@ public class EuiccManager {
        }
    }

    /**
     * Erase all specific subscriptions and reset the eUICC.
     *
     * <p>Requires that the calling app has the
     * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
     *
     * @param options flag indicating specific set of subscriptions to erase
     * @param callbackIntent a PendingIntent to launch when the operation completes.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
    public void eraseSubscriptionsWithOptions(
            @ResetOption int options, @NonNull PendingIntent callbackIntent) {
        if (!isEnabled()) {
            sendUnavailableError(callbackIntent);
            return;
        }
        try {
            getIEuiccController().eraseSubscriptionsWithOptions(mCardId, options, callbackIntent);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Ensure that subscriptions will be retained on the next factory reset.
     *
+2 −0
Original line number Diff line number Diff line
@@ -44,5 +44,7 @@ interface IEuiccController {
    oneway void updateSubscriptionNickname(int cardId, int subscriptionId, String nickname,
        String callingPackage, in PendingIntent callbackIntent);
    oneway void eraseSubscriptions(int cardId, in PendingIntent callbackIntent);
    oneway void eraseSubscriptionsWithOptions(
        int cardId, int options, in PendingIntent callbackIntent);
    oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent);
}