Properly target the factory-reset broadcasts
Bug 34587823
Test: attempt factory reset from UI
Change-Id: I4ba65f4b7e07792b37e7587008ad0ab1bc6c1fb0
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 49142d7..c2ea6ac 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -210,6 +210,7 @@
} 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 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);