summaryrefslogtreecommitdiff
path: root/tests/SystemUIDemoModeController/src
diff options
context:
space:
mode:
author Lucas Silva <lusilva@google.com> 2023-03-22 19:02:21 -0400
committer Lucas Silva <lusilva@google.com> 2023-03-24 19:55:21 +0000
commit6dd113cc323717886702a395513a0e4355d3a2f0 (patch)
tree89883d41af1ff50c06ea0819f50abbc3dfc5ce25 /tests/SystemUIDemoModeController/src
parent0b02b77b7a042eb104f86ad03189d7f30fa9038a (diff)
Fix race condition in lowlight trigger logic
If the ambient light changes quickly between regular/lowlight before the animations are done, the user can become stuck in a bad state. This is reproducible with adb by forcing/clearing lowlight very quickly. This fix updates the logic to use kotlin, since kotlin suspend functions and coroutines are cancellable and make implementing this kind of cancellation straightforward. Leaning into the kotlin framework to ensure we get cancellation correct, instead of implementing something similar in Java. We also add an additional safeguard of with a 2s timeout, in case the animation never finishes. This ensures that we reset the state and aren't stuck waiting on the animation forever. Bug: 274024126 Test: atest LowLightDreamManagerTest Test: atest LowLightTransitionCoordinatorTest Change-Id: I8078ce9a71074d123d27584d05a9a7f960255812
Diffstat (limited to 'tests/SystemUIDemoModeController/src')
0 files changed, 0 insertions, 0 deletions