Loading services/core/java/com/android/server/display/DisplayDeviceConfig.java +66 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ import com.android.server.display.config.DisplayQuirks; import com.android.server.display.config.HbmTiming; import com.android.server.display.config.HdrBrightnessData; import com.android.server.display.config.HighBrightnessMode; import com.android.server.display.config.IdleScreenRefreshRateTimeout; import com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholdPoint; import com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholds; import com.android.server.display.config.IntegerArray; import com.android.server.display.config.LuxThrottling; import com.android.server.display.config.NitsMap; Loading Loading @@ -553,6 +556,18 @@ import javax.xml.datatype.DatatypeConfigurationException; * <minorVersion>0</minorVersion> * </usiVersion> * <screenBrightnessCapForWearBedtimeMode>0.1</screenBrightnessCapForWearBedtimeMode> * <idleScreenRefreshRateTimeout> * <luxThresholds> * <point> * <lux>6</lux> * <timeout>1000</timeout> * </point> * <point> * <lux>10</lux> * <timeout>800</timeout> * </point> * </luxThresholds> * </idleScreenRefreshRateTimeout> * </displayConfiguration> * } * </pre> Loading Loading @@ -843,6 +858,14 @@ public class DisplayDeviceConfig { private final Map<BrightnessLimitMapType, Map<Float, Float>> mLuxThrottlingData = new HashMap<>(); /** * The idle screen timeout configuration for switching to lower refresh rate */ @NonNull private List<IdleScreenRefreshRateTimeoutLuxThresholdPoint> mIdleScreenRefreshRateTimeoutLuxThresholds = new ArrayList<>(); @Nullable private HostUsiVersion mHostUsiVersion; Loading Loading @@ -1999,6 +2022,7 @@ public class DisplayDeviceConfig { loadUsiVersion(config); mHdrBrightnessData = HdrBrightnessData.loadConfig(config); loadBrightnessCapForWearBedtimeMode(config); loadIdleScreenRefreshRateTimeoutConfigs(config); } else { Slog.w(TAG, "DisplayDeviceConfig file is null"); } Loading @@ -2024,6 +2048,7 @@ public class DisplayDeviceConfig { loadAutoBrightnessAvailableFromConfigXml(); loadRefreshRateSetting(null); loadBrightnessCapForWearBedtimeModeFromConfigXml(); loadIdleScreenRefreshRateTimeoutConfigs(null); mLoadedFrom = "<config.xml>"; } Loading Loading @@ -3326,6 +3351,47 @@ public class DisplayDeviceConfig { } } private void loadIdleScreenRefreshRateTimeoutConfigs(@Nullable DisplayConfiguration config) { if (mFlags.isIdleScreenRefreshRateTimeoutEnabled() && config != null && config.getIdleScreenRefreshRateTimeout() != null) { validateIdleScreenRefreshRateTimeoutConfig( config.getIdleScreenRefreshRateTimeout()); mIdleScreenRefreshRateTimeoutLuxThresholds = config .getIdleScreenRefreshRateTimeout().getLuxThresholds().getPoint(); } } private void validateIdleScreenRefreshRateTimeoutConfig( IdleScreenRefreshRateTimeout idleScreenRefreshRateTimeoutConfig) { IdleScreenRefreshRateTimeoutLuxThresholds idleScreenRefreshRateTimeoutLuxThresholds = idleScreenRefreshRateTimeoutConfig.getLuxThresholds(); if (idleScreenRefreshRateTimeoutLuxThresholds != null) { int previousLux = -1; // Validate that the lux values are in the increasing order for (IdleScreenRefreshRateTimeoutLuxThresholdPoint point : idleScreenRefreshRateTimeoutLuxThresholds.getPoint()) { int newLux = point.getLux().intValue(); if (previousLux >= newLux) { throw new RuntimeException("Lux values should be in ascending order in the" + " idle screen refresh rate timeout config"); } previousLux = newLux; } } } /** * Gets the idle screen refresh rate timeout(in ms) configuration list. For each entry, the lux * value represent the lower bound of the lux range, and the value of the lux in the next * point(INF if not present) represents the upper bound for the corresponding timeout(in ms) */ @NonNull public List<IdleScreenRefreshRateTimeoutLuxThresholdPoint> getIdleScreenRefreshRateTimeoutLuxThresholdPoint() { return mIdleScreenRefreshRateTimeoutLuxThresholds; } /** * Extracts a float array from the specified {@link TypedArray}. * Loading services/core/java/com/android/server/display/feature/DisplayManagerFlags.java +10 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,11 @@ public class DisplayManagerFlags { Flags::sensorBasedBrightnessThrottling ); private final FlagState mIdleScreenRefreshRateTimeout = new FlagState( Flags.FLAG_IDLE_SCREEN_REFRESH_RATE_TIMEOUT, Flags::idleScreenRefreshRateTimeout ); private final FlagState mRefactorDisplayPowerController = new FlagState( Flags.FLAG_REFACTOR_DISPLAY_POWER_CONTROLLER, Loading Loading @@ -280,6 +285,10 @@ public class DisplayManagerFlags { return mSensorBasedBrightnessThrottling.isEnabled(); } public boolean isIdleScreenRefreshRateTimeoutEnabled() { return mIdleScreenRefreshRateTimeout.isEnabled(); } public boolean isRefactorDisplayPowerControllerEnabled() { return mRefactorDisplayPowerController.isEnabled(); } Loading Loading @@ -310,6 +319,7 @@ public class DisplayManagerFlags { pw.println(" " + mRefreshRateVotingTelemetry); pw.println(" " + mPixelAnisotropyCorrectionEnabled); pw.println(" " + mSensorBasedBrightnessThrottling); pw.println(" " + mIdleScreenRefreshRateTimeout); pw.println(" " + mRefactorDisplayPowerController); } Loading services/core/java/com/android/server/display/feature/display_flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -219,3 +219,11 @@ flag { bug: "294444204" is_fixed_read_only: true } flag { name: "idle_screen_refresh_rate_timeout" namespace: "display_manager" description: "Feature flag for reducing the refresh rate when the screen is idle after a timeout" bug: "310026579" is_fixed_read_only: true } services/core/xsd/display-device-config/display-device-config.xsd +28 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,10 @@ <xs:element type="nonNegativeDecimal" name="screenBrightnessCapForWearBedtimeMode"> <xs:annotation name="final"/> </xs:element> <!-- Timeout after which we reduce the refresh rate if the screen has been idle, in order to save power. --> <xs:element type="idleScreenRefreshRateTimeout" name="idleScreenRefreshRateTimeout" minOccurs="0"> <xs:annotation name="final"/> </xs:element> </xs:sequence> </xs:complexType> </xs:element> Loading Loading @@ -772,6 +776,30 @@ </xs:sequence> </xs:complexType> <xs:complexType name="idleScreenRefreshRateTimeout"> <xs:element name="luxThresholds" type="idleScreenRefreshRateTimeoutLuxThresholds" minOccurs="0"> <xs:annotation name="final"/> </xs:element> </xs:complexType> <!-- Lux based timeout after which we reduce the refresh rate if the screen has been idle, in order to save power. --> <xs:complexType name="idleScreenRefreshRateTimeoutLuxThresholds"> <xs:sequence> <xs:element name="point" type="idleScreenRefreshRateTimeoutLuxThresholdPoint" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> <!-- Represents a tuple of lux and timeout(in ms), which represents the timeout value for the lux in the [luxValue, nextLuxValue (INF if missing)) --> <xs:complexType name="idleScreenRefreshRateTimeoutLuxThresholdPoint"> <xs:element name="lux" type="xs:nonNegativeInteger"> <xs:annotation name="final"/> </xs:element> <xs:element name="timeout" type="xs:nonNegativeInteger"> <xs:annotation name="final"/> </xs:element> </xs:complexType> <!-- Predefined type names as defined by AutomaticBrightnessController.AutomaticBrightnessMode --> <xs:simpleType name="AutoBrightnessModeName"> Loading services/core/xsd/display-device-config/schema/current.txt +21 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ package com.android.server.display.config { method public final com.android.server.display.config.Thresholds getDisplayBrightnessChangeThresholdsIdle(); method @Nullable public final com.android.server.display.config.HdrBrightnessConfig getHdrBrightnessConfig(); method public com.android.server.display.config.HighBrightnessMode getHighBrightnessMode(); method public final com.android.server.display.config.IdleScreenRefreshRateTimeout getIdleScreenRefreshRateTimeout(); method public final com.android.server.display.config.SensorDetails getLightSensor(); method public com.android.server.display.config.LuxThrottling getLuxThrottling(); method @Nullable public final String getName(); Loading Loading @@ -146,6 +147,7 @@ package com.android.server.display.config { method public final void setDisplayBrightnessChangeThresholdsIdle(com.android.server.display.config.Thresholds); method public final void setHdrBrightnessConfig(@Nullable com.android.server.display.config.HdrBrightnessConfig); method public void setHighBrightnessMode(com.android.server.display.config.HighBrightnessMode); method public final void setIdleScreenRefreshRateTimeout(com.android.server.display.config.IdleScreenRefreshRateTimeout); method public final void setLightSensor(com.android.server.display.config.SensorDetails); method public void setLuxThrottling(com.android.server.display.config.LuxThrottling); method public final void setName(@Nullable String); Loading Loading @@ -222,6 +224,25 @@ package com.android.server.display.config { method public final void setTransitionPoint_all(@NonNull java.math.BigDecimal); } public class IdleScreenRefreshRateTimeout { ctor public IdleScreenRefreshRateTimeout(); method public final com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholds getLuxThresholds(); method public final void setLuxThresholds(com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholds); } public class IdleScreenRefreshRateTimeoutLuxThresholdPoint { ctor public IdleScreenRefreshRateTimeoutLuxThresholdPoint(); method public final java.math.BigInteger getLux(); method public final java.math.BigInteger getTimeout(); method public final void setLux(java.math.BigInteger); method public final void setTimeout(java.math.BigInteger); } public class IdleScreenRefreshRateTimeoutLuxThresholds { ctor public IdleScreenRefreshRateTimeoutLuxThresholds(); method public java.util.List<com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholdPoint> getPoint(); } public class IntegerArray { ctor public IntegerArray(); method public java.util.List<java.math.BigInteger> getItem(); Loading Loading
services/core/java/com/android/server/display/DisplayDeviceConfig.java +66 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ import com.android.server.display.config.DisplayQuirks; import com.android.server.display.config.HbmTiming; import com.android.server.display.config.HdrBrightnessData; import com.android.server.display.config.HighBrightnessMode; import com.android.server.display.config.IdleScreenRefreshRateTimeout; import com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholdPoint; import com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholds; import com.android.server.display.config.IntegerArray; import com.android.server.display.config.LuxThrottling; import com.android.server.display.config.NitsMap; Loading Loading @@ -553,6 +556,18 @@ import javax.xml.datatype.DatatypeConfigurationException; * <minorVersion>0</minorVersion> * </usiVersion> * <screenBrightnessCapForWearBedtimeMode>0.1</screenBrightnessCapForWearBedtimeMode> * <idleScreenRefreshRateTimeout> * <luxThresholds> * <point> * <lux>6</lux> * <timeout>1000</timeout> * </point> * <point> * <lux>10</lux> * <timeout>800</timeout> * </point> * </luxThresholds> * </idleScreenRefreshRateTimeout> * </displayConfiguration> * } * </pre> Loading Loading @@ -843,6 +858,14 @@ public class DisplayDeviceConfig { private final Map<BrightnessLimitMapType, Map<Float, Float>> mLuxThrottlingData = new HashMap<>(); /** * The idle screen timeout configuration for switching to lower refresh rate */ @NonNull private List<IdleScreenRefreshRateTimeoutLuxThresholdPoint> mIdleScreenRefreshRateTimeoutLuxThresholds = new ArrayList<>(); @Nullable private HostUsiVersion mHostUsiVersion; Loading Loading @@ -1999,6 +2022,7 @@ public class DisplayDeviceConfig { loadUsiVersion(config); mHdrBrightnessData = HdrBrightnessData.loadConfig(config); loadBrightnessCapForWearBedtimeMode(config); loadIdleScreenRefreshRateTimeoutConfigs(config); } else { Slog.w(TAG, "DisplayDeviceConfig file is null"); } Loading @@ -2024,6 +2048,7 @@ public class DisplayDeviceConfig { loadAutoBrightnessAvailableFromConfigXml(); loadRefreshRateSetting(null); loadBrightnessCapForWearBedtimeModeFromConfigXml(); loadIdleScreenRefreshRateTimeoutConfigs(null); mLoadedFrom = "<config.xml>"; } Loading Loading @@ -3326,6 +3351,47 @@ public class DisplayDeviceConfig { } } private void loadIdleScreenRefreshRateTimeoutConfigs(@Nullable DisplayConfiguration config) { if (mFlags.isIdleScreenRefreshRateTimeoutEnabled() && config != null && config.getIdleScreenRefreshRateTimeout() != null) { validateIdleScreenRefreshRateTimeoutConfig( config.getIdleScreenRefreshRateTimeout()); mIdleScreenRefreshRateTimeoutLuxThresholds = config .getIdleScreenRefreshRateTimeout().getLuxThresholds().getPoint(); } } private void validateIdleScreenRefreshRateTimeoutConfig( IdleScreenRefreshRateTimeout idleScreenRefreshRateTimeoutConfig) { IdleScreenRefreshRateTimeoutLuxThresholds idleScreenRefreshRateTimeoutLuxThresholds = idleScreenRefreshRateTimeoutConfig.getLuxThresholds(); if (idleScreenRefreshRateTimeoutLuxThresholds != null) { int previousLux = -1; // Validate that the lux values are in the increasing order for (IdleScreenRefreshRateTimeoutLuxThresholdPoint point : idleScreenRefreshRateTimeoutLuxThresholds.getPoint()) { int newLux = point.getLux().intValue(); if (previousLux >= newLux) { throw new RuntimeException("Lux values should be in ascending order in the" + " idle screen refresh rate timeout config"); } previousLux = newLux; } } } /** * Gets the idle screen refresh rate timeout(in ms) configuration list. For each entry, the lux * value represent the lower bound of the lux range, and the value of the lux in the next * point(INF if not present) represents the upper bound for the corresponding timeout(in ms) */ @NonNull public List<IdleScreenRefreshRateTimeoutLuxThresholdPoint> getIdleScreenRefreshRateTimeoutLuxThresholdPoint() { return mIdleScreenRefreshRateTimeoutLuxThresholds; } /** * Extracts a float array from the specified {@link TypedArray}. * Loading
services/core/java/com/android/server/display/feature/DisplayManagerFlags.java +10 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,11 @@ public class DisplayManagerFlags { Flags::sensorBasedBrightnessThrottling ); private final FlagState mIdleScreenRefreshRateTimeout = new FlagState( Flags.FLAG_IDLE_SCREEN_REFRESH_RATE_TIMEOUT, Flags::idleScreenRefreshRateTimeout ); private final FlagState mRefactorDisplayPowerController = new FlagState( Flags.FLAG_REFACTOR_DISPLAY_POWER_CONTROLLER, Loading Loading @@ -280,6 +285,10 @@ public class DisplayManagerFlags { return mSensorBasedBrightnessThrottling.isEnabled(); } public boolean isIdleScreenRefreshRateTimeoutEnabled() { return mIdleScreenRefreshRateTimeout.isEnabled(); } public boolean isRefactorDisplayPowerControllerEnabled() { return mRefactorDisplayPowerController.isEnabled(); } Loading Loading @@ -310,6 +319,7 @@ public class DisplayManagerFlags { pw.println(" " + mRefreshRateVotingTelemetry); pw.println(" " + mPixelAnisotropyCorrectionEnabled); pw.println(" " + mSensorBasedBrightnessThrottling); pw.println(" " + mIdleScreenRefreshRateTimeout); pw.println(" " + mRefactorDisplayPowerController); } Loading
services/core/java/com/android/server/display/feature/display_flags.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -219,3 +219,11 @@ flag { bug: "294444204" is_fixed_read_only: true } flag { name: "idle_screen_refresh_rate_timeout" namespace: "display_manager" description: "Feature flag for reducing the refresh rate when the screen is idle after a timeout" bug: "310026579" is_fixed_read_only: true }
services/core/xsd/display-device-config/display-device-config.xsd +28 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,10 @@ <xs:element type="nonNegativeDecimal" name="screenBrightnessCapForWearBedtimeMode"> <xs:annotation name="final"/> </xs:element> <!-- Timeout after which we reduce the refresh rate if the screen has been idle, in order to save power. --> <xs:element type="idleScreenRefreshRateTimeout" name="idleScreenRefreshRateTimeout" minOccurs="0"> <xs:annotation name="final"/> </xs:element> </xs:sequence> </xs:complexType> </xs:element> Loading Loading @@ -772,6 +776,30 @@ </xs:sequence> </xs:complexType> <xs:complexType name="idleScreenRefreshRateTimeout"> <xs:element name="luxThresholds" type="idleScreenRefreshRateTimeoutLuxThresholds" minOccurs="0"> <xs:annotation name="final"/> </xs:element> </xs:complexType> <!-- Lux based timeout after which we reduce the refresh rate if the screen has been idle, in order to save power. --> <xs:complexType name="idleScreenRefreshRateTimeoutLuxThresholds"> <xs:sequence> <xs:element name="point" type="idleScreenRefreshRateTimeoutLuxThresholdPoint" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> <!-- Represents a tuple of lux and timeout(in ms), which represents the timeout value for the lux in the [luxValue, nextLuxValue (INF if missing)) --> <xs:complexType name="idleScreenRefreshRateTimeoutLuxThresholdPoint"> <xs:element name="lux" type="xs:nonNegativeInteger"> <xs:annotation name="final"/> </xs:element> <xs:element name="timeout" type="xs:nonNegativeInteger"> <xs:annotation name="final"/> </xs:element> </xs:complexType> <!-- Predefined type names as defined by AutomaticBrightnessController.AutomaticBrightnessMode --> <xs:simpleType name="AutoBrightnessModeName"> Loading
services/core/xsd/display-device-config/schema/current.txt +21 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ package com.android.server.display.config { method public final com.android.server.display.config.Thresholds getDisplayBrightnessChangeThresholdsIdle(); method @Nullable public final com.android.server.display.config.HdrBrightnessConfig getHdrBrightnessConfig(); method public com.android.server.display.config.HighBrightnessMode getHighBrightnessMode(); method public final com.android.server.display.config.IdleScreenRefreshRateTimeout getIdleScreenRefreshRateTimeout(); method public final com.android.server.display.config.SensorDetails getLightSensor(); method public com.android.server.display.config.LuxThrottling getLuxThrottling(); method @Nullable public final String getName(); Loading Loading @@ -146,6 +147,7 @@ package com.android.server.display.config { method public final void setDisplayBrightnessChangeThresholdsIdle(com.android.server.display.config.Thresholds); method public final void setHdrBrightnessConfig(@Nullable com.android.server.display.config.HdrBrightnessConfig); method public void setHighBrightnessMode(com.android.server.display.config.HighBrightnessMode); method public final void setIdleScreenRefreshRateTimeout(com.android.server.display.config.IdleScreenRefreshRateTimeout); method public final void setLightSensor(com.android.server.display.config.SensorDetails); method public void setLuxThrottling(com.android.server.display.config.LuxThrottling); method public final void setName(@Nullable String); Loading Loading @@ -222,6 +224,25 @@ package com.android.server.display.config { method public final void setTransitionPoint_all(@NonNull java.math.BigDecimal); } public class IdleScreenRefreshRateTimeout { ctor public IdleScreenRefreshRateTimeout(); method public final com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholds getLuxThresholds(); method public final void setLuxThresholds(com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholds); } public class IdleScreenRefreshRateTimeoutLuxThresholdPoint { ctor public IdleScreenRefreshRateTimeoutLuxThresholdPoint(); method public final java.math.BigInteger getLux(); method public final java.math.BigInteger getTimeout(); method public final void setLux(java.math.BigInteger); method public final void setTimeout(java.math.BigInteger); } public class IdleScreenRefreshRateTimeoutLuxThresholds { ctor public IdleScreenRefreshRateTimeoutLuxThresholds(); method public java.util.List<com.android.server.display.config.IdleScreenRefreshRateTimeoutLuxThresholdPoint> getPoint(); } public class IntegerArray { ctor public IntegerArray(); method public java.util.List<java.math.BigInteger> getItem(); Loading