From 19f3902f60f829b911f9f47beecc0a7dd40a49f9 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Mon, 4 Oct 2021 15:23:59 -0400 Subject: [PATCH 1/2] Improve brightness handling during screen off timeout. - Align doze brightness logic with DisplayPowerController, so that the 'minimum dim amount' is taken into account by DozeScreenBrightness. - Clamp brightness to the now-correct dim value during the entire screen off animation, rather than sometimes transitioning to the sensor value. Apply the sensor brightness value on changing to the DOZE Display state, which happens after the screen off animation. This brings the changes from ag/15974454 (Improve brightness handling during screen off timeout) and ag/16047064 (Fix DozeScreenBrightnessTest) into sc-v2/master from sc/qpr1, along with externalizing the minimum dim percent as a config value. Bug: 194972547 Test: at 0%, 45%, and 100% brightness, allow the screen to time out in bright and dark rooms, observe minimal brightness changes Change-Id: I0a1ae320274661e58d6b398a8facdfad54e49a06 --- core/res/res/values/config.xml | 6 +++ core/res/res/values/symbols.xml | 1 + .../systemui/doze/DozeScreenBrightness.java | 38 +++++++++++++++---- .../systemui/doze/DozeScreenState.java | 11 +++++- .../doze/DozeScreenBrightnessTest.java | 28 ++++++++++---- .../systemui/doze/DozeScreenStateTest.java | 5 ++- .../display/DisplayPowerController.java | 11 ++++-- 7 files changed, 80 insertions(+), 20 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 8cb7278270099..5aff0e0cf38a1 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1388,6 +1388,12 @@ 10 0.05 + + 0.04 +