diff options
author | Christopher Tate <ctate@google.com> | 2009-06-22 15:10:30 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2009-06-22 15:14:04 -0700 |
commit | 3a31a93b8a195ae2d0180e6dfbf292da2e581f50 (patch) | |
tree | a834618fe7ecf9cbb25f799c2fd558075dfc5eda /services/java/com/android/server/BackupManagerService.java | |
parent | e146d824785078fed578f88b11ff47a7390d27c5 (diff) |
Add some global metadata to the restore set
In addition to the signatures of each participating application, we now also
store the versionCode of each backed-up package, plus the OS version running on
the device that contributed the backup set. We also refuse to process a backup
from a later OS revision to an earlier one, or from a later app version to an
earlier.
LocalTransport has been modified as well to be more resilient to changes in the
system's use of metadata pseudopackages.
Diffstat (limited to 'services/java/com/android/server/BackupManagerService.java')
-rw-r--r-- | services/java/com/android/server/BackupManagerService.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index 9a8d7401e8d2..c60f98123d90 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -34,6 +34,7 @@ import android.content.pm.PackageManager; import android.content.pm.Signature; import android.net.Uri; import android.os.Binder; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; @@ -850,18 +851,27 @@ class BackupManagerService extends IBackupManager.Stub { if (app != null) { // Validate against the backed-up signature block, too Metadata info = pmAgent.getRestoredMetadata(app.packageName); - if (app.versionCode >= info.versionCode) { - if (DEBUG) Log.v(TAG, "Restore version " + info.versionCode - + " compatible with app version " + app.versionCode); - if (signaturesMatch(info.signatures, app.signatures)) { - appsToRestore.add(app); + if (info != null) { + if (app.versionCode >= info.versionCode) { + if (DEBUG) Log.v(TAG, "Restore version " + + info.versionCode + + " compatible with app version " + + app.versionCode); + if (signaturesMatch(info.signatures, app.signatures)) { + appsToRestore.add(app); + } else { + Log.w(TAG, "Sig mismatch restoring " + + app.packageName); + } } else { - Log.w(TAG, "Sig mismatch restoring " + app.packageName); + Log.i(TAG, "Restore set for " + app.packageName + + " is too new [" + info.versionCode + + "] for installed app version " + + app.versionCode); } } else { - Log.i(TAG, "Restore set for " + app.packageName - + " is too new [" + info.versionCode - + "] for installed app version " + app.versionCode); + Log.d(TAG, "Unable to get metadata for " + + app.packageName); } } } |