From d990e4d3df96e4cb9176870ba8de86108207978d Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Tue, 11 Oct 2016 15:29:39 -0700 Subject: [PATCH] Respect restoreAnyVersion=true in full-data restore path The scheduling mechanism was properly checking for it, but the raw data-handling engine wasn't. Now it is. Bug 32054889 Change-Id: Id57ea12be8e2674c4f678f058278b8c14865b6fa --- .../java/com/android/server/backup/BackupManagerService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 497eac9f2ecb..8424b3963d78 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -6057,7 +6057,11 @@ public class BackupManagerService { // the app developer's cert, so they're different on every // device. if (signaturesMatch(sigs, pkgInfo)) { - if (pkgInfo.versionCode >= version) { + if ((pkgInfo.applicationInfo.flags + & ApplicationInfo.FLAG_RESTORE_ANY_VERSION) != 0) { + Slog.i(TAG, "Package has restoreAnyVersion; taking data"); + policy = RestorePolicy.ACCEPT; + } else if (pkgInfo.versionCode >= version) { Slog.i(TAG, "Sig + version match; taking data"); policy = RestorePolicy.ACCEPT; } else { @@ -7479,7 +7483,11 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF // the app developer's cert, so they're different on every // device. if (signaturesMatch(sigs, pkgInfo)) { - if (pkgInfo.versionCode >= version) { + if ((pkgInfo.applicationInfo.flags + & ApplicationInfo.FLAG_RESTORE_ANY_VERSION) != 0) { + Slog.i(TAG, "Package has restoreAnyVersion; taking data"); + policy = RestorePolicy.ACCEPT; + } else if (pkgInfo.versionCode >= version) { Slog.i(TAG, "Sig + version match; taking data"); policy = RestorePolicy.ACCEPT; } else { -- 2.11.0