Merge "[Settings] Crash when resetting downloaded eSIM" into sc-qpr1-dev am: 74c4ca00e1

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16039954

Change-Id: I0c1be8f12ae5421980cb6e204c24b34b5b5ff191
diff --git a/src/com/android/settings/network/EraseEuiccDataDialogFragment.java b/src/com/android/settings/network/EraseEuiccDataDialogFragment.java
index 819d3b1..2c3847c 100644
--- a/src/com/android/settings/network/EraseEuiccDataDialogFragment.java
+++ b/src/com/android/settings/network/EraseEuiccDataDialogFragment.java
@@ -19,6 +19,7 @@
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.settings.SettingsEnums;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -75,23 +76,24 @@
         }
 
         if (which == DialogInterface.BUTTON_POSITIVE) {
-            if (ConfirmationSimDeletionPredicate.getSingleton().test(getContext())) {
+            Context context = getContext();
+            if (ConfirmationSimDeletionPredicate.getSingleton().test(context)) {
                 // 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());
+                WifiDppUtils.showLockScreen(context, () -> runAsyncWipe(context));
             } else {
-                runAsyncWipe();
+                runAsyncWipe(context);
             }
         }
     }
 
-    private void runAsyncWipe() {
+    private void runAsyncWipe(Context context) {
         AsyncTask.execute(new Runnable() {
             @Override
             public void run() {
                 RecoverySystem.wipeEuiccData(
-                        getContext(), PACKAGE_NAME_EUICC_DATA_MANAGEMENT_CALLBACK);
+                        context, PACKAGE_NAME_EUICC_DATA_MANAGEMENT_CALLBACK);
             }
         });
     }