Merge "Implement tuning of brightness thresholds for idle" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
84e2c20b42
@@ -131,6 +131,8 @@ class AutomaticBrightnessController {
|
||||
// Configuration object for determining thresholds to change brightness dynamically
|
||||
private final HysteresisLevels mAmbientBrightnessThresholds;
|
||||
private final HysteresisLevels mScreenBrightnessThresholds;
|
||||
private final HysteresisLevels mAmbientBrightnessThresholdsIdle;
|
||||
private final HysteresisLevels mScreenBrightnessThresholdsIdle;
|
||||
|
||||
private boolean mLoggingEnabled;
|
||||
|
||||
@@ -242,7 +244,9 @@ class AutomaticBrightnessController {
|
||||
float dozeScaleFactor, int lightSensorRate, int initialLightSensorRate,
|
||||
long brighteningLightDebounceConfig, long darkeningLightDebounceConfig,
|
||||
boolean resetAmbientLuxAfterWarmUpConfig, HysteresisLevels ambientBrightnessThresholds,
|
||||
HysteresisLevels screenBrightnessThresholds, Context context,
|
||||
HysteresisLevels screenBrightnessThresholds,
|
||||
HysteresisLevels ambientBrightnessThresholdsIdle,
|
||||
HysteresisLevels screenBrightnessThresholdsIdle, Context context,
|
||||
HighBrightnessModeController hbmController, BrightnessThrottler brightnessThrottler,
|
||||
BrightnessMappingStrategy idleModeBrightnessMapper, int ambientLightHorizonShort,
|
||||
int ambientLightHorizonLong) {
|
||||
@@ -251,7 +255,8 @@ class AutomaticBrightnessController {
|
||||
lightSensorWarmUpTime, brightnessMin, brightnessMax, dozeScaleFactor,
|
||||
lightSensorRate, initialLightSensorRate, brighteningLightDebounceConfig,
|
||||
darkeningLightDebounceConfig, resetAmbientLuxAfterWarmUpConfig,
|
||||
ambientBrightnessThresholds, screenBrightnessThresholds, context,
|
||||
ambientBrightnessThresholds, screenBrightnessThresholds,
|
||||
ambientBrightnessThresholdsIdle, screenBrightnessThresholdsIdle, context,
|
||||
hbmController, brightnessThrottler, idleModeBrightnessMapper,
|
||||
ambientLightHorizonShort, ambientLightHorizonLong
|
||||
);
|
||||
@@ -265,7 +270,9 @@ class AutomaticBrightnessController {
|
||||
float dozeScaleFactor, int lightSensorRate, int initialLightSensorRate,
|
||||
long brighteningLightDebounceConfig, long darkeningLightDebounceConfig,
|
||||
boolean resetAmbientLuxAfterWarmUpConfig, HysteresisLevels ambientBrightnessThresholds,
|
||||
HysteresisLevels screenBrightnessThresholds, Context context,
|
||||
HysteresisLevels screenBrightnessThresholds,
|
||||
HysteresisLevels ambientBrightnessThresholdsIdle,
|
||||
HysteresisLevels screenBrightnessThresholdsIdle, Context context,
|
||||
HighBrightnessModeController hbmController, BrightnessThrottler brightnessThrottler,
|
||||
BrightnessMappingStrategy idleModeBrightnessMapper, int ambientLightHorizonShort,
|
||||
int ambientLightHorizonLong) {
|
||||
@@ -289,7 +296,9 @@ class AutomaticBrightnessController {
|
||||
mAmbientLightHorizonShort = ambientLightHorizonShort;
|
||||
mWeightingIntercept = ambientLightHorizonLong;
|
||||
mAmbientBrightnessThresholds = ambientBrightnessThresholds;
|
||||
mAmbientBrightnessThresholdsIdle = ambientBrightnessThresholdsIdle;
|
||||
mScreenBrightnessThresholds = screenBrightnessThresholds;
|
||||
mScreenBrightnessThresholdsIdle = screenBrightnessThresholdsIdle;
|
||||
mShortTermModelValid = true;
|
||||
mShortTermModelAnchor = -1;
|
||||
mHandler = new AutomaticBrightnessHandler(looper);
|
||||
@@ -585,6 +594,8 @@ class AutomaticBrightnessController {
|
||||
pw.println();
|
||||
mAmbientBrightnessThresholds.dump(pw);
|
||||
mScreenBrightnessThresholds.dump(pw);
|
||||
mScreenBrightnessThresholdsIdle.dump(pw);
|
||||
mScreenBrightnessThresholdsIdle.dump(pw);
|
||||
}
|
||||
|
||||
private String configStateToString(int state) {
|
||||
@@ -679,8 +690,17 @@ class AutomaticBrightnessController {
|
||||
lux = 0;
|
||||
}
|
||||
mAmbientLux = lux;
|
||||
mAmbientBrighteningThreshold = mAmbientBrightnessThresholds.getBrighteningThreshold(lux);
|
||||
mAmbientDarkeningThreshold = mAmbientBrightnessThresholds.getDarkeningThreshold(lux);
|
||||
if (isInIdleMode()) {
|
||||
mAmbientBrighteningThreshold =
|
||||
mAmbientBrightnessThresholdsIdle.getBrighteningThreshold(lux);
|
||||
mAmbientDarkeningThreshold =
|
||||
mAmbientBrightnessThresholdsIdle.getDarkeningThreshold(lux);
|
||||
} else {
|
||||
mAmbientBrighteningThreshold =
|
||||
mAmbientBrightnessThresholds.getBrighteningThreshold(lux);
|
||||
mAmbientDarkeningThreshold =
|
||||
mAmbientBrightnessThresholds.getDarkeningThreshold(lux);
|
||||
}
|
||||
mHbmController.onAmbientLuxChange(mAmbientLux);
|
||||
|
||||
// If the short term model was invalidated and the change is drastic enough, reset it.
|
||||
@@ -902,10 +922,20 @@ class AutomaticBrightnessController {
|
||||
mPreThresholdBrightness = mScreenAutoBrightness;
|
||||
}
|
||||
mScreenAutoBrightness = newScreenAutoBrightness;
|
||||
mScreenBrighteningThreshold = clampScreenBrightness(
|
||||
mScreenBrightnessThresholds.getBrighteningThreshold(newScreenAutoBrightness));
|
||||
mScreenDarkeningThreshold = clampScreenBrightness(
|
||||
mScreenBrightnessThresholds.getDarkeningThreshold(newScreenAutoBrightness));
|
||||
if (isInIdleMode()) {
|
||||
mScreenBrighteningThreshold = clampScreenBrightness(
|
||||
mScreenBrightnessThresholdsIdle.getBrighteningThreshold(
|
||||
newScreenAutoBrightness));
|
||||
mScreenDarkeningThreshold = clampScreenBrightness(
|
||||
mScreenBrightnessThresholdsIdle.getDarkeningThreshold(
|
||||
newScreenAutoBrightness));
|
||||
} else {
|
||||
mScreenBrighteningThreshold = clampScreenBrightness(
|
||||
mScreenBrightnessThresholds.getBrighteningThreshold(
|
||||
newScreenAutoBrightness));
|
||||
mScreenDarkeningThreshold = clampScreenBrightness(
|
||||
mScreenBrightnessThresholds.getDarkeningThreshold(newScreenAutoBrightness));
|
||||
}
|
||||
|
||||
if (sendUpdate) {
|
||||
mCallbacks.updateBrightness();
|
||||
|
||||
@@ -188,8 +188,8 @@ import javax.xml.datatype.DatatypeConfigurationException;
|
||||
* <ambientLightHorizonLong>10001</ambientLightHorizonLong>
|
||||
* <ambientLightHorizonShort>2001</ambientLightHorizonShort>
|
||||
*
|
||||
* <displayBrightnessChangeThresholds>
|
||||
* <brighteningThresholds>
|
||||
* <displayBrightnessChangeThresholds> // Thresholds for screen changes
|
||||
* <brighteningThresholds> // Thresholds for active mode brightness changes.
|
||||
* <minimum>0.001</minimum> // Minimum change needed in screen brightness to brighten.
|
||||
* </brighteningThresholds>
|
||||
* <darkeningThresholds>
|
||||
@@ -197,8 +197,8 @@ import javax.xml.datatype.DatatypeConfigurationException;
|
||||
* </darkeningThresholds>
|
||||
* </displayBrightnessChangeThresholds>
|
||||
*
|
||||
* <ambientBrightnessChangeThresholds>
|
||||
* <brighteningThresholds>
|
||||
* <ambientBrightnessChangeThresholds> // Thresholds for lux changes
|
||||
* <brighteningThresholds> // Thresholds for active mode brightness changes.
|
||||
* <minimum>0.003</minimum> // Minimum change needed in ambient brightness to brighten.
|
||||
* </brighteningThresholds>
|
||||
* <darkeningThresholds>
|
||||
@@ -206,6 +206,24 @@ import javax.xml.datatype.DatatypeConfigurationException;
|
||||
* </darkeningThresholds>
|
||||
* </ambientBrightnessChangeThresholds>
|
||||
*
|
||||
* <displayBrightnessChangeThresholdsIdle> // Thresholds for screen changes in idle mode
|
||||
* <brighteningThresholds> // Thresholds for idle mode brightness changes.
|
||||
* <minimum>0.001</minimum> // Minimum change needed in screen brightness to brighten.
|
||||
* </brighteningThresholds>
|
||||
* <darkeningThresholds>
|
||||
* <minimum>0.002</minimum> // Minimum change needed in screen brightness to darken.
|
||||
* </darkeningThresholds>
|
||||
* </displayBrightnessChangeThresholdsIdle>
|
||||
*
|
||||
* <ambientBrightnessChangeThresholdsIdle> // Thresholds for lux changes in idle mode
|
||||
* <brighteningThresholds> // Thresholds for idle mode brightness changes.
|
||||
* <minimum>0.003</minimum> // Minimum change needed in ambient brightness to brighten.
|
||||
* </brighteningThresholds>
|
||||
* <darkeningThresholds>
|
||||
* <minimum>0.004</minimum> // Minimum change needed in ambient brightness to darken.
|
||||
* </darkeningThresholds>
|
||||
* </ambientBrightnessChangeThresholdsIdle>
|
||||
*
|
||||
* </displayConfiguration>
|
||||
* }
|
||||
* </pre>
|
||||
@@ -319,9 +337,13 @@ public class DisplayDeviceConfig {
|
||||
private int mAmbientHorizonLong = AMBIENT_LIGHT_LONG_HORIZON_MILLIS;
|
||||
private int mAmbientHorizonShort = AMBIENT_LIGHT_SHORT_HORIZON_MILLIS;
|
||||
private float mScreenBrighteningMinThreshold = 0.0f; // Retain behaviour as though there is
|
||||
private float mScreenDarkeningMinThreshold = 0.0f; // no minimum threshold for change in
|
||||
private float mAmbientLuxBrighteningMinThreshold = 0.0f; // screen brightness or ambient
|
||||
private float mAmbientLuxDarkeningMinThreshold = 0.0f; // brightness.
|
||||
private float mScreenBrighteningMinThresholdIdle = 0.0f; // no minimum threshold for change in
|
||||
private float mScreenDarkeningMinThreshold = 0.0f; // screen brightness or ambient
|
||||
private float mScreenDarkeningMinThresholdIdle = 0.0f; // brightness.
|
||||
private float mAmbientLuxBrighteningMinThreshold = 0.0f;
|
||||
private float mAmbientLuxBrighteningMinThresholdIdle = 0.0f;
|
||||
private float mAmbientLuxDarkeningMinThreshold = 0.0f;
|
||||
private float mAmbientLuxDarkeningMinThresholdIdle = 0.0f;
|
||||
private Spline mBrightnessToBacklightSpline;
|
||||
private Spline mBacklightToBrightnessSpline;
|
||||
private Spline mBacklightToNitsSpline;
|
||||
@@ -625,22 +647,76 @@ public class DisplayDeviceConfig {
|
||||
return mAmbientHorizonShort;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the screen brightness increase to actually occur.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getScreenBrighteningMinThreshold() {
|
||||
return mScreenBrighteningMinThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the screen brightness decrease to actually occur.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getScreenDarkeningMinThreshold() {
|
||||
return mScreenDarkeningMinThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the screen brightness increase to actually occur while in idle screen
|
||||
* brightness mode.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getScreenBrighteningMinThresholdIdle() {
|
||||
return mScreenBrighteningMinThresholdIdle;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the screen brightness decrease to actually occur while in idle screen
|
||||
* brightness mode.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getScreenDarkeningMinThresholdIdle() {
|
||||
return mScreenDarkeningMinThresholdIdle;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the ambient lux increase for a screen brightness change to actually
|
||||
* occur.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getAmbientLuxBrighteningMinThreshold() {
|
||||
return mAmbientLuxBrighteningMinThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the ambient lux decrease for a screen brightness change to actually
|
||||
* occur.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getAmbientLuxDarkeningMinThreshold() {
|
||||
return mAmbientLuxDarkeningMinThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the ambient lux increase for a screen brightness change to actually
|
||||
* occur while in idle screen brightness mode.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getAmbientLuxBrighteningMinThresholdIdle() {
|
||||
return mAmbientLuxBrighteningMinThresholdIdle;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum value for the ambient lux decrease for a screen brightness change to actually
|
||||
* occur while in idle screen brightness mode.
|
||||
* @return float value in brightness scale of 0 - 1.
|
||||
*/
|
||||
public float getAmbientLuxDarkeningMinThresholdIdle() {
|
||||
return mAmbientLuxDarkeningMinThresholdIdle;
|
||||
}
|
||||
|
||||
SensorData getAmbientLightSensor() {
|
||||
return mAmbientLightSensor;
|
||||
}
|
||||
@@ -745,9 +821,14 @@ public class DisplayDeviceConfig {
|
||||
+ ", mAmbientHorizonLong=" + mAmbientHorizonLong
|
||||
+ ", mAmbientHorizonShort=" + mAmbientHorizonShort
|
||||
+ ", mScreenDarkeningMinThreshold=" + mScreenDarkeningMinThreshold
|
||||
+ ", mScreenDarkeningMinThresholdIdle=" + mScreenDarkeningMinThresholdIdle
|
||||
+ ", mScreenBrighteningMinThreshold=" + mScreenBrighteningMinThreshold
|
||||
+ ", mScreenBrighteningMinThresholdIdle=" + mScreenBrighteningMinThresholdIdle
|
||||
+ ", mAmbientLuxDarkeningMinThreshold=" + mAmbientLuxDarkeningMinThreshold
|
||||
+ ", mAmbientLuxDarkeningMinThresholdIdle=" + mAmbientLuxDarkeningMinThresholdIdle
|
||||
+ ", mAmbientLuxBrighteningMinThreshold=" + mAmbientLuxBrighteningMinThreshold
|
||||
+ ", mAmbientLuxBrighteningMinThresholdIdle="
|
||||
+ mAmbientLuxBrighteningMinThresholdIdle
|
||||
+ ", mAmbientLightSensor=" + mAmbientLightSensor
|
||||
+ ", mProximitySensor=" + mProximitySensor
|
||||
+ ", mRefreshRateLimitations= " + Arrays.toString(mRefreshRateLimitations.toArray())
|
||||
@@ -1376,24 +1457,34 @@ public class DisplayDeviceConfig {
|
||||
private void loadBrightnessChangeThresholds(DisplayConfiguration config) {
|
||||
Thresholds displayBrightnessThresholds = config.getDisplayBrightnessChangeThresholds();
|
||||
Thresholds ambientBrightnessThresholds = config.getAmbientBrightnessChangeThresholds();
|
||||
Thresholds displayBrightnessThresholdsIdle =
|
||||
config.getDisplayBrightnessChangeThresholdsIdle();
|
||||
Thresholds ambientBrightnessThresholdsIdle =
|
||||
config.getAmbientBrightnessChangeThresholdsIdle();
|
||||
|
||||
loadDisplayBrightnessThresholds(displayBrightnessThresholds);
|
||||
loadAmbientBrightnessThresholds(ambientBrightnessThresholds);
|
||||
loadIdleDisplayBrightnessThresholds(displayBrightnessThresholdsIdle);
|
||||
loadIdleAmbientBrightnessThresholds(ambientBrightnessThresholdsIdle);
|
||||
}
|
||||
|
||||
private void loadDisplayBrightnessThresholds(Thresholds displayBrightnessThresholds) {
|
||||
if (displayBrightnessThresholds != null) {
|
||||
BrightnessThresholds brighteningScreen =
|
||||
displayBrightnessThresholds.getBrighteningThresholds();
|
||||
BrightnessThresholds darkeningScreen =
|
||||
displayBrightnessThresholds.getDarkeningThresholds();
|
||||
|
||||
final BigDecimal screenBrighteningThreshold = brighteningScreen.getMinimum();
|
||||
final BigDecimal screenDarkeningThreshold = darkeningScreen.getMinimum();
|
||||
|
||||
if (screenBrighteningThreshold != null) {
|
||||
mScreenBrighteningMinThreshold = screenBrighteningThreshold.floatValue();
|
||||
if (brighteningScreen != null && brighteningScreen.getMinimum() != null) {
|
||||
mScreenBrighteningMinThreshold = brighteningScreen.getMinimum().floatValue();
|
||||
}
|
||||
if (screenDarkeningThreshold != null) {
|
||||
mScreenDarkeningMinThreshold = screenDarkeningThreshold.floatValue();
|
||||
if (darkeningScreen != null && darkeningScreen.getMinimum() != null) {
|
||||
mScreenDarkeningMinThreshold = darkeningScreen.getMinimum().floatValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadAmbientBrightnessThresholds(Thresholds ambientBrightnessThresholds) {
|
||||
if (ambientBrightnessThresholds != null) {
|
||||
BrightnessThresholds brighteningAmbientLux =
|
||||
ambientBrightnessThresholds.getBrighteningThresholds();
|
||||
@@ -1412,6 +1503,44 @@ public class DisplayDeviceConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadIdleDisplayBrightnessThresholds(Thresholds idleDisplayBrightnessThresholds) {
|
||||
if (idleDisplayBrightnessThresholds != null) {
|
||||
BrightnessThresholds brighteningScreenIdle =
|
||||
idleDisplayBrightnessThresholds.getBrighteningThresholds();
|
||||
BrightnessThresholds darkeningScreenIdle =
|
||||
idleDisplayBrightnessThresholds.getDarkeningThresholds();
|
||||
|
||||
if (brighteningScreenIdle != null
|
||||
&& brighteningScreenIdle.getMinimum() != null) {
|
||||
mScreenBrighteningMinThresholdIdle =
|
||||
brighteningScreenIdle.getMinimum().floatValue();
|
||||
}
|
||||
if (darkeningScreenIdle != null && darkeningScreenIdle.getMinimum() != null) {
|
||||
mScreenDarkeningMinThresholdIdle =
|
||||
darkeningScreenIdle.getMinimum().floatValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadIdleAmbientBrightnessThresholds(Thresholds idleAmbientBrightnessThresholds) {
|
||||
if (idleAmbientBrightnessThresholds != null) {
|
||||
BrightnessThresholds brighteningAmbientLuxIdle =
|
||||
idleAmbientBrightnessThresholds.getBrighteningThresholds();
|
||||
BrightnessThresholds darkeningAmbientLuxIdle =
|
||||
idleAmbientBrightnessThresholds.getDarkeningThresholds();
|
||||
|
||||
if (brighteningAmbientLuxIdle != null
|
||||
&& brighteningAmbientLuxIdle.getMinimum() != null) {
|
||||
mAmbientLuxBrighteningMinThresholdIdle =
|
||||
brighteningAmbientLuxIdle.getMinimum().floatValue();
|
||||
}
|
||||
if (darkeningAmbientLuxIdle != null && darkeningAmbientLuxIdle.getMinimum() != null) {
|
||||
mAmbientLuxDarkeningMinThresholdIdle =
|
||||
darkeningAmbientLuxIdle.getMinimum().floatValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean thermalStatusIsValid(ThermalStatus value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
|
||||
@@ -985,6 +985,25 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels,
|
||||
screenDarkeningMinThreshold, screenBrighteningMinThreshold);
|
||||
|
||||
// Idle screen thresholds
|
||||
float screenDarkeningMinThresholdIdle =
|
||||
mDisplayDeviceConfig.getScreenDarkeningMinThresholdIdle();
|
||||
float screenBrighteningMinThresholdIdle =
|
||||
mDisplayDeviceConfig.getScreenBrighteningMinThresholdIdle();
|
||||
HysteresisLevels screenBrightnessThresholdsIdle = new HysteresisLevels(
|
||||
screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels,
|
||||
screenDarkeningMinThresholdIdle, screenBrighteningMinThresholdIdle);
|
||||
|
||||
// Idle ambient thresholds
|
||||
float ambientDarkeningMinThresholdIdle =
|
||||
mDisplayDeviceConfig.getAmbientLuxDarkeningMinThresholdIdle();
|
||||
float ambientBrighteningMinThresholdIdle =
|
||||
mDisplayDeviceConfig.getAmbientLuxBrighteningMinThresholdIdle();
|
||||
HysteresisLevels ambientBrightnessThresholdsIdle = new HysteresisLevels(
|
||||
ambientBrighteningThresholds, ambientDarkeningThresholds,
|
||||
ambientThresholdLevels, ambientDarkeningMinThresholdIdle,
|
||||
ambientBrighteningMinThresholdIdle);
|
||||
|
||||
long brighteningLightDebounce = mDisplayDeviceConfig
|
||||
.getAutoBrightnessBrighteningLightDebounce();
|
||||
long darkeningLightDebounce = mDisplayDeviceConfig
|
||||
@@ -1020,7 +1039,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
||||
PowerManager.BRIGHTNESS_MIN, PowerManager.BRIGHTNESS_MAX, dozeScaleFactor,
|
||||
lightSensorRate, initialLightSensorRate, brighteningLightDebounce,
|
||||
darkeningLightDebounce, autoBrightnessResetAmbientLuxAfterWarmUp,
|
||||
ambientBrightnessThresholds, screenBrightnessThresholds, mContext,
|
||||
ambientBrightnessThresholds, screenBrightnessThresholds,
|
||||
ambientBrightnessThresholdsIdle, screenBrightnessThresholdsIdle, mContext,
|
||||
mHbmController, mBrightnessThrottler, mIdleModeBrightnessMapper,
|
||||
mDisplayDeviceConfig.getAmbientHorizonShort(),
|
||||
mDisplayDeviceConfig.getAmbientHorizonLong());
|
||||
|
||||
@@ -18,15 +18,12 @@ package com.android.server.display;
|
||||
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* A helper class for handling access to illuminance hysteresis level values.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public class HysteresisLevels {
|
||||
private static final String TAG = "HysteresisLevels";
|
||||
|
||||
|
||||
@@ -97,6 +97,16 @@
|
||||
<xs:annotation name="nonnull"/>
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
<!-- Set of thresholds that dictate the change needed for screen brightness
|
||||
adaptations while in idle mode -->
|
||||
<xs:element type="thresholds" name="displayBrightnessChangeThresholdsIdle" minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
<!-- Set of thresholds that dictate the change needed for ambient brightness
|
||||
adaptations while in idle mode -->
|
||||
<xs:element type="thresholds" name="ambientBrightnessChangeThresholdsIdle" minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
@@ -319,13 +329,13 @@
|
||||
<!-- Thresholds for brightness changes. -->
|
||||
<xs:complexType name="thresholds">
|
||||
<xs:sequence>
|
||||
<!-- Brightening thresholds. -->
|
||||
<!-- Brightening thresholds for active screen brightness mode. -->
|
||||
<xs:element name="brighteningThresholds" type="brightnessThresholds" minOccurs="0"
|
||||
maxOccurs="1" >
|
||||
<xs:annotation name="nonnull"/>
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
<!-- Darkening thresholds. -->
|
||||
<!-- Darkening thresholds for active screen brightness mode. -->
|
||||
<xs:element name="darkeningThresholds" type="brightnessThresholds" minOccurs="0"
|
||||
maxOccurs="1" >
|
||||
<xs:annotation name="nonnull"/>
|
||||
|
||||
@@ -61,11 +61,13 @@ package com.android.server.display.config {
|
||||
public class DisplayConfiguration {
|
||||
ctor public DisplayConfiguration();
|
||||
method @NonNull public final com.android.server.display.config.Thresholds getAmbientBrightnessChangeThresholds();
|
||||
method public final com.android.server.display.config.Thresholds getAmbientBrightnessChangeThresholdsIdle();
|
||||
method public final java.math.BigInteger getAmbientLightHorizonLong();
|
||||
method public final java.math.BigInteger getAmbientLightHorizonShort();
|
||||
method public com.android.server.display.config.AutoBrightness getAutoBrightness();
|
||||
method @Nullable public final com.android.server.display.config.DensityMapping getDensityMapping();
|
||||
method @NonNull public final com.android.server.display.config.Thresholds getDisplayBrightnessChangeThresholds();
|
||||
method public final com.android.server.display.config.Thresholds getDisplayBrightnessChangeThresholdsIdle();
|
||||
method public com.android.server.display.config.HighBrightnessMode getHighBrightnessMode();
|
||||
method public final com.android.server.display.config.SensorDetails getLightSensor();
|
||||
method public final com.android.server.display.config.SensorDetails getProxSensor();
|
||||
@@ -80,11 +82,13 @@ package com.android.server.display.config {
|
||||
method public final java.math.BigDecimal getScreenBrightnessRampSlowIncrease();
|
||||
method @NonNull public final com.android.server.display.config.ThermalThrottling getThermalThrottling();
|
||||
method public final void setAmbientBrightnessChangeThresholds(@NonNull com.android.server.display.config.Thresholds);
|
||||
method public final void setAmbientBrightnessChangeThresholdsIdle(com.android.server.display.config.Thresholds);
|
||||
method public final void setAmbientLightHorizonLong(java.math.BigInteger);
|
||||
method public final void setAmbientLightHorizonShort(java.math.BigInteger);
|
||||
method public void setAutoBrightness(com.android.server.display.config.AutoBrightness);
|
||||
method public final void setDensityMapping(@Nullable com.android.server.display.config.DensityMapping);
|
||||
method public final void setDisplayBrightnessChangeThresholds(@NonNull com.android.server.display.config.Thresholds);
|
||||
method public final void setDisplayBrightnessChangeThresholdsIdle(com.android.server.display.config.Thresholds);
|
||||
method public void setHighBrightnessMode(com.android.server.display.config.HighBrightnessMode);
|
||||
method public final void setLightSensor(com.android.server.display.config.SensorDetails);
|
||||
method public final void setProxSensor(com.android.server.display.config.SensorDetails);
|
||||
|
||||
@@ -82,6 +82,8 @@ public class AutomaticBrightnessControllerTest {
|
||||
@Mock BrightnessMappingStrategy mIdleBrightnessMappingStrategy;
|
||||
@Mock HysteresisLevels mAmbientBrightnessThresholds;
|
||||
@Mock HysteresisLevels mScreenBrightnessThresholds;
|
||||
@Mock HysteresisLevels mAmbientBrightnessThresholdsIdle;
|
||||
@Mock HysteresisLevels mScreenBrightnessThresholdsIdle;
|
||||
@Mock Handler mNoOpHandler;
|
||||
@Mock HighBrightnessModeController mHbmController;
|
||||
@Mock BrightnessThrottler mBrightnessThrottler;
|
||||
@@ -129,6 +131,7 @@ public class AutomaticBrightnessControllerTest {
|
||||
INITIAL_LIGHT_SENSOR_RATE, BRIGHTENING_LIGHT_DEBOUNCE_CONFIG,
|
||||
DARKENING_LIGHT_DEBOUNCE_CONFIG, RESET_AMBIENT_LUX_AFTER_WARMUP_CONFIG,
|
||||
mAmbientBrightnessThresholds, mScreenBrightnessThresholds,
|
||||
mAmbientBrightnessThresholdsIdle, mScreenBrightnessThresholdsIdle,
|
||||
mContext, mHbmController, mBrightnessThrottler, mIdleBrightnessMappingStrategy,
|
||||
AMBIENT_LIGHT_HORIZON_SHORT, AMBIENT_LIGHT_HORIZON_LONG
|
||||
);
|
||||
@@ -314,8 +317,9 @@ public class AutomaticBrightnessControllerTest {
|
||||
|
||||
// Now let's do the same for idle mode
|
||||
mController.switchToIdleMode();
|
||||
// Called once for init, and once when switching
|
||||
verify(mBrightnessMappingStrategy, times(2)).isForIdleMode();
|
||||
// Called once for init, and once when switching,
|
||||
// setAmbientLux() is called twice and once in updateAutoBrightness()
|
||||
verify(mBrightnessMappingStrategy, times(5)).isForIdleMode();
|
||||
// Ensure, after switching, original BMS is not used anymore
|
||||
verifyNoMoreInteractions(mBrightnessMappingStrategy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user