Cancel brightness slider animation before checking its value

One of the checks that occurs before initiating a brightness slider
animation is a comparison of the current slider value versus the current
display brightness value.

There is a race condition wherein,
1. There's an outstanding animation that is about to move the slider to
a stale brightness value, but hasn't started yet.
2. A new animation to the current display brightness value is being
considered. During this time, the slider value (which hasn't been moved
yet by the outstanding animation) is being compared against the current
display brightness value. They match, and a new animation isn't started.
3. The animation from step #1 proceeds, and moves the slider to a
location that no longer matches the current display brightness value.

To fix this, we first cancel any outstanding slider animation, and only
then compare the slider's position to display brightness.

Bug: 202873446
Bug: 214849040
Test: Manual, sliding the brightness slider around and ensuring it stays
    in place after the user lets go of it.
Test: atest QuickQSBrightnessControllerTest BrightnessSliderTest
Change-Id: I036638561bef6c5f10a11f5e50957c39cd792705
1 file changed