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
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user