Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ecf2faa9 authored by Daniel Solomon's avatar Daniel Solomon
Browse files

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
parent a98953fd
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