diff options
author | Jason parks <jparks@google.com> | 2011-03-14 15:23:31 -0500 |
---|---|---|
committer | Jason parks <jparks@google.com> | 2011-03-16 09:29:47 -0500 |
commit | 4ca74dc4c2e0c68803e777cf47ed8e01b8e8444e (patch) | |
tree | e71b1305d45e6343ab1c575a6a90d72cf0a721cb /core | |
parent | 68f66b945e7a69549689becd2e656d9056f1e7f5 (diff) | |
download | frameworks_base-4ca74dc4c2e0c68803e777cf47ed8e01b8e8444e.zip frameworks_base-4ca74dc4c2e0c68803e777cf47ed8e01b8e8444e.tar.gz frameworks_base-4ca74dc4c2e0c68803e777cf47ed8e01b8e8444e.tar.bz2 |
Send out a broadcast that the system is being
factory reset.
Change-Id: I339b7ce58cb3f48316103be49b582d4f7e9b63bf
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/os/RecoverySystem.java | 25 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 1 |
2 files changed, 21 insertions, 5 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 6d19f41..74b4fcb 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -16,6 +16,11 @@ package android.os; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileNotFoundException; @@ -37,9 +42,6 @@ import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import android.content.Context; -import android.util.Log; - import org.apache.harmony.security.asn1.BerInputStream; import org.apache.harmony.security.pkcs7.ContentInfo; import org.apache.harmony.security.pkcs7.SignedData; @@ -336,8 +338,21 @@ public class RecoverySystem { * @throws IOException if writing the recovery command file * fails, or if the reboot itself fails. */ - public static void rebootWipeUserData(Context context) - throws IOException { + public static void rebootWipeUserData(Context context) throws IOException { + final ConditionVariable condition = new ConditionVariable(); + + Intent intent = new Intent("android.intent.action.MASTER_CLEAR_NOTIFICATION"); + context.sendOrderedBroadcast(intent, android.Manifest.permission.MASTER_CLEAR, + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + condition.open(); + } + }, null, 0, null, null); + + // Block until the ordered broadcast has completed. + condition.block(); + bootCommand(context, "--wipe_data"); } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index c8295d7..301de2c 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -55,6 +55,7 @@ <protected-broadcast android:name="android.intent.action.NEW_OUTGOING_CALL" /> <protected-broadcast android:name="android.intent.action.REBOOT" /> <protected-broadcast android:name="android.intent.action.DOCK_EVENT" /> + <protected-broadcast android:name="android.intent.action.MASTER_CLEAR_NOTIFICATION" /> <protected-broadcast android:name="android.app.action.ENTER_CAR_MODE" /> <protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" /> |