Fix memory leak in BrightnessSynchronizer
Previously, a queue would be written to, a lot more often than items
were removed from it. This caused it to grow massively.
This cl changes the way that the synchronizer works, updating both
values when needed and avoiding potential race conditions.
It's relevant to note that mDisplayManager.setBrightness will only change the value if it is different, but Settings.System.putIntForUser will set it regardless, therefore causing a second "int changed" message to be sent.
Bug: 177523959
Test: manual
Test: loop this command: adb shell settings put system screen_brightness \
$((RANDOM%100))
Test: loop this command: adb shell settings put system \
screen_brightness_float 0.$((RANDOM%100))
Change-Id: I6cafb48c204ce5245c4450a6098473e06c334667
1 file changed