summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jason parks <jparks@google.com> 2011-04-04 16:46:34 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2011-04-04 16:46:34 -0700
commitc5a229665dbea7572f991180388c8bbe992a3438 (patch)
treea4cb1ee95ce38c86d6fad2178ba0b97b88d654c0
parent77a1d4ae01aa2d927ba53121aab3babd45992cdc (diff)
parent5ee250aa744720c90b264966f9721cfb9d256e96 (diff)
am 5ee250aa: am 1d733625: am cca2f2f9: Merge "Send out a broadcast that the system is being factory reset." into gingerbread
* commit '5ee250aa744720c90b264966f9721cfb9d256e96': Send out a broadcast that the system is being factory reset.
-rw-r--r--core/java/android/os/RecoverySystem.java25
-rw-r--r--core/res/AndroidManifest.xml1
2 files changed, 21 insertions, 5 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 4991914204d9..c1dd9119e4cc 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 348ded7aaead..2a4d1b23332b 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -57,6 +57,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" />