From 240c7d2d1fb2944ee6a6f1dee41c7bbd766f8f0d Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 3 Oct 2011 18:13:44 -0700 Subject: Add -nosystem flag to adb backup This makes it easy to back up everything that belongs to 3rd party apps, but nothing that comes with the system per se. If any system packages are explicitly named on the command line they will be included in the backup even if -nosystem was passed. So, for example, this will back up all 3rd party apps as well as system settings, but nothing else belonging to system-deployed apps: adb backup -all -nosystem com.android.provider.settings Bug 5361503 Change-Id: Iebe04b7d7027ca58b9f55e8eb7f219d6cca69269 --- cmds/bu/src/com/android/commands/bu/Backup.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmds/bu/src/com') diff --git a/cmds/bu/src/com/android/commands/bu/Backup.java b/cmds/bu/src/com/android/commands/bu/Backup.java index 4c4bf98..046ccca 100644 --- a/cmds/bu/src/com/android/commands/bu/Backup.java +++ b/cmds/bu/src/com/android/commands/bu/Backup.java @@ -66,6 +66,7 @@ public final class Backup { boolean saveApks = false; boolean saveShared = false; boolean doEverything = false; + boolean allIncludesSystem = true; String arg; while ((arg = nextArg()) != null) { @@ -78,6 +79,10 @@ public final class Backup { saveShared = true; } else if ("-noshared".equals(arg)) { saveShared = false; + } else if ("-system".equals(arg)) { + allIncludesSystem = true; + } else if ("-nosystem".equals(arg)) { + allIncludesSystem = false; } else if ("-all".equals(arg)) { doEverything = true; } else { @@ -102,7 +107,7 @@ public final class Backup { try { ParcelFileDescriptor fd = ParcelFileDescriptor.adoptFd(socketFd); String[] packArray = new String[packages.size()]; - mBackupManager.fullBackup(fd, saveApks, saveShared, doEverything, + mBackupManager.fullBackup(fd, saveApks, saveShared, doEverything, allIncludesSystem, packages.toArray(packArray)); } catch (RemoteException e) { Log.e(TAG, "Unable to invoke backup manager for backup"); -- cgit v1.1