Reflect BrightnessThrottler effects in Settings, UI and ABC
Currently, display brightness limitations by BrightnessThrottler are
applied as a brightness transform in DisplayPowerController similarly to
pre-display timeout dimming and low power mode. This is intentional, and
was done in an attempt to keep the addition of brightness throttling as
unintrusive as possible. This design choice means that the following
entities are not aware of brightness throttling:
1. Brightness slider in SysUI
2. AutomaticBrightnessController (ABC)
3. Settings
Of particular concern is #1 and #2, as it means that the display
brightness the user sees and the display brightness the SysUI slider can
effect are out of sync. Combined with the fact that ABC doesn't know
about brightness throttling, this means that ABC can learn the wrong
user preferences while brightness is throttled.
To fix this, we adjust the usage of BrightnessThrottler inside
DisplayPowerController and ABC to mimic that of
HighBrightnessModeController, which also dynamically adjusts maximum
display brightness (for different reasons). Specifically,
BrightnessThrottler results are now,
1. Captured in Settings, to match HighBrightnessModeController's
behavior
2. Captured in BrightnessInfo, so that the maximum SysUI slider value is
correct
3. Queried by ABC, so that ABC doesn't try to set a display brightness
value above BrightnessThrottler's limit
Bug: 206857086
Bug: 212634465
Test: atest BrightnessThrottlerTest DisplayModeDirectorTest
BrightnessLevelPreferenceControllerTest
HighBrightnessModeControllerTest
AutomaticBrightnessControllerTest
Test: Visually observe the SysUI brightness slider and setting
screen_brightness adjusting to new maximum brightness values as
throttling is toggled.
Change-Id: Iab0b773e74f9349fc92949990c96f44d263332aa
3 files changed