summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator.cpp
diff options
context:
space:
mode:
authorEvan Laird <evanlaird@google.com>2019-11-06 14:04:59 -0500
committerEvan Laird <evanlaird@google.com>2019-11-06 16:41:25 -0500
commitc73c296b491e3db6c4e66eceb519c945908d158d (patch)
tree577d92b953decf9cc447a63b56e520c30942474d /tools/aapt2/java/JavaClassGenerator.cpp
parentb730f1984f382f53bdafadad59e6070d5d0d99ba (diff)
Force FGS notifications to show for a minimum time
It's possible for a service to do a start/stop foreground and cause a couple of things to happen: NotificationManagerService will enqueue a EnqueueNotificationRunnable, post a PostNotificationRunnable (for the startForeground), and then also enqueue a CancelNotificationRunnable. There is some racy behavior here in that the cancel runnable can get triggered in between enqueue and post runnables. If the cancel happens first, then NotificationListenerServices will never get the message. This behavior is technically allowed, however for foreground services we want to ensure that there is a minmum amount of time that notification listeners are aware of the foreground service so that (for instance) the FGS notification can be shown. This CL does two things to mitigate this problem: 1. Introduce checking in the CancelNotificationRunnable such that it will not cancel until after PostNotificationRunnable has finished executing. 2. Introduce a NotificationLifetimeExtender method that will allow a lifetime extender to manage the lifetime of a notification that has been enqueued but not inflated yet. Bug: 119041698 Test: atest NotificationManagerServiceTest Test: atest ForegroundServiceLifetimeExtenderTest Change-Id: I428bc334362f6e4b95f5f0c6974b71f76175c7ae Merged-In: I0680034ed9315aa2c05282524d48faaed066ebd0
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
0 files changed, 0 insertions, 0 deletions