diff options
| author | Tao Bao <tbao@google.com> | 2016-06-13 16:43:44 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-06-13 16:43:46 +0000 |
| commit | 9aa66d57c6a8440b0280f31f94b5e3c05980e6a2 (patch) | |
| tree | 4192d512240a9d349f31546ada974fbeb7cbb09f /core/java/android/os/RecoverySystem.java | |
| parent | 5b8f5fd38be1ea9aa3202f747d14f3b8f4b61c01 (diff) | |
| parent | 1327a97a076d67f296f338653678cc383ebfa002 (diff) | |
Merge "Add RecoverySystem.rebootWipeAb() system API." into nyc-mr1-dev
Diffstat (limited to 'core/java/android/os/RecoverySystem.java')
| -rw-r--r-- | core/java/android/os/RecoverySystem.java | 25 |
1 files changed, 25 insertions, 0 deletions
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. |
