Add single-package restore to Bmgr feature set

Also sanity-check the package name on the Backup Manager side, failing gracefully
if the given package is not a backup/restore participant.

Bug: 2293977

Change-Id: I3575046ffcaa3cf45c1c602824baeadd64082f70
This commit is contained in:
Christopher Tate
2010-02-26 11:27:08 -08:00
parent 4c904a3bf3
commit 7d411a3b94
2 changed files with 71 additions and 18 deletions

View File

@ -2427,6 +2427,12 @@ class BackupManagerService extends IBackupManager.Stub {
throw new SecurityException("No permission to restore other packages");
}
// If the package has no backup agent, we obviously cannot proceed
if (app.applicationInfo.backupAgentName == null) {
Log.w(TAG, "Asked to restore package " + packageName + " with no agent");
return -1;
}
// So far so good; we're allowed to try to restore this package. Now
// check whether there is data for it in the current dataset, falling back
// to the ancestral dataset if not.