diff options
author | Christopher Tate <ctate@google.com> | 2013-02-14 16:55:46 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2013-02-14 18:46:53 -0800 |
commit | 416c39e8d48048fa4a997c09460c262cca871fc4 (patch) | |
tree | 9acf7f7763e5c0f9a657a4389feac2e76b843814 /packages/SharedStorageBackup | |
parent | 0786207be59d34a8ba8a7a1e93602002fac97587 (diff) | |
download | frameworks_base-416c39e8d48048fa4a997c09460c262cca871fc4.zip frameworks_base-416c39e8d48048fa4a997c09460c262cca871fc4.tar.gz frameworks_base-416c39e8d48048fa4a997c09460c262cca871fc4.tar.bz2 |
Full backup now saves getExternalFilesDir() content with the app data
... instead of only saving it with the enormous "shared storage" generic
data blob. In parallel, we no longer store managed app-specific files
on external storage as part of the generic shared-storage blob.
At restore time we just go ahead and apply such files, though,
because they're a priori going to be part of an archive generated by
an older version of the platform, so that's how the data is expected
to be handled in those circumstances.
Bug 6718844
Change-Id: I4410514d368b11d74b3afe6b92d363d4115a3415
Diffstat (limited to 'packages/SharedStorageBackup')
-rw-r--r-- | packages/SharedStorageBackup/src/com/android/sharedstoragebackup/SharedStorageAgent.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/SharedStorageBackup/src/com/android/sharedstoragebackup/SharedStorageAgent.java b/packages/SharedStorageBackup/src/com/android/sharedstoragebackup/SharedStorageAgent.java index a6415b2..89f84fc 100644 --- a/packages/SharedStorageBackup/src/com/android/sharedstoragebackup/SharedStorageAgent.java +++ b/packages/SharedStorageBackup/src/com/android/sharedstoragebackup/SharedStorageAgent.java @@ -4,6 +4,7 @@ import android.app.backup.FullBackupAgent; import android.app.backup.FullBackup; import android.app.backup.FullBackupDataOutput; import android.content.Context; +import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.storage.StorageManager; import android.os.storage.StorageVolume; @@ -11,6 +12,7 @@ import android.util.Slog; import java.io.File; import java.io.IOException; +import java.util.HashSet; public class SharedStorageAgent extends FullBackupAgent { static final String TAG = "SharedStorageAgent"; @@ -38,13 +40,20 @@ public class SharedStorageAgent extends FullBackupAgent { // "primary" shared storage volume is first in the list. if (mVolumes != null) { if (DEBUG) Slog.i(TAG, "Backing up " + mVolumes.length + " shared volumes"); + // Ignore all apps' getExternalFilesDir() content; it is backed up as part of + // each app-specific payload. + HashSet<String> externalFilesDirFilter = new HashSet<String>(); + final File externalAndroidRoot = new File(Environment.getExternalStorageDirectory(), + Environment.DIRECTORY_ANDROID); + externalFilesDirFilter.add(externalAndroidRoot.getCanonicalPath()); + for (int i = 0; i < mVolumes.length; i++) { StorageVolume v = mVolumes[i]; // Express the contents of volume N this way in the tar stream: // shared/N/path/to/file // The restore will then extract to the given volume String domain = FullBackup.SHARED_PREFIX + i; - fullBackupFileTree(null, domain, v.getPath(), null, output); + fullBackupFileTree(null, domain, v.getPath(), externalFilesDirFilter, output); } } } |