Restore from a previous full backup's tarfile

Usage:  adb restore [tarfilename]

Restores app data [and installs the apps if necessary from the backup
file] captured in a previous invocation of 'adb backup'.  The user
must explicitly acknowledge the action on-device before it is allowed
to proceed; this prevents any "invisible" pushes of content from the
host to the device.

Known issues:

* The settings databases and wallpaper are saved/restored, but lots
  of other system state is not yet captured in the full backup.  This
  means that for practical purposes this is usable for 3rd party
  apps at present but not for full-system cloning/imaging.

Change-Id: I0c748b645845e7c9178e30bf142857861a64efd3
This commit is contained in:
Christopher Tate 2011-05-18 16:28:19 -07:00
parent c507859dd8
commit 15e113033b

View File

@ -503,6 +503,16 @@ int write_tarfile(const String8& packageName, const String8& domain,
needExtended = true; needExtended = true;
} }
// Non-7bit-clean path also means needing pax extended format
if (!needExtended) {
for (size_t i = 0; i < filepath.length(); i++) {
if ((filepath[i] & 0x80) != 0) {
needExtended = true;
break;
}
}
}
int err = 0; int err = 0;
struct stat64 s; struct stat64 s;
if (lstat64(filepath.string(), &s) != 0) { if (lstat64(filepath.string(), &s) != 0) {