Fix race on setCanceledAfterLifetimeExtension
We setCancaledAfterLifetimeExtension to avoid multiple cancelation calls
from causing multiple updates being sent to System UI, but were setting
the value on a callback after the post to System UI had occurred.
Unfortunately apps can cancel more quickly than that; these cancelations
will enqueue multiple posts before the callback from systemUI occurs,
and they'll all be sent.
This leads to the same message being posted repeatedly.
So, instead, we move the set to immediately after we've checked
that the record doesn't have the value set, and have committed to the path
where an update will be sent to system UI.
Bug: 371105236
Test: atest NotificationManagerService, flash+test
Flag: android.app.lifetime_extension_refactor
Change-Id: I82d0dfc9940f02108b61f4d8574c9135505efa58
2 files changed