add option to shutdown after factory reset
Add a new hidden method to recovery system to trigger a factory reset
followed by a shutdown, rather than a reboot back to the regular
system. Use this flag when the MASTER_CLEAR intent is broadcast with
a boolean extra "shutdown" set to true.
Change-Id: I2ceb25b715d9f0ef492a75b3d287d1e17cec89ef
diff --git a/services/core/java/com/android/server/MasterClearReceiver.java b/services/core/java/com/android/server/MasterClearReceiver.java
index 86f57d1..e570b0b 100644
--- a/services/core/java/com/android/server/MasterClearReceiver.java
+++ b/services/core/java/com/android/server/MasterClearReceiver.java
@@ -37,13 +37,15 @@
}
}
+ final boolean shutdown = intent.getBooleanExtra("shutdown", false);
+
Slog.w(TAG, "!!! FACTORY RESET !!!");
// The reboot call is blocking, so we need to do it on another thread.
Thread thr = new Thread("Reboot") {
@Override
public void run() {
try {
- RecoverySystem.rebootWipeUserData(context);
+ RecoverySystem.rebootWipeUserData(context, shutdown);
Log.wtf(TAG, "Still running after master clear?!");
} catch (IOException e) {
Slog.e(TAG, "Can't perform master clear/factory reset", e);