Skip to content

Commit 9c2efb3

Browse files
author
Christopher Tate
committed
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
1 parent 54c5462 commit 9c2efb3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,16 @@ void invokeNextAgent() {
19861986
try {
19871987
mCurrentPackage = mPackageManager.getPackageInfo(request.packageName,
19881988
PackageManager.GET_SIGNATURES);
1989+
if (mCurrentPackage.applicationInfo.backupAgentName == null) {
1990+
// The manifest has changed but we had a stale backup request pending.
1991+
// This won't happen again because the app won't be requesting further
1992+
// backups.
1993+
Slog.i(TAG, "Package " + request.packageName
1994+
+ " no longer supports backup; skipping");
1995+
addBackupTrace("skipping - no agent, completion is noop");
1996+
executeNextState(BackupState.RUNNING_QUEUE);
1997+
return;
1998+
}
19891999

19902000
IBackupAgent agent = null;
19912001
try {

0 commit comments

Comments
 (0)