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

Commit 9c2efb35 authored by Christopher Tate's avatar Christopher Tate
Browse files

Sanity-check backup agent name prior to instantiation

Fixes a crash that would occur if an app with a pending backup
pass in the pipeline was updated to remove its agent declaration
from the manifest (or other more esoteric ways that a backup
pass was expected to run for an app without their own agent).

Bug 5776591

Change-Id: I5a8bc8c12de6a2bfa82f5093fe3a15b754109ab1
parent 54c54622
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1986,6 +1986,16 @@ class BackupManagerService extends IBackupManager.Stub {
            try {
                mCurrentPackage = mPackageManager.getPackageInfo(request.packageName,
                        PackageManager.GET_SIGNATURES);
                if (mCurrentPackage.applicationInfo.backupAgentName == null) {
                    // The manifest has changed but we had a stale backup request pending.
                    // This won't happen again because the app won't be requesting further
                    // backups.
                    Slog.i(TAG, "Package " + request.packageName
                            + " no longer supports backup; skipping");
                    addBackupTrace("skipping - no agent, completion is noop");
                    executeNextState(BackupState.RUNNING_QUEUE);
                    return;
                }

                IBackupAgent agent = null;
                try {