Merge "Send out a broadcast that the system is being factory reset." into gingerbread
This commit is contained in:
@@ -16,6 +16,11 @@
|
|||||||
|
|
||||||
package android.os;
|
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.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -37,9 +42,6 @@ import java.util.List;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
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.asn1.BerInputStream;
|
||||||
import org.apache.harmony.security.pkcs7.ContentInfo;
|
import org.apache.harmony.security.pkcs7.ContentInfo;
|
||||||
import org.apache.harmony.security.pkcs7.SignedData;
|
import org.apache.harmony.security.pkcs7.SignedData;
|
||||||
@@ -336,8 +338,21 @@ public class RecoverySystem {
|
|||||||
* @throws IOException if writing the recovery command file
|
* @throws IOException if writing the recovery command file
|
||||||
* fails, or if the reboot itself fails.
|
* fails, or if the reboot itself fails.
|
||||||
*/
|
*/
|
||||||
public static void rebootWipeUserData(Context context)
|
public static void rebootWipeUserData(Context context) throws IOException {
|
||||||
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");
|
bootCommand(context, "--wipe_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
<protected-broadcast android:name="android.intent.action.NEW_OUTGOING_CALL" />
|
<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.REBOOT" />
|
||||||
<protected-broadcast android:name="android.intent.action.DOCK_EVENT" />
|
<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.ENTER_CAR_MODE" />
|
||||||
<protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" />
|
<protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" />
|
||||||
|
|||||||
Reference in New Issue
Block a user