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

Commit 72d2fd0e authored by Chip Fukuhara's avatar Chip Fukuhara Committed by Android (Google) Code Review
Browse files

Merge "Update factory reset dialog to new UX spec" into main

parents a5cb102c a736904f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -6545,6 +6545,14 @@ public class Intent implements Parcelable, Cloneable {
    @SystemApi
    public static final String EXTRA_REASON = "android.intent.extra.REASON";
    /**
     * Intent extra: Whether to show the wipe progress UI or to skip it.
     *
     * <p>Type: boolean
     * @hide
     */
    public static final String EXTRA_SHOW_WIPE_PROGRESS = "android.intent.extra.SHOW_WIPE_PROGRESS";
    /**
     * {@hide}
     * This extra will be send together with {@link #ACTION_FACTORY_RESET}
+18 −7
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class MasterClearReceiver extends BroadcastReceiver {
    private static final String TAG = "MasterClear";
    private boolean mWipeExternalStorage;
    private boolean mWipeEsims;
    private boolean mShowWipeProgress = true;

    @Override
    public void onReceive(final Context context, final Intent intent) {
@@ -77,8 +78,12 @@ public class MasterClearReceiver extends BroadcastReceiver {
            return;
        }

        final boolean shutdown = intent.getBooleanExtra("shutdown", false);
        final String reason = intent.getStringExtra(Intent.EXTRA_REASON);

        // Factory reset dialog has its own UI for the reset process, so suppress ours if indicated.
        mShowWipeProgress = intent.getBooleanExtra(Intent.EXTRA_SHOW_WIPE_PROGRESS, true);

        final boolean shutdown = intent.getBooleanExtra("shutdown", false);
        mWipeExternalStorage = intent.getBooleanExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, false);
        mWipeEsims = intent.getBooleanExtra(Intent.EXTRA_WIPE_ESIMS, false);
        final boolean forceWipe = intent.getBooleanExtra(Intent.EXTRA_FORCE_MASTER_CLEAR, false)
@@ -190,16 +195,20 @@ public class MasterClearReceiver extends BroadcastReceiver {
        public WipeDataTask(Context context, Thread chainedTask) {
            mContext = context;
            mChainedTask = chainedTask;
            mProgressDialog = new ProgressDialog(context, R.style.Theme_DeviceDefault_System);
            mProgressDialog = mShowWipeProgress
                    ? new ProgressDialog(context, R.style.Theme_DeviceDefault_System)
                    : null;
        }

        @Override
        protected void onPreExecute() {
            if (mProgressDialog != null) {
                mProgressDialog.setIndeterminate(true);
                mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
                mProgressDialog.setMessage(mContext.getText(R.string.progress_erasing));
                mProgressDialog.show();
            }
        }

        @Override
        protected Void doInBackground(Void... params) {
@@ -214,7 +223,9 @@ public class MasterClearReceiver extends BroadcastReceiver {

        @Override
        protected void onPostExecute(Void result) {
            if (mProgressDialog != null && mProgressDialog.isShowing()) {
                mProgressDialog.dismiss();
            }
            mChainedTask.start();
        }