Skip to content

Commit e7287a0

Browse files
author
Christopher Tate
committed
Sanity-check existence of restore agent
When a restore dataset includes data for an app that used to have a backup agent, but does not in the currently-installed version, we were merrily trying to bring up the agent for restore anyway, and crashing. Now we don't do that; we check whether there's actually going to be an agent to handle the data before doing any of the heavy work. Bug 7130695 Change-Id: I0a38c2a8bb51d4a140a72d22896fa58d98ebaa02
1 parent 965e7ff commit e7287a0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

services/java/com/android/server/BackupManagerService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4401,6 +4401,18 @@ void restoreNextAgent() {
44014401
return;
44024402
}
44034403

4404+
if (packageInfo.applicationInfo.backupAgentName == null
4405+
|| "".equals(packageInfo.applicationInfo.backupAgentName)) {
4406+
if (DEBUG) {
4407+
Slog.i(TAG, "Data exists for package " + packageName
4408+
+ " but app has no agent; skipping");
4409+
}
4410+
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
4411+
"Package has no agent");
4412+
executeNextState(RestoreState.RUNNING_QUEUE);
4413+
return;
4414+
}
4415+
44044416
if (metaInfo.versionCode > packageInfo.versionCode) {
44054417
// Data is from a "newer" version of the app than we have currently
44064418
// installed. If the app has not declared that it is prepared to

0 commit comments

Comments
 (0)