Skip to content
Commit 10a3ccad authored by Christopher Tate's avatar Christopher Tate
Browse files

Fix various FGS notification deferral issues

A number of scenarios involving both FGS and non-FGS notification
operations were not yet working as intended.  This CL lands the
following behaviors:

* notify() to update the notification content during an FGS's
notification deferral period now respects the new Notification's
deferral policy rather than forcing immediate display.  An app can now
choose whether to force immediate display, or to have the new content be
what eventually appears at the end of the deferral period, by using the
same builder API as controls the deferral policy for startForeground().

* If an app posts a notification via notify() then adopts that
notification with new content (i.e. uses the same notification ID) in a
call to startForeground(), there is now no deferral: the existing
notification is always updated immediately, regardless of the
notification's or the service's configuration viz deferral policy.

* Fixed a latent bug when the app called notify() to update the
notification after startForeground(), then the service was killed for
memory and relaunched.  The notification might have been reposted with
stale content.

* Adjusted the metrics handling to more accurately express "was display
of the notification content for this transition to the FGS mode
deferred?"

Bug: 178406514
Bug: 185771298
Bug: 187860135
Test: atest CtsAppTestCases:android.app.cts.ServiceTest
Test: atest CtsAppTestCases:NotificationManagerTest
Change-Id: Ieb62f7195eb619c1769e3c1bd518cb6a7b6e4b7c
parent 7e5a53a0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment