Loading services/core/java/com/android/server/display/DisplayDeviceConfig.java +65 −5 Original line number Diff line number Diff line Loading @@ -132,6 +132,16 @@ import javax.xml.datatype.DatatypeConfigurationException; * <brightness>0.01</brightness> * </brightnessThrottlingPoint> * </brightnessThrottlingMap> * <concurrentDisplaysBrightnessThrottlingMap> * <brightnessThrottlingPoint> * <thermalStatus>severe</thermalStatus> * <brightness>0.07</brightness> * </brightnessThrottlingPoint> * <brightnessThrottlingPoint> * <thermalStatus>critical</thermalStatus> * <brightness>0.005</brightness> * </brightnessThrottlingPoint> * </concurrentDisplaysBrightnessThrottlingMap> * </thermalThrottling> * * <refreshRate> Loading Loading @@ -613,6 +623,8 @@ public class DisplayDeviceConfig { // overwritten value. private BrightnessThrottlingData mBrightnessThrottlingData; private BrightnessThrottlingData mOriginalBrightnessThrottlingData; // The concurrent displays mode might need a stricter throttling policy private BrightnessThrottlingData mConcurrentDisplaysBrightnessThrottlingData; @VisibleForTesting DisplayDeviceConfig(Context context) { Loading Loading @@ -1258,12 +1270,20 @@ public class DisplayDeviceConfig { } /** * @return brightness throttling data configuration data for the display. * @return brightness throttling configuration data for the display. */ public BrightnessThrottlingData getBrightnessThrottlingData() { return BrightnessThrottlingData.create(mBrightnessThrottlingData); } /** * @return brightness throttling configuration data for the display for the concurrent * displays mode. */ public BrightnessThrottlingData getConcurrentDisplaysBrightnessThrottlingData() { return BrightnessThrottlingData.create(mConcurrentDisplaysBrightnessThrottlingData); } /** * @return Auto brightness darkening light debounce */ Loading Loading @@ -1503,6 +1523,7 @@ public class DisplayDeviceConfig { loadBrightnessConstraintsFromConfigXml(); loadBrightnessMap(config); loadBrightnessThrottlingMap(config); loadConcurrentDisplaysBrightnessThrottlingMap(config); loadHighBrightnessModeData(config); loadQuirks(config); loadBrightnessRamps(config); Loading Loading @@ -1714,13 +1735,13 @@ public class DisplayDeviceConfig { private void loadBrightnessThrottlingMap(DisplayConfiguration config) { final ThermalThrottling throttlingConfig = config.getThermalThrottling(); if (throttlingConfig == null) { Slog.i(TAG, "no thermal throttling config found"); Slog.i(TAG, "No thermal throttling config found"); return; } final BrightnessThrottlingMap map = throttlingConfig.getBrightnessThrottlingMap(); if (map == null) { Slog.i(TAG, "no brightness throttling map found"); Slog.i(TAG, "No brightness throttling map found"); return; } Loading @@ -1747,6 +1768,43 @@ public class DisplayDeviceConfig { } } private void loadConcurrentDisplaysBrightnessThrottlingMap(DisplayConfiguration config) { final ThermalThrottling throttlingConfig = config.getThermalThrottling(); if (throttlingConfig == null) { Slog.i(TAG, "No concurrent displays thermal throttling config found"); return; } final BrightnessThrottlingMap map = throttlingConfig.getConcurrentDisplaysBrightnessThrottlingMap(); if (map == null) { Slog.i(TAG, "No concurrent displays brightness throttling map found"); return; } final List<BrightnessThrottlingPoint> points = map.getBrightnessThrottlingPoint(); // At least 1 point is guaranteed by the display device config schema List<BrightnessThrottlingData.ThrottlingLevel> throttlingLevels = new ArrayList<>(points.size()); boolean badConfig = false; for (BrightnessThrottlingPoint point : points) { ThermalStatus status = point.getThermalStatus(); if (!thermalStatusIsValid(status)) { badConfig = true; break; } throttlingLevels.add(new BrightnessThrottlingData.ThrottlingLevel( convertThermalStatus(status), point.getBrightness().floatValue())); } if (!badConfig) { mConcurrentDisplaysBrightnessThrottlingData = BrightnessThrottlingData.create(throttlingLevels); } } private void loadRefreshRateSetting(DisplayConfiguration config) { final RefreshRateConfigs refreshRateConfigs = (config == null) ? null : config.getRefreshRate(); Loading Loading @@ -2529,7 +2587,8 @@ public class DisplayDeviceConfig { } } private @PowerManager.ThermalStatus int convertThermalStatus(ThermalStatus value) { @VisibleForTesting static @PowerManager.ThermalStatus int convertThermalStatus(ThermalStatus value) { if (value == null) { return PowerManager.THERMAL_STATUS_NONE; } Loading Loading @@ -2855,7 +2914,8 @@ public class DisplayDeviceConfig { return throttlingLevels.hashCode(); } private BrightnessThrottlingData(List<ThrottlingLevel> inLevels) { @VisibleForTesting BrightnessThrottlingData(List<ThrottlingLevel> inLevels) { throttlingLevels = new ArrayList<>(inLevels.size()); for (ThrottlingLevel level : inLevels) { throttlingLevels.add(new ThrottlingLevel(level.thermalStatus, level.brightness)); Loading services/core/java/com/android/server/display/DisplayPowerController.java +7 −0 Original line number Diff line number Diff line Loading @@ -885,6 +885,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call updatePowerState(); } }); // TODO (b/265793751): Re-create BrightnessTracker if we're enetering/exiting concurrent // displays mode } /** Loading Loading @@ -943,6 +946,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call return mDisplayDeviceConfig.getHdrBrightnessFromSdr(sdrBrightness); } }); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode mBrightnessThrottler.resetThrottlingData( mDisplayDeviceConfig.getBrightnessThrottlingData(), mUniqueDisplayId); } Loading Loading @@ -2048,6 +2053,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call private BrightnessThrottler createBrightnessThrottlerLocked() { final DisplayDevice device = mLogicalDisplay.getPrimaryDisplayDeviceLocked(); final DisplayDeviceConfig ddConfig = device.getDisplayDeviceConfig(); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode final DisplayDeviceConfig.BrightnessThrottlingData data = ddConfig != null ? ddConfig.getBrightnessThrottlingData() : null; return new BrightnessThrottler(mHandler, data, Loading services/core/java/com/android/server/display/DisplayPowerController2.java +7 −0 Original line number Diff line number Diff line Loading @@ -732,6 +732,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal updatePowerState(); } }); // TODO (b/265793751): Re-create BrightnessTracker if we're enetering/exiting concurrent // displays mode } /** Loading Loading @@ -783,6 +786,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal return mDisplayDeviceConfig.getHdrBrightnessFromSdr(sdrBrightness); } }); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode mBrightnessThrottler.resetThrottlingData( mDisplayDeviceConfig.getBrightnessThrottlingData(), mUniqueDisplayId); } Loading Loading @@ -1755,6 +1760,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private BrightnessThrottler createBrightnessThrottlerLocked() { final DisplayDevice device = mLogicalDisplay.getPrimaryDisplayDeviceLocked(); final DisplayDeviceConfig ddConfig = device.getDisplayDeviceConfig(); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode final DisplayDeviceConfig.BrightnessThrottlingData data = ddConfig != null ? ddConfig.getBrightnessThrottlingData() : null; return new BrightnessThrottler(mHandler, data, Loading services/core/xsd/display-device-config/display-device-config.xsd +5 −2 Original line number Diff line number Diff line Loading @@ -202,12 +202,15 @@ </xs:simpleType> <xs:complexType name="thermalThrottling"> <xs:complexType> <xs:sequence> <xs:element type="brightnessThrottlingMap" name="brightnessThrottlingMap"> <xs:annotation name="nonnull"/> <xs:annotation name="final"/> </xs:element> </xs:complexType> <xs:element type="brightnessThrottlingMap" name="concurrentDisplaysBrightnessThrottlingMap"> <xs:annotation name="final"/> </xs:element> </xs:sequence> </xs:complexType> <xs:complexType name="brightnessThrottlingMap"> Loading services/core/xsd/display-device-config/schema/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -237,7 +237,9 @@ package com.android.server.display.config { public class ThermalThrottling { ctor public ThermalThrottling(); method @NonNull public final com.android.server.display.config.BrightnessThrottlingMap getBrightnessThrottlingMap(); method public final com.android.server.display.config.BrightnessThrottlingMap getConcurrentDisplaysBrightnessThrottlingMap(); method public final void setBrightnessThrottlingMap(@NonNull com.android.server.display.config.BrightnessThrottlingMap); method public final void setConcurrentDisplaysBrightnessThrottlingMap(com.android.server.display.config.BrightnessThrottlingMap); } public class ThresholdPoint { Loading Loading
services/core/java/com/android/server/display/DisplayDeviceConfig.java +65 −5 Original line number Diff line number Diff line Loading @@ -132,6 +132,16 @@ import javax.xml.datatype.DatatypeConfigurationException; * <brightness>0.01</brightness> * </brightnessThrottlingPoint> * </brightnessThrottlingMap> * <concurrentDisplaysBrightnessThrottlingMap> * <brightnessThrottlingPoint> * <thermalStatus>severe</thermalStatus> * <brightness>0.07</brightness> * </brightnessThrottlingPoint> * <brightnessThrottlingPoint> * <thermalStatus>critical</thermalStatus> * <brightness>0.005</brightness> * </brightnessThrottlingPoint> * </concurrentDisplaysBrightnessThrottlingMap> * </thermalThrottling> * * <refreshRate> Loading Loading @@ -613,6 +623,8 @@ public class DisplayDeviceConfig { // overwritten value. private BrightnessThrottlingData mBrightnessThrottlingData; private BrightnessThrottlingData mOriginalBrightnessThrottlingData; // The concurrent displays mode might need a stricter throttling policy private BrightnessThrottlingData mConcurrentDisplaysBrightnessThrottlingData; @VisibleForTesting DisplayDeviceConfig(Context context) { Loading Loading @@ -1258,12 +1270,20 @@ public class DisplayDeviceConfig { } /** * @return brightness throttling data configuration data for the display. * @return brightness throttling configuration data for the display. */ public BrightnessThrottlingData getBrightnessThrottlingData() { return BrightnessThrottlingData.create(mBrightnessThrottlingData); } /** * @return brightness throttling configuration data for the display for the concurrent * displays mode. */ public BrightnessThrottlingData getConcurrentDisplaysBrightnessThrottlingData() { return BrightnessThrottlingData.create(mConcurrentDisplaysBrightnessThrottlingData); } /** * @return Auto brightness darkening light debounce */ Loading Loading @@ -1503,6 +1523,7 @@ public class DisplayDeviceConfig { loadBrightnessConstraintsFromConfigXml(); loadBrightnessMap(config); loadBrightnessThrottlingMap(config); loadConcurrentDisplaysBrightnessThrottlingMap(config); loadHighBrightnessModeData(config); loadQuirks(config); loadBrightnessRamps(config); Loading Loading @@ -1714,13 +1735,13 @@ public class DisplayDeviceConfig { private void loadBrightnessThrottlingMap(DisplayConfiguration config) { final ThermalThrottling throttlingConfig = config.getThermalThrottling(); if (throttlingConfig == null) { Slog.i(TAG, "no thermal throttling config found"); Slog.i(TAG, "No thermal throttling config found"); return; } final BrightnessThrottlingMap map = throttlingConfig.getBrightnessThrottlingMap(); if (map == null) { Slog.i(TAG, "no brightness throttling map found"); Slog.i(TAG, "No brightness throttling map found"); return; } Loading @@ -1747,6 +1768,43 @@ public class DisplayDeviceConfig { } } private void loadConcurrentDisplaysBrightnessThrottlingMap(DisplayConfiguration config) { final ThermalThrottling throttlingConfig = config.getThermalThrottling(); if (throttlingConfig == null) { Slog.i(TAG, "No concurrent displays thermal throttling config found"); return; } final BrightnessThrottlingMap map = throttlingConfig.getConcurrentDisplaysBrightnessThrottlingMap(); if (map == null) { Slog.i(TAG, "No concurrent displays brightness throttling map found"); return; } final List<BrightnessThrottlingPoint> points = map.getBrightnessThrottlingPoint(); // At least 1 point is guaranteed by the display device config schema List<BrightnessThrottlingData.ThrottlingLevel> throttlingLevels = new ArrayList<>(points.size()); boolean badConfig = false; for (BrightnessThrottlingPoint point : points) { ThermalStatus status = point.getThermalStatus(); if (!thermalStatusIsValid(status)) { badConfig = true; break; } throttlingLevels.add(new BrightnessThrottlingData.ThrottlingLevel( convertThermalStatus(status), point.getBrightness().floatValue())); } if (!badConfig) { mConcurrentDisplaysBrightnessThrottlingData = BrightnessThrottlingData.create(throttlingLevels); } } private void loadRefreshRateSetting(DisplayConfiguration config) { final RefreshRateConfigs refreshRateConfigs = (config == null) ? null : config.getRefreshRate(); Loading Loading @@ -2529,7 +2587,8 @@ public class DisplayDeviceConfig { } } private @PowerManager.ThermalStatus int convertThermalStatus(ThermalStatus value) { @VisibleForTesting static @PowerManager.ThermalStatus int convertThermalStatus(ThermalStatus value) { if (value == null) { return PowerManager.THERMAL_STATUS_NONE; } Loading Loading @@ -2855,7 +2914,8 @@ public class DisplayDeviceConfig { return throttlingLevels.hashCode(); } private BrightnessThrottlingData(List<ThrottlingLevel> inLevels) { @VisibleForTesting BrightnessThrottlingData(List<ThrottlingLevel> inLevels) { throttlingLevels = new ArrayList<>(inLevels.size()); for (ThrottlingLevel level : inLevels) { throttlingLevels.add(new ThrottlingLevel(level.thermalStatus, level.brightness)); Loading
services/core/java/com/android/server/display/DisplayPowerController.java +7 −0 Original line number Diff line number Diff line Loading @@ -885,6 +885,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call updatePowerState(); } }); // TODO (b/265793751): Re-create BrightnessTracker if we're enetering/exiting concurrent // displays mode } /** Loading Loading @@ -943,6 +946,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call return mDisplayDeviceConfig.getHdrBrightnessFromSdr(sdrBrightness); } }); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode mBrightnessThrottler.resetThrottlingData( mDisplayDeviceConfig.getBrightnessThrottlingData(), mUniqueDisplayId); } Loading Loading @@ -2048,6 +2053,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call private BrightnessThrottler createBrightnessThrottlerLocked() { final DisplayDevice device = mLogicalDisplay.getPrimaryDisplayDeviceLocked(); final DisplayDeviceConfig ddConfig = device.getDisplayDeviceConfig(); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode final DisplayDeviceConfig.BrightnessThrottlingData data = ddConfig != null ? ddConfig.getBrightnessThrottlingData() : null; return new BrightnessThrottler(mHandler, data, Loading
services/core/java/com/android/server/display/DisplayPowerController2.java +7 −0 Original line number Diff line number Diff line Loading @@ -732,6 +732,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal updatePowerState(); } }); // TODO (b/265793751): Re-create BrightnessTracker if we're enetering/exiting concurrent // displays mode } /** Loading Loading @@ -783,6 +786,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal return mDisplayDeviceConfig.getHdrBrightnessFromSdr(sdrBrightness); } }); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode mBrightnessThrottler.resetThrottlingData( mDisplayDeviceConfig.getBrightnessThrottlingData(), mUniqueDisplayId); } Loading Loading @@ -1755,6 +1760,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private BrightnessThrottler createBrightnessThrottlerLocked() { final DisplayDevice device = mLogicalDisplay.getPrimaryDisplayDeviceLocked(); final DisplayDeviceConfig ddConfig = device.getDisplayDeviceConfig(); // TODO (b/265793751): Use the appropriate throttling data if we're in concurrent displays // mode final DisplayDeviceConfig.BrightnessThrottlingData data = ddConfig != null ? ddConfig.getBrightnessThrottlingData() : null; return new BrightnessThrottler(mHandler, data, Loading
services/core/xsd/display-device-config/display-device-config.xsd +5 −2 Original line number Diff line number Diff line Loading @@ -202,12 +202,15 @@ </xs:simpleType> <xs:complexType name="thermalThrottling"> <xs:complexType> <xs:sequence> <xs:element type="brightnessThrottlingMap" name="brightnessThrottlingMap"> <xs:annotation name="nonnull"/> <xs:annotation name="final"/> </xs:element> </xs:complexType> <xs:element type="brightnessThrottlingMap" name="concurrentDisplaysBrightnessThrottlingMap"> <xs:annotation name="final"/> </xs:element> </xs:sequence> </xs:complexType> <xs:complexType name="brightnessThrottlingMap"> Loading
services/core/xsd/display-device-config/schema/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -237,7 +237,9 @@ package com.android.server.display.config { public class ThermalThrottling { ctor public ThermalThrottling(); method @NonNull public final com.android.server.display.config.BrightnessThrottlingMap getBrightnessThrottlingMap(); method public final com.android.server.display.config.BrightnessThrottlingMap getConcurrentDisplaysBrightnessThrottlingMap(); method public final void setBrightnessThrottlingMap(@NonNull com.android.server.display.config.BrightnessThrottlingMap); method public final void setConcurrentDisplaysBrightnessThrottlingMap(com.android.server.display.config.BrightnessThrottlingMap); } public class ThresholdPoint { Loading