From 9d5f8e11e11e93fbf0d9cbcbb68b7b0062695e5d Mon Sep 17 00:00:00 2001 From: Johan Toras Halseth Date: Tue, 11 Apr 2017 11:49:34 +0100 Subject: [PATCH] Add helptext to bu command. bu is used by adb backup/restore, but since flags passed to these adb commands are just forwarded to bu, we have no guarantee that the help text for adb shows an up to date description of what bu can do. We therefore add the help text to bu, such that it is easier to keep in sync. Test: adb shell bu help Bug: 36170696 Change-Id: I8155d17b5c942ce19b981f4a157e7cc7810490ce --- cmds/bu/src/com/android/commands/bu/Backup.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmds/bu/src/com/android/commands/bu/Backup.java b/cmds/bu/src/com/android/commands/bu/Backup.java index ce114fd02475f..345895b794a39 100644 --- a/cmds/bu/src/com/android/commands/bu/Backup.java +++ b/cmds/bu/src/com/android/commands/bu/Backup.java @@ -57,7 +57,7 @@ public final class Backup { } else if (arg.equals("restore")) { doRestore(OsConstants.STDIN_FILENO); } else { - Log.e(TAG, "Invalid operation '" + arg + "'"); + showUsage(); } } @@ -158,6 +158,21 @@ public final class Backup { } } + private static void showUsage() { + System.err.println(" backup [-f FILE] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all]"); + System.err.println(" [-system|-nosystem] [-keyvalue|-nokeyvalue] [PACKAGE...]"); + System.err.println(" write an archive of the device's data to FILE [default=backup.adb]"); + System.err.println(" package list optional if -all/-shared are supplied"); + System.err.println(" -apk/-noapk: do/don't back up .apk files (default -noapk)"); + System.err.println(" -obb/-noobb: do/don't back up .obb files (default -noobb)"); + System.err.println(" -shared|-noshared: do/don't back up shared storage (default -noshared)"); + System.err.println(" -all: back up all installed applications"); + System.err.println(" -system|-nosystem: include system apps in -all (default -system)"); + System.err.println(" -keyvalue|-nokeyvalue: include apps that perform key/value backups."); + System.err.println(" (default -nokeyvalue)"); + System.err.println(" restore FILE restore device contents from FILE"); + } + private String nextArg() { if (mNextArg >= mArgs.length) { return null;