Update factory reset dialog to new UX spec

This is part of an upstreaming change for ag/18193725, which is being
split out because of its separate logic from the rest of the UX updates.
The commit message of that CL is copied below for reference.

- This change modifies the system progress spinner
(indeterminate/horizontal) for use on w3.

spec: https://docs.google.com/presentation/d/1YqqNzmgW6C6-zZJdhE3zTvxPe24BBn66FLYalpSgww0/edit#slide=id.gdea00a2fd1_0_169
video: https://drive.google.com/file/d/1hZzk-UBx7DOx5W7282_nB-5nDb5ppDxb/view?usp=sharing&resourcekey=0-eD2vvlCeyYhdF5sG2AwSmQ

Note that UI makes use of system color attributes:
- colorControlNormal (spinner)
- colorProgressBackgroundNormal (track)

Bug: 194441833
Bug: 192470870
Bug: 192470222

Test: manual check
      - Settings > System > Disconnect & Reset
      - Power > Shutdown
      - Power > Restart

Change-Id: I489dce4a54505738654610b6c7c1666ecbc415fc

Upstreaming-Bug: b/272532971
Change-Id: Iad1a30e883a01aad381b6825d3450ab5794d5558
This commit is contained in:
Todd Lee
2021-09-02 09:17:19 -04:00
committed by Chip Fukuhara
parent 899d533b9b
commit a736904f49
2 changed files with 26 additions and 7 deletions

View File

@@ -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}

View File

@@ -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,15 +195,19 @@ 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() {
mProgressDialog.setIndeterminate(true);
mProgressDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mProgressDialog.setMessage(mContext.getText(R.string.progress_erasing));
mProgressDialog.show();
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
@@ -214,7 +223,9 @@ public class MasterClearReceiver extends BroadcastReceiver {
@Override
protected void onPostExecute(Void result) {
mProgressDialog.dismiss();
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
mChainedTask.start();
}