From dafbfeadedc7fe04d15911645bb4424c061eaf79 Mon Sep 17 00:00:00 2001 From: Daniel Solomon Date: Wed, 27 Apr 2022 01:13:29 +0000 Subject: [PATCH] Don't update brightness settings when throttling brightness Currently, when brightness throttling is active it forces updating of brightness settings. In some use cases, this causes settings to be updated with values that are irrelevant to user settings (e.g., a screen_brightness value of 1 when display is off). To fix this, avoid updating settings as part of brightness throttling. Instead, rely on the manual and auto brightness paths to trigger settings updates when necessary. Note that, 1. Brightness requested by manual and auto brightness is still throttled. 2. The throttled maximum brightness value and the final (throttled) display brightness are still broadcast accurately through values captured in BrightnessInfo. Bug: 228286897 Test: atest BrightnessThrottlerTest AutomaticBrightnessControllerTest Test: Manual: 1. Disable auto brightness and set brightness to a high value 2. Turn off the display 3. Force thermal throttling (throttled brightness is >min) 4. Turn on the display 5. Verify that brightness is throttled and >min Change-Id: I89bdcc2f77b6bf3b4b9b2fd7c1aa7b029dc9c174 --- .../java/com/android/server/display/DisplayPowerController.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 698f41f23e989..80ff8349a1538 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -1389,12 +1389,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // Brightness throttling is needed, so do so quickly. // Later, when throttling is removed, we let other mechanisms decide on speed. slowChange = false; - updateScreenBrightnessSetting = true; } mAppliedThrottling = true; } else if (mAppliedThrottling) { mAppliedThrottling = false; - updateScreenBrightnessSetting = true; } if (updateScreenBrightnessSetting) {