Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7287a07 authored by Christopher Tate's avatar Christopher Tate
Browse files

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
parent 965e7ff4
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -4401,6 +4401,18 @@ class BackupManagerService extends IBackupManager.Stub {
                    return;
                }

                if (packageInfo.applicationInfo.backupAgentName == null
                        || "".equals(packageInfo.applicationInfo.backupAgentName)) {
                    if (DEBUG) {
                        Slog.i(TAG, "Data exists for package " + packageName
                                + " but app has no agent; skipping");
                    }
                    EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
                            "Package has no agent");
                    executeNextState(RestoreState.RUNNING_QUEUE);
                    return;
                }

                if (metaInfo.versionCode > packageInfo.versionCode) {
                    // Data is from a "newer" version of the app than we have currently
                    // installed.  If the app has not declared that it is prepared to