Merge change 6403 into donut

* changes:
  Fix the metadata-available test during restore
This commit is contained in:
Android (Google) Code Review
2009-07-07 14:29:47 -07:00
2 changed files with 8 additions and 2 deletions

View File

@@ -985,8 +985,7 @@ class BackupManagerService extends IBackupManager.Stub {
// Verify that the backup set includes metadata. If not, we can't do // Verify that the backup set includes metadata. If not, we can't do
// signature/version verification etc, so we simply do not proceed with // signature/version verification etc, so we simply do not proceed with
// the restore operation. // the restore operation.
Metadata pmMeta = pmAgent.getRestoredMetadata(packageName); if (!pmAgent.hasMetadata()) {
if (pmMeta == null) {
Log.i(TAG, "No restore metadata available, so not restoring settings"); Log.i(TAG, "No restore metadata available, so not restoring settings");
return; return;
} }

View File

@@ -67,6 +67,7 @@ public class PackageManagerBackupAgent extends BackupAgent {
private final HashSet<String> mExisting = new HashSet<String>(); private final HashSet<String> mExisting = new HashSet<String>();
private int mStoredSdkVersion; private int mStoredSdkVersion;
private String mStoredIncrementalVersion; private String mStoredIncrementalVersion;
private boolean mHasMetadata;
public class Metadata { public class Metadata {
public int versionCode; public int versionCode;
@@ -84,6 +85,11 @@ public class PackageManagerBackupAgent extends BackupAgent {
mPackageManager = packageMgr; mPackageManager = packageMgr;
mAllPackages = packages; mAllPackages = packages;
mRestoredSignatures = null; mRestoredSignatures = null;
mHasMetadata = false;
}
public boolean hasMetadata() {
return mHasMetadata;
} }
public Metadata getRestoredMetadata(String packageName) { public Metadata getRestoredMetadata(String packageName) {
@@ -259,6 +265,7 @@ public class PackageManagerBackupAgent extends BackupAgent {
} }
mStoredSdkVersion = storedSdkVersion; mStoredSdkVersion = storedSdkVersion;
mStoredIncrementalVersion = in.readUTF(); mStoredIncrementalVersion = in.readUTF();
mHasMetadata = true;
// !!! TODO: remove this debugging output // !!! TODO: remove this debugging output
if (DEBUG) { if (DEBUG) {
Log.i(TAG, "Restore set version " + storedSystemVersion Log.i(TAG, "Restore set version " + storedSystemVersion