Skip to content
Commit 6dd113cc authored by Lucas Silva's avatar Lucas Silva
Browse files

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
parent 0b02b77b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment