From 980a36d001530947e24ca316e63de4f5a765cc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wilczy=C5=84ski?= Date: Fri, 14 Jul 2023 08:00:37 +0000 Subject: [PATCH] Convert refresh rate blocking zone thresholds from nits Additionally: - change the brightness value stored in DisplayModeDirector to float scale so that the brightness thresholds don't have to be converted to the int scale - convert ambient thresholds to float for simplicity of code - fix incorrect Float.NaN comparison in DPC Bug: 290906453 Test: atest DisplayDeviceConfigTest Test: atest DisplayModeDirectorTest Test: atest DeviceConfigParsingUtilsTest Test: atest DisplayPowerControllerTest Test: atest DisplayPowerController2Test Change-Id: I6f582109ea1c4fd4110493e716fffb6a9a882bba --- core/res/res/values/config.xml | 15 +- .../server/display/DisplayDeviceConfig.java | 139 +++++++----- .../display/DisplayPowerController.java | 2 +- .../display/DisplayPowerController2.java | 2 +- .../DeviceConfigParameterProvider.java | 66 ++++-- .../display/mode/DisplayModeDirector.java | 197 +++++++++++------- .../utils/DeviceConfigParsingUtils.java | 40 ++++ .../display/DisplayDeviceConfigTest.java | 118 +++++++---- .../display/mode/DisplayModeDirectorTest.java | 98 +++++---- .../utils/DeviceConfigParsingUtilsTest.java | 28 +++ 10 files changed, 473 insertions(+), 232 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index fc75ea4af0c6e..2a5cf268134d4 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -5122,13 +5122,18 @@ a threshold. For example, no higher refresh rate if display brightness <= disp0 && ambient brightness <= amb0 - || display brightness <= disp1 && ambient brightness <= amb1 --> + || display brightness <= disp1 && ambient brightness <= amb1 + Brightness thresholds are paired with lux thresholds - they both have to be met. + A negative brightness or lux value means that only one threshold should be used - e.g. if + the brightness value is negative, only the lux threshold is applied. --> + + + || display brightness >= disp1 && ambient brightness >= amb1 + Brightness thresholds are paired with lux thresholds - they both have to be met. + A negative brightness or lux value means that only one threshold should be used - e.g. if + the brightness value is negative, only the lux threshold is applied. --> + - +