diff options
| author | 2016-06-13 16:43:44 +0000 | |
|---|---|---|
| committer | 2016-06-13 16:43:46 +0000 | |
| commit | 9aa66d57c6a8440b0280f31f94b5e3c05980e6a2 (patch) | |
| tree | 4192d512240a9d349f31546ada974fbeb7cbb09f | |
| parent | 5b8f5fd38be1ea9aa3202f747d14f3b8f4b61c01 (diff) | |
| parent | 1327a97a076d67f296f338653678cc383ebfa002 (diff) | |
Merge "Add RecoverySystem.rebootWipeAb() system API." into nyc-mr1-dev
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 98b66c08ab52..deae8f26c0ec 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -31652,6 +31652,7 @@ package android.os { method public static void installPackage(android.content.Context, java.io.File, boolean) throws java.io.IOException; method public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener, android.os.Handler) throws java.io.IOException; method public static void processPackage(android.content.Context, java.io.File, android.os.RecoverySystem.ProgressListener) throws java.io.IOException; + method public static void rebootWipeAb(android.content.Context, java.io.File, java.lang.String) throws java.io.IOException; method public static void rebootWipeCache(android.content.Context) throws java.io.IOException; method public static void rebootWipeUserData(android.content.Context) throws java.io.IOException; method public static void scheduleUpdateOnBoot(android.content.Context, java.io.File) throws java.io.IOException; diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index cc273580bc21..b3cc4385002f 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -662,6 +662,31 @@ public class RecoverySystem { } /** + * Reboot into recovery and wipe the A/B device. + * + * @param Context the Context to use. + * @param packageFile the wipe package to be applied. + * @param reason the reason to wipe. + * + * @throws IOException if something goes wrong. + * + * @hide + */ + @SystemApi + public static void rebootWipeAb(Context context, File packageFile, String reason) + throws IOException { + String reasonArg = null; + if (!TextUtils.isEmpty(reason)) { + reasonArg = "--reason=" + sanitizeArg(reason); + } + + final String filename = packageFile.getCanonicalPath(); + final String filenameArg = "--wipe_package=" + filename; + final String localeArg = "--locale=" + Locale.getDefault().toString(); + bootCommand(context, "--wipe_ab", filenameArg, reasonArg, localeArg); + } + + /** * Reboot into the recovery system with the supplied argument. * @param args to pass to the recovery utility. * @throws IOException if something goes wrong. |