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

Commit f4577a5c authored by Qingxi Li's avatar Qingxi Li
Browse files

Remove all the implementation for keep eSIM profile during FDR

When we show the option to users to allow them decide whether they want
to keep eSIM profiles during FDR, we remove erasing eSIM profiles from
CompleteBootService. So there is no need to call
EuiccManager#retainSubscriptionsForFactoryReset again. And when we don't
show this option to users, we will always erase eSIM profiles with
isWipeEuicc equals to true.

Bug: 67500470
Test: E2E
Change-Id: Ide4ee5fbfd4b2aadc78071f8ecb8e0424a37db44
parent 96e4f86c
Loading
Loading
Loading
Loading
+10 −31
Original line number Diff line number Diff line
@@ -755,7 +755,9 @@ public class RecoverySystem {
        // Block until the ordered broadcast has completed.
        condition.block();

        wipeEuiccData(context, wipeEuicc, PACKAGE_NAME_WIPING_EUICC_DATA_CALLBACK);
        if (wipeEuicc) {
            wipeEuiccData(context, PACKAGE_NAME_WIPING_EUICC_DATA_CALLBACK);
        }

        String shutdownArg = null;
        if (shutdown) {
@@ -774,13 +776,11 @@ public class RecoverySystem {
    /**
     * Returns whether wipe Euicc data successfully or not.
     *
     * @param isWipeEuicc whether we want to wipe Euicc data or not
     * @param packageName the package name of the caller app.
     *
     * @hide
     */
    public static boolean wipeEuiccData(
            Context context, final boolean isWipeEuicc, final String packageName) {
    public static boolean wipeEuiccData(Context context, final String packageName) {
        ContentResolver cr = context.getContentResolver();
        if (Settings.Global.getInt(cr, Settings.Global.EUICC_PROVISIONED, 0) == 0) {
            // If the eUICC isn't provisioned, there's no reason to either wipe or retain profiles,
@@ -802,19 +802,10 @@ public class RecoverySystem {
                        if (getResultCode() != EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_OK) {
                            int detailedCode = intent.getIntExtra(
                                    EuiccManager.EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE, 0);
                            if (isWipeEuicc) {
                            Log.e(TAG, "Error wiping euicc data, Detailed code = "
                                    + detailedCode);
                        } else {
                                Log.e(TAG, "Error retaining euicc data, Detailed code = "
                                        + detailedCode);
                            }
                        } else {
                            if (isWipeEuicc) {
                            Log.d(TAG, "Successfully wiped euicc data.");
                            } else {
                                Log.d(TAG, "Successfully retained euicc data.");
                            }
                            wipingSucceeded.set(true /* newValue */);
                        }
                        euiccFactoryResetLatch.countDown();
@@ -833,11 +824,7 @@ public class RecoverySystem {
            Handler euiccHandler = new Handler(euiccHandlerThread.getLooper());
            context.getApplicationContext()
                    .registerReceiver(euiccWipeFinishReceiver, filterConsent, null, euiccHandler);
            if (isWipeEuicc) {
            euiccManager.eraseSubscriptions(callbackIntent);
            } else {
                euiccManager.retainSubscriptionsForFactoryReset(callbackIntent);
            }
            try {
                long waitingTimeMillis = Settings.Global.getLong(
                        context.getContentResolver(),
@@ -849,20 +836,12 @@ public class RecoverySystem {
                    waitingTimeMillis = MAX_EUICC_FACTORY_RESET_TIMEOUT_MILLIS;
                }
                if (!euiccFactoryResetLatch.await(waitingTimeMillis, TimeUnit.MILLISECONDS)) {
                    if (isWipeEuicc) {
                    Log.e(TAG, "Timeout wiping eUICC data.");
                    } else {
                        Log.e(TAG, "Timeout retaining eUICC data.");
                    }
                    return false;
                }
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                if (isWipeEuicc) {
                Log.e(TAG, "Wiping eUICC data interrupted", e);
                } else {
                    Log.e(TAG, "Retaining eUICC data interrupted", e);
                }
                return false;
            } finally {
                context.getApplicationContext().unregisterReceiver(euiccWipeFinishReceiver);