Make DozeParameters responsible for setting PowerManager#setDozeAfterScreenOff.
Previously this was done in DozeUi, which is a component that is destroyed whenever we
unlock the phone (and re-created when we enter AOD).
Unfortunately, we relied on the fact that the keyguardUpdateMonitorCallback is not
unregistered in DozeUi#destroy, and therefore continued to receive events and
update setDozeAfterScreenOff until being garbage collected. That's obviously very
risky.
We rarely saw issues with this until status bar state was added as a criteria for
whether or not to control the screen off animation (we can't do unlocked screen off
if the shade is expanded). Once that was added, the status bar state at the time of
garbage collection became the permanent control screen off setting until the next doze.
Fixes: 203644049
Test: manual/atest SystemUITests
Change-Id: I85e88e2657363af7a131bd4c31d9a36715593181
8 files changed