summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Hong <rurumihong@google.com>2022-03-07 20:46:12 +0800
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-10 07:29:02 +0000
commitb464ef4dc204d4de70211289b32cd5cf2db53ce9 (patch)
treec1053d1ec1cfb8a8a562edd57cdc17949ae6baf3
parent340a7fdfa41bda515f31cb9f61072f151dfbe432 (diff)
downloadbase-b464ef4dc204d4de70211289b32cd5cf2db53ce9.tar.gz
Revert "[RESTRICT AUTOMERGE] Make thresholds tuneable in the ddc"
This reverts commit 7ace3f267538f0f4ddec44f7711d3d268c4b58dc. Revert reason: Check if this causes AOC regression Bug: 223124178 Change-Id: Ia22b68ff8763cea754cfbd22fd7a46893f1f62ac (cherry picked from commit 5ca0a453e2b269a6422a3943a599884869ae96ac) Merged-In: Ia22b68ff8763cea754cfbd22fd7a46893f1f62ac
-rw-r--r--services/core/java/com/android/server/display/DisplayDeviceConfig.java66
-rw-r--r--services/core/java/com/android/server/display/DisplayPowerController.java14
-rw-r--r--services/core/java/com/android/server/display/HysteresisLevels.java24
-rw-r--r--services/core/xsd/display-device-config/display-device-config.xsd48
-rw-r--r--services/core/xsd/display-device-config/schema/current.txt18
5 files changed, 15 insertions, 155 deletions
diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
index 255494f98667..2ae5cbbbf24b 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java
@@ -31,7 +31,6 @@ import android.view.DisplayAddress;
import com.android.internal.R;
import com.android.internal.display.BrightnessSynchronizer;
-import com.android.server.display.config.BrightnessThresholds;
import com.android.server.display.config.DisplayConfiguration;
import com.android.server.display.config.DisplayQuirks;
import com.android.server.display.config.HbmTiming;
@@ -41,7 +40,6 @@ import com.android.server.display.config.Point;
import com.android.server.display.config.RefreshRateRange;
import com.android.server.display.config.SensorDetails;
import com.android.server.display.config.ThermalStatus;
-import com.android.server.display.config.Thresholds;
import com.android.server.display.config.XmlParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -117,10 +115,6 @@ public class DisplayDeviceConfig {
private float mBrightnessRampFastIncrease = Float.NaN;
private float mBrightnessRampSlowDecrease = Float.NaN;
private float mBrightnessRampSlowIncrease = Float.NaN;
- 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 Spline mBrightnessToBacklightSpline;
private Spline mBacklightToBrightnessSpline;
private Spline mBacklightToNitsSpline;
@@ -288,22 +282,6 @@ public class DisplayDeviceConfig {
return mBrightnessRampSlowIncrease;
}
- public float getScreenBrighteningMinThreshold() {
- return mScreenBrighteningMinThreshold;
- }
-
- public float getScreenDarkeningMinThreshold() {
- return mScreenDarkeningMinThreshold;
- }
-
- public float getAmbientLuxBrighteningMinThreshold() {
- return mAmbientLuxBrighteningMinThreshold;
- }
-
- public float getAmbientLuxDarkeningMinThreshold() {
- return mAmbientLuxDarkeningMinThreshold;
- }
-
SensorData getAmbientLightSensor() {
return mAmbientLightSensor;
}
@@ -359,10 +337,6 @@ public class DisplayDeviceConfig {
+ ", mBrightnessRampFastIncrease=" + mBrightnessRampFastIncrease
+ ", mBrightnessRampSlowDecrease=" + mBrightnessRampSlowDecrease
+ ", mBrightnessRampSlowIncrease=" + mBrightnessRampSlowIncrease
- + ", mScreenDarkeningMinThreshold=" + mScreenDarkeningMinThreshold
- + ", mScreenBrighteningMinThreshold=" + mScreenBrighteningMinThreshold
- + ", mAmbientLuxDarkeningMinThreshold=" + mAmbientLuxDarkeningMinThreshold
- + ", mAmbientLuxBrighteningMinThreshold=" + mAmbientLuxBrighteningMinThreshold
+ ", mAmbientLightSensor=" + mAmbientLightSensor
+ ", mProximitySensor=" + mProximitySensor
+ ", mRefreshRateLimitations= " + Arrays.toString(mRefreshRateLimitations.toArray())
@@ -418,7 +392,6 @@ public class DisplayDeviceConfig {
loadBrightnessRamps(config);
loadAmbientLightSensorFromDdc(config);
loadProxSensorFromDdc(config);
- loadBrightnessChangeThresholds(config);
} else {
Slog.w(TAG, "DisplayDeviceConfig file is null");
}
@@ -773,45 +746,6 @@ public class DisplayDeviceConfig {
}
}
- private void loadBrightnessChangeThresholds(DisplayConfiguration config) {
- Thresholds displayBrightnessThresholds = config.getDisplayBrightnessChangeThresholds();
- Thresholds ambientBrightnessThresholds = config.getAmbientBrightnessChangeThresholds();
-
- 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 (screenDarkeningThreshold != null) {
- mScreenDarkeningMinThreshold = screenDarkeningThreshold.floatValue();
- }
- }
-
- if (ambientBrightnessThresholds != null) {
- BrightnessThresholds brighteningAmbientLux =
- ambientBrightnessThresholds.getBrighteningThresholds();
- BrightnessThresholds darkeningAmbientLux =
- ambientBrightnessThresholds.getDarkeningThresholds();
-
- final BigDecimal ambientBrighteningThreshold = brighteningAmbientLux.getMinimum();
- final BigDecimal ambientDarkeningThreshold = darkeningAmbientLux.getMinimum();
-
- if (ambientBrighteningThreshold != null) {
- mAmbientLuxBrighteningMinThreshold = ambientBrighteningThreshold.floatValue();
- }
- if (ambientDarkeningThreshold != null) {
- mAmbientLuxDarkeningMinThreshold = ambientDarkeningThreshold.floatValue();
- }
- }
- }
-
private @PowerManager.ThermalStatus int convertThermalStatus(ThermalStatus value) {
if (value == null) {
return PowerManager.THERMAL_STATUS_NONE;
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index e4cda38e4ae5..22dd2c05c157 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -880,14 +880,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
com.android.internal.R.array.config_ambientDarkeningThresholds);
int[] ambientThresholdLevels = resources.getIntArray(
com.android.internal.R.array.config_ambientThresholdLevels);
- float ambientDarkeningMinThreshold =
- mDisplayDeviceConfig.getAmbientLuxDarkeningMinThreshold();
- float ambientBrighteningMinThreshold =
- mDisplayDeviceConfig.getAmbientLuxBrighteningMinThreshold();
HysteresisLevels ambientBrightnessThresholds = new HysteresisLevels(
ambientBrighteningThresholds, ambientDarkeningThresholds,
- ambientThresholdLevels, ambientDarkeningMinThreshold,
- ambientBrighteningMinThreshold);
+ ambientThresholdLevels);
int[] screenBrighteningThresholds = resources.getIntArray(
com.android.internal.R.array.config_screenBrighteningThresholds);
@@ -895,13 +890,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
com.android.internal.R.array.config_screenDarkeningThresholds);
int[] screenThresholdLevels = resources.getIntArray(
com.android.internal.R.array.config_screenThresholdLevels);
- float screenDarkeningMinThreshold =
- mDisplayDeviceConfig.getScreenDarkeningMinThreshold();
- float screenBrighteningMinThreshold =
- mDisplayDeviceConfig.getScreenBrighteningMinThreshold();
HysteresisLevels screenBrightnessThresholds = new HysteresisLevels(
- screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels,
- screenDarkeningMinThreshold, screenBrighteningMinThreshold);
+ screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels);
long brighteningLightDebounce = resources.getInteger(
com.android.internal.R.integer.config_autoBrightnessBrighteningLightDebounce);
diff --git a/services/core/java/com/android/server/display/HysteresisLevels.java b/services/core/java/com/android/server/display/HysteresisLevels.java
index 7a932ce6d7cf..2b565698ff8c 100644
--- a/services/core/java/com/android/server/display/HysteresisLevels.java
+++ b/services/core/java/com/android/server/display/HysteresisLevels.java
@@ -30,13 +30,17 @@ import java.util.Arrays;
public class HysteresisLevels {
private static final String TAG = "HysteresisLevels";
+ // Default hysteresis constraints for brightening or darkening.
+ // The recent value must have changed by at least this fraction relative to the
+ // current value before a change will be considered.
+ private static final float DEFAULT_BRIGHTENING_HYSTERESIS = 0.10f;
+ private static final float DEFAULT_DARKENING_HYSTERESIS = 0.20f;
+
private static final boolean DEBUG = false;
private final float[] mBrighteningThresholds;
private final float[] mDarkeningThresholds;
private final float[] mThresholdLevels;
- private final float mMinDarkening;
- private final float mMinBrightening;
/**
* Creates a {@code HysteresisLevels} object with the given equal-length
@@ -44,12 +48,9 @@ public class HysteresisLevels {
* @param brighteningThresholds an array of brightening hysteresis constraint constants.
* @param darkeningThresholds an array of darkening hysteresis constraint constants.
* @param thresholdLevels a monotonically increasing array of threshold levels.
- * @param minBrighteningThreshold the minimum value for which the brightening value needs to
- * return.
- * @param minDarkeningThreshold the minimum value for which the darkening value needs to return.
*/
HysteresisLevels(int[] brighteningThresholds, int[] darkeningThresholds,
- int[] thresholdLevels, float minDarkeningThreshold, float minBrighteningThreshold) {
+ int[] thresholdLevels) {
if (brighteningThresholds.length != darkeningThresholds.length
|| darkeningThresholds.length != thresholdLevels.length + 1) {
throw new IllegalArgumentException("Mismatch between hysteresis array lengths.");
@@ -57,8 +58,6 @@ public class HysteresisLevels {
mBrighteningThresholds = setArrayFormat(brighteningThresholds, 1000.0f);
mDarkeningThresholds = setArrayFormat(darkeningThresholds, 1000.0f);
mThresholdLevels = setArrayFormat(thresholdLevels, 1.0f);
- mMinDarkening = minDarkeningThreshold;
- mMinBrightening = minBrighteningThreshold;
}
/**
@@ -66,13 +65,11 @@ public class HysteresisLevels {
*/
public float getBrighteningThreshold(float value) {
final float brightConstant = getReferenceLevel(value, mBrighteningThresholds);
- float brightThreshold = value * (1.0f + brightConstant);
+ final float brightThreshold = value * (1.0f + brightConstant);
if (DEBUG) {
Slog.d(TAG, "bright hysteresis constant=" + brightConstant + ", threshold="
+ brightThreshold + ", value=" + value);
}
-
- brightThreshold = Math.max(brightThreshold, value + mMinBrightening);
return brightThreshold;
}
@@ -81,13 +78,12 @@ public class HysteresisLevels {
*/
public float getDarkeningThreshold(float value) {
final float darkConstant = getReferenceLevel(value, mDarkeningThresholds);
- float darkThreshold = value * (1.0f - darkConstant);
+ final float darkThreshold = value * (1.0f - darkConstant);
if (DEBUG) {
Slog.d(TAG, "dark hysteresis constant=: " + darkConstant + ", threshold="
+ darkThreshold + ", value=" + value);
}
- darkThreshold = Math.min(darkThreshold, value - mMinDarkening);
- return Math.max(darkThreshold, 0.0f);
+ return darkThreshold;
}
/**
diff --git a/services/core/xsd/display-device-config/display-device-config.xsd b/services/core/xsd/display-device-config/display-device-config.xsd
index a98483c6d03b..429edf175be4 100644
--- a/services/core/xsd/display-device-config/display-device-config.xsd
+++ b/services/core/xsd/display-device-config/display-device-config.xsd
@@ -34,8 +34,7 @@
<xs:annotation name="nonnull"/>
<xs:annotation name="final"/>
</xs:element>
- <xs:element type="highBrightnessMode" name="highBrightnessMode" minOccurs="0"
- maxOccurs="1"/>
+ <xs:element type="highBrightnessMode" name="highBrightnessMode" minOccurs="0" maxOccurs="1"/>
<xs:element type="displayQuirks" name="quirks" minOccurs="0" maxOccurs="1" />
<xs:element type="nonNegativeDecimal" name="screenBrightnessRampFastDecrease">
<xs:annotation name="final"/>
@@ -55,19 +54,6 @@
<xs:element type="sensorDetails" name="proxSensor">
<xs:annotation name="final"/>
</xs:element>
-
- <!-- Set of thresholds that dictate the change needed for screen brightness
- adaptations -->
- <xs:element type="thresholds" name="displayBrightnessChangeThresholds">
- <xs:annotation name="nonnull"/>
- <xs:annotation name="final"/>
- </xs:element>
- <!-- Set of thresholds that dictate the change needed for ambient brightness
- adaptations -->
- <xs:element type="thresholds" name="ambientBrightnessChangeThresholds">
- <xs:annotation name="nonnull"/>
- <xs:annotation name="final"/>
- </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -82,8 +68,7 @@
<xs:complexType name="highBrightnessMode">
<xs:all>
- <xs:element name="transitionPoint" type="nonNegativeDecimal" minOccurs="1"
- maxOccurs="1">
+ <xs:element name="transitionPoint" type="nonNegativeDecimal" minOccurs="1" maxOccurs="1">
<xs:annotation name="nonnull"/>
<xs:annotation name="final"/>
</xs:element>
@@ -112,8 +97,7 @@
<xs:complexType name="hbmTiming">
<xs:all>
- <xs:element name="timeWindowSecs" type="xs:nonNegativeInteger" minOccurs="1"
- maxOccurs="1">
+ <xs:element name="timeWindowSecs" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1">
<xs:annotation name="nonnull"/>
<xs:annotation name="final"/>
</xs:element>
@@ -197,31 +181,5 @@
</xs:sequence>
</xs:complexType>
- <!-- Thresholds for brightness changes. -->
- <xs:complexType name="thresholds">
- <xs:sequence>
- <!-- Brightening thresholds. -->
- <xs:element name="brighteningThresholds" type="brightnessThresholds" minOccurs="0"
- maxOccurs="1" >
- <xs:annotation name="nonnull"/>
- <xs:annotation name="final"/>
- </xs:element>
- <!-- Darkening thresholds. -->
- <xs:element name="darkeningThresholds" type="brightnessThresholds" minOccurs="0"
- maxOccurs="1" >
- <xs:annotation name="nonnull"/>
- <xs:annotation name="final"/>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
-
- <!-- Brightening and darkening minimum change thresholds. -->
- <xs:complexType name="brightnessThresholds">
- <!-- Minimum brightness change needed. -->
- <xs:element name="minimum" type="nonNegativeDecimal" minOccurs="0" maxOccurs="1" >
- <xs:annotation name="nonnull"/>
- <xs:annotation name="final"/>
- </xs:element>
- </xs:complexType>
</xs:schema>
diff --git a/services/core/xsd/display-device-config/schema/current.txt b/services/core/xsd/display-device-config/schema/current.txt
index df468d41fdef..ad186026d30c 100644
--- a/services/core/xsd/display-device-config/schema/current.txt
+++ b/services/core/xsd/display-device-config/schema/current.txt
@@ -1,16 +1,8 @@
// Signature format: 2.0
package com.android.server.display.config {
- public class BrightnessThresholds {
- ctor public BrightnessThresholds();
- method @NonNull public final java.math.BigDecimal getMinimum();
- method public final void setMinimum(@NonNull java.math.BigDecimal);
- }
-
public class DisplayConfiguration {
ctor public DisplayConfiguration();
- method @NonNull public final com.android.server.display.config.Thresholds getAmbientBrightnessChangeThresholds();
- method @NonNull public final com.android.server.display.config.Thresholds getDisplayBrightnessChangeThresholds();
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();
@@ -21,8 +13,6 @@ package com.android.server.display.config {
method public final java.math.BigDecimal getScreenBrightnessRampFastIncrease();
method public final java.math.BigDecimal getScreenBrightnessRampSlowDecrease();
method public final java.math.BigDecimal getScreenBrightnessRampSlowIncrease();
- method public final void setAmbientBrightnessChangeThresholds(@NonNull com.android.server.display.config.Thresholds);
- method public final void setDisplayBrightnessChangeThresholds(@NonNull 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);
@@ -110,14 +100,6 @@ package com.android.server.display.config {
enum_constant public static final com.android.server.display.config.ThermalStatus shutdown;
}
- public class Thresholds {
- ctor public Thresholds();
- method @NonNull public final com.android.server.display.config.BrightnessThresholds getBrighteningThresholds();
- method @NonNull public final com.android.server.display.config.BrightnessThresholds getDarkeningThresholds();
- method public final void setBrighteningThresholds(@NonNull com.android.server.display.config.BrightnessThresholds);
- method public final void setDarkeningThresholds(@NonNull com.android.server.display.config.BrightnessThresholds);
- }
-
public class XmlParser {
ctor public XmlParser();
method public static com.android.server.display.config.DisplayConfiguration read(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException;