diff options
author | Christopher Tate <ctate@google.com> | 2012-10-23 15:07:38 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2012-10-23 15:40:27 -0700 |
commit | e82f68d0164fa12a36da5ae9c839ab292224c384 (patch) | |
tree | 67e2693f30f95943dedb2c3ca9cf966c8f0b9fa3 /services/java/com/android/server/BackupManagerService.java | |
parent | cd92db84c6d9e0c9992abfbbda45d504c7f5e062 (diff) |
Fix the Backup Manager's uninstall tracking
The bug was that when an app was uninstalled, the Backup Manager was
discarding its bookkeeping about that app being represented in the
device's current live backup dataset. This in turn meant that if the
app was subsequently reinstalled, its data would not be restored from
that most-recent dataset: it would be restored from the *ancestral*
dataset if possible, or not at all.
Now the "ever backed up" state is retained correctly, and the app
will get its most-recent-data restored as expected.
Bug 7394519
Change-Id: I733cf41737765676e0a3a05fb1bcd32b165cb4ba
Diffstat (limited to 'services/java/com/android/server/BackupManagerService.java')
-rw-r--r-- | services/java/com/android/server/BackupManagerService.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index f241c8090dbc..a6624193a697 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -1433,12 +1433,9 @@ class BackupManagerService extends IBackupManager.Stub { set.add(pkg.packageName); if (MORE_DEBUG) Slog.v(TAG, "Agent found; added"); - // If we've never seen this app before, schedule a backup for it - if (!mEverStoredApps.contains(pkg.packageName)) { - if (DEBUG) Slog.i(TAG, "New app " + pkg.packageName - + " never backed up; scheduling"); - dataChangedImpl(pkg.packageName); - } + // Schedule a backup for it on general principles + if (DEBUG) Slog.i(TAG, "Scheduling backup for new app " + pkg.packageName); + dataChangedImpl(pkg.packageName); } } } @@ -1471,8 +1468,10 @@ class BackupManagerService extends IBackupManager.Stub { // Found it. Remove this one package from the bookkeeping, and // if it's the last participating app under this uid we drop the // (now-empty) set as well. + // Note that we deliberately leave it 'known' in the "ever backed up" + // bookkeeping so that its current-dataset data will be retrieved + // if the app is subsequently reinstalled if (MORE_DEBUG) Slog.v(TAG, " removing participant " + packageName); - removeEverBackedUp(packageName); set.remove(packageName); mPendingBackups.remove(packageName); } @@ -5440,7 +5439,8 @@ class BackupManagerService extends IBackupManager.Stub { long restoreSet = getAvailableRestoreToken(packageName); if (DEBUG) Slog.v(TAG, "restoreAtInstall pkg=" + packageName - + " token=" + Integer.toHexString(token)); + + " token=" + Integer.toHexString(token) + + " restoreSet=" + Long.toHexString(restoreSet)); if (mAutoRestore && mProvisioned && restoreSet != 0) { // okay, we're going to attempt a restore of this package from this restore set. |