Attempt install-time restore even for no-agent apps

Packages without their own backup agents can still have restorable
data to be delivered.  Correct the logic for attempting a restore
at install time so that it no longer requires an app-defined backup
agent.

Bug 16688665

Change-Id: I7dcf7ef85ad6b5b393a2c97ce62f1b2eec9d3520
This commit is contained in:
Christopher Tate
2014-07-31 13:51:21 -07:00
committed by Christopher Tate
parent 874bcd82c2
commit 73140e4df9

View File

@@ -8257,11 +8257,11 @@ public class PackageManagerService extends IPackageManager.Stub {
// A restore should be performed at this point if (a) the install
// succeeded, (b) the operation is not an update, and (c) the new
// package has a backupAgent defined.
// package has not opted out of backup participation.
final boolean update = res.removedInfo.removedPackage != null;
boolean doRestore = (!update
&& res.pkg != null
&& res.pkg.applicationInfo.backupAgentName != null);
final int flags = (res.pkg == null) ? 0 : res.pkg.applicationInfo.flags;
boolean doRestore = !update
&& ((flags & ApplicationInfo.FLAG_ALLOW_BACKUP) != 0);
// Set up the post-install work request bookkeeping. This will be used
// and cleaned up by the post-install event handling regardless of whether