diff options
author | Christopher Tate <ctate@google.com> | 2014-06-03 17:20:07 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2014-06-15 17:35:33 -0700 |
commit | 9ff53a7100b1a40f5d2df3eb19a2f3f2fff39a46 (patch) | |
tree | 162c23a51e116f9506e7d6801236dd2e2c8f3788 /cmds | |
parent | ad60891a6ecaf2a5815677b33e96afe7f49ee113 (diff) | |
download | frameworks_base-9ff53a7100b1a40f5d2df3eb19a2f3f2fff39a46.zip frameworks_base-9ff53a7100b1a40f5d2df3eb19a2f3f2fff39a46.tar.gz frameworks_base-9ff53a7100b1a40f5d2df3eb19a2f3f2fff39a46.tar.bz2 |
Implement full data backup through transport
Currently no timed/scheduled full-data backup operations are
performed by the OS, but the plumbing is now in place and can
be tested using 'adb shell bmgr fullbackup pkg [pkg2 pkg3 ...]'.
The LocalTransport test transport implementation has been augmented
to support the new full-data backup API as well.
In addition, 'adb backup' now takes the -compress/-nocompress
command line options to control whether the resulting archive is
compressed before leaving the device. Previously the archive was
always compressed. (The default is still to compress, as it will
usually reduce the archive size considerably.)
Internally, the core implementation of gathering the full backup
data stream from the target application has been refactored into
an "engine" component that is shared by both 'adb backup' and the
transport-oriented full backup task. The archive file header
generation, encryption, and compression logic are now factored out
of the engine itself instead of being hardwired into the data
handling.
Bug 15329632
Change-Id: I4a044faa4070d684ef457bd3e11771198cdf557c
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java | 21 | ||||
-rw-r--r-- | cmds/bu/src/com/android/commands/bu/Backup.java | 7 |
2 files changed, 27 insertions, 1 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java index db3d8bb..d1bea2e 100644 --- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java @@ -23,6 +23,7 @@ import android.app.backup.IRestoreSession; import android.os.RemoteException; import android.os.ServiceManager; +import java.util.ArrayList; import java.util.HashSet; public final class Bmgr { @@ -102,6 +103,11 @@ public final class Bmgr { return; } + if ("fullbackup".equals(op)) { + doFullTransportBackup(); + return; + } + System.err.println("Unknown command"); showUsage(); } @@ -165,6 +171,21 @@ public final class Bmgr { } } + private void doFullTransportBackup() { + System.out.println("Performing full transport backup"); + + String pkg; + while ((pkg = nextArg()) != null) { + System.out.println(" Package " + pkg + " ..."); + try { + mBmgr.fullTransportBackup(new String[] { pkg }); + } catch (RemoteException e) { + System.err.println(e.toString()); + System.err.println(BMGR_NOT_RUNNING_ERR); + } + } + } + private void doTransport() { try { String which = nextArg(); diff --git a/cmds/bu/src/com/android/commands/bu/Backup.java b/cmds/bu/src/com/android/commands/bu/Backup.java index 4503726..ffc0f87 100644 --- a/cmds/bu/src/com/android/commands/bu/Backup.java +++ b/cmds/bu/src/com/android/commands/bu/Backup.java @@ -69,6 +69,7 @@ public final class Backup { boolean doEverything = false; boolean doWidgets = false; boolean allIncludesSystem = true; + boolean doCompress = true; String arg; while ((arg = nextArg()) != null) { @@ -95,6 +96,10 @@ public final class Backup { doWidgets = false; } else if ("-all".equals(arg)) { doEverything = true; + } else if ("-compress".equals(arg)) { + doCompress = true; + } else if ("-nocompress".equals(arg)) { + doCompress = false; } else { Log.w(TAG, "Unknown backup flag " + arg); continue; @@ -119,7 +124,7 @@ public final class Backup { fd = ParcelFileDescriptor.adoptFd(socketFd); String[] packArray = new String[packages.size()]; mBackupManager.fullBackup(fd, saveApks, saveObbs, saveShared, doWidgets, - doEverything, allIncludesSystem, packages.toArray(packArray)); + doEverything, allIncludesSystem, doCompress, packages.toArray(packArray)); } catch (RemoteException e) { Log.e(TAG, "Unable to invoke backup manager for backup"); } finally { |