Remember which apps have available restore info in the ancestral dataset
When we perform a full-system restore, remember the set of applications which have data available in our ancestral dataset. This is a key filter for not having to do a round trip to the [remote] storage backend at app-install time unless it is likely to be fruitful. Change-Id: I7c77b490c560c581888d84f02f258b2e2d73bc69
This commit is contained in:
@@ -40,6 +40,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* We back up the signatures of each package so that during a system restore,
|
||||
@@ -100,6 +101,20 @@ public class PackageManagerBackupAgent extends BackupAgent {
|
||||
|
||||
return mRestoredSignatures.get(packageName);
|
||||
}
|
||||
|
||||
public Set<String> getRestoredPackages() {
|
||||
if (mRestoredSignatures == null) {
|
||||
Log.w(TAG, "getRestoredPackages() before metadata read!");
|
||||
return null;
|
||||
}
|
||||
|
||||
// This is technically the set of packages on the originating handset
|
||||
// that had backup agents at all, not limited to the set of packages
|
||||
// that had actually contributed a restore dataset, but it's a
|
||||
// close enough approximation for our purposes and does not require any
|
||||
// additional involvement by the transport to obtain.
|
||||
return mRestoredSignatures.keySet();
|
||||
}
|
||||
|
||||
// The backed up data is the signature block for each app, keyed by
|
||||
// the package name.
|
||||
|
||||
Reference in New Issue
Block a user