From ed958e9852101571808456e5e91c96c65e7f690a Mon Sep 17 00:00:00 2001 From: Dan Gittik Date: Tue, 13 Nov 2018 14:58:20 +0000 Subject: [PATCH] Added hysteresis check to screen brightness. Previously, the AutoBrightnessController would suppress updates if the ambient brightness hasn't changed enough, to avoid minor changes that wouldn't really matter but probably annoy the user. However, if the brightness curve was rather flat, a large change in the ambient brightness might translate to a small and unnecessary change in the screen brightness that would still get applied. So, this CL adds similar hysteresis checks for the screen brightness. Test: manual - simulate an ambient brightness that would cause a minor change in the screen brightness, and make sure it is suppressed (and the appropriate logs are emitted). Change-Id: I41aefb5a9a82c9b598cf31f374f338899ffc9b11 --- core/res/res/values/config.xml | 90 +++++++++++++------ core/res/res/values/symbols.xml | 9 +- .../AutomaticBrightnessController.java | 85 +++++++++++------- .../display/DisplayPowerController.java | 41 +++++---- .../server/display/HysteresisLevels.java | 74 +++++++-------- 5 files changed, 186 insertions(+), 113 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index ecff835582150..38caa3655fb0c 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1437,26 +1437,6 @@ - - - 100 - - - - - 200 - - - + condition calculated index + value < level[0] 0 + level[n] <= value < level[n+1] n+1 + level[MAX] <= value MAX+1 --> + + + + + + 100 + + + + + 200 + + + + + + + + + 100 + + + + + 200