Properly target the factory-reset broadcasts

Bug 34587823
Test: attempt factory reset from UI

Change-Id: I4ba65f4b7e07792b37e7587008ad0ab1bc6c1fb0
This commit is contained in:
Christopher Tate
2017-01-25 14:46:48 -08:00
committed by Chris Tate
parent 37326a6023
commit 1e99f0ce41
2 changed files with 3 additions and 0 deletions

View File

@@ -210,6 +210,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR);
intent.setPackage("android");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.putExtra(Intent.EXTRA_REASON, "CryptKeeper.MAX_FAILED_ATTEMPTS");
sendBroadcast(intent);
@@ -612,6 +613,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
public void onClick(View v) {
// Factory reset the device.
Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR);
intent.setPackage("android");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.putExtra(Intent.EXTRA_REASON,
"CryptKeeper.showFactoryReset() corrupt=" + corrupt);

View File

@@ -121,6 +121,7 @@ public class MasterClearConfirm extends OptionsMenuFragment {
private void doMasterClear() {
Intent intent = new Intent(Intent.ACTION_MASTER_CLEAR);
intent.setPackage("android");
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.putExtra(Intent.EXTRA_REASON, "MasterClearConfirm");
intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE, mEraseSdCard);