[Settings] Adopt comfirm SIM deletion to euicc reset UI

There's an "Erase downloaded SIMs" option within reset options UI.
When reset EUICC, eSIM profile might get removed.
There's a security feature "Confirm SIM deletion" need to be applied in
this case.

Bug: 194145231
Test: local
Change-Id: I1798dfe347be7d0610a12fb79f103efece2ab240
(cherry picked from commit ebca15a861)
This commit is contained in:
Bonian Chen
2021-09-30 10:23:17 +08:00
parent 396939a577
commit 71818bdf15
3 changed files with 89 additions and 8 deletions

View File

@@ -32,7 +32,9 @@ import androidx.fragment.app.FragmentManager;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.network.helper.ConfirmationSimDeletionPredicate;
import com.android.settings.system.ResetDashboardFragment;
import com.android.settings.wifi.dpp.WifiDppUtils;
public class EraseEuiccDataDialogFragment extends InstrumentedDialogFragment implements
DialogInterface.OnClickListener {
@@ -73,13 +75,24 @@ public class EraseEuiccDataDialogFragment extends InstrumentedDialogFragment imp
}
if (which == DialogInterface.BUTTON_POSITIVE) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
RecoverySystem.wipeEuiccData(
getContext(), PACKAGE_NAME_EUICC_DATA_MANAGEMENT_CALLBACK);
}
});
if (ConfirmationSimDeletionPredicate.getSingleton().test(getContext())) {
// Create a "verify it's you" verification over keyguard
// when "erase" button been pressed.
// This might protect from erasing by some automation process.
WifiDppUtils.showLockScreen(getContext(), () -> runAsyncWipe());
} else {
runAsyncWipe();
}
}
}
private void runAsyncWipe() {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
RecoverySystem.wipeEuiccData(
getContext(), PACKAGE_NAME_EUICC_DATA_MANAGEMENT_CALLBACK);
}
});
}
}