summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pawan Wagh <waghpawan@google.com> 2024-03-08 06:59:49 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-03-08 06:59:49 +0000
commit4bb9522cc96bc736484830aec2c439c82c98c66f (patch)
treef38d20038510165db25b89ec3c1495de79ace268
parentdfa403903b8ed3f085b45c94a1ab779eaf826f0d (diff)
parenta0ae2f940e855354bd9cfe3b8cec8dd080586d33 (diff)
Merge "Add hidden API to wipe device with command" into main
-rw-r--r--core/java/android/os/RecoverySystem.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 07f76904988a..f52903a14ed8 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -1259,6 +1259,24 @@ public class RecoverySystem {
}
/**
+ * Reboot into recovery and wipe the data partition with ext4
+ *
+ * @throws IOException if something goes wrong.
+ *
+ * @hide
+ */
+ @RequiresPermission(allOf = {
+ android.Manifest.permission.RECOVERY,
+ android.Manifest.permission.REBOOT
+ })
+ public void wipePartitionToExt4()
+ throws IOException {
+ // Reformat /data partition with ext4
+ String command = "--wipe_data\n--reformat_data=ext4";
+ rebootRecoveryWithCommand(command);
+ }
+
+ /**
* Reboot into the recovery system with the supplied argument.
* @param args to pass to the recovery utility.
* @throws IOException if something goes wrong.