Send backup success notification to background apps as well

When the backup manager is configured to notify one or more apps of
successful backups, the notifications should be sent to apps that are
currently stopped as well.

Bug: 63885845
Test: cts-tradefed run cts-dev --module CtsBackupHostTestCase
Change-Id: I7086aee105229e0f8db4b1ec26639d53a4e0af37
This commit is contained in:
Bartosz Fabianowski
2018-01-02 18:10:18 +01:00
parent 37d870bc09
commit 9fcc8ffd7b

View File

@@ -1424,6 +1424,8 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter
final Intent notification = new Intent();
notification.setAction(BACKUP_FINISHED_ACTION);
notification.setPackage(receiver);
notification.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES |
Intent.FLAG_RECEIVER_FOREGROUND);
notification.putExtra(BACKUP_FINISHED_PACKAGE_EXTRA, packageName);
mContext.sendBroadcastAsUser(notification, UserHandle.OWNER);
}