summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJason parks <jparks@google.com>2011-03-30 08:17:53 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-30 08:17:53 -0700
commitcca2f2f987ab772a4bae3176df7259f59d6502ce (patch)
tree8027043034b345923002ce4c2eea60270d214d94 /core
parent87805ca3a477e165891baa18efe5239a70d11bc9 (diff)
parent4ca74dc4c2e0c68803e777cf47ed8e01b8e8444e (diff)
downloadframeworks_base-cca2f2f987ab772a4bae3176df7259f59d6502ce.zip
frameworks_base-cca2f2f987ab772a4bae3176df7259f59d6502ce.tar.gz
frameworks_base-cca2f2f987ab772a4bae3176df7259f59d6502ce.tar.bz2
Merge "Send out a broadcast that the system is being factory reset." into gingerbread
Diffstat (limited to 'core')
-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 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 c6ddb56..c582eee 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" />