Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -6346,4 +6346,8 @@ <bool name="config_batteryStatsResetOnUnplugHighBatteryLevel">true</bool> <!-- Whether to reset Battery Stats on unplug if the battery was significantly charged --> <bool name="config_batteryStatsResetOnUnplugAfterSignificantCharge">true</bool> <!-- Whether we should persist the brightness value in nits for the default display even if the underlying display device changes. --> <bool name="config_persistBrightnessNitsForDefaultDisplay">false</bool> </resources> core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2230,6 +2230,7 @@ <java-symbol type="bool" name="config_preventImeStartupUnlessTextEditor" /> <java-symbol type="array" name="config_nonPreemptibleInputMethods" /> <java-symbol type="bool" name="config_enhancedConfirmationModeEnabled" /> <java-symbol type="bool" name="config_persistBrightnessNitsForDefaultDisplay" /> <java-symbol type="layout" name="resolver_list" /> <java-symbol type="id" name="resolver_list" /> Loading services/core/java/com/android/server/display/AutomaticBrightnessController.java +7 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,12 @@ import com.android.server.display.brightness.BrightnessEvent; import java.io.PrintWriter; class AutomaticBrightnessController { /** * Manages the associated display brightness when in auto-brightness mode. This is also * responsible for managing the brightness lux-nits mapping strategies. Internally also listens to * the LightSensor and adjusts the system brightness in case of changes in the surrounding lux. */ public class AutomaticBrightnessController { private static final String TAG = "AutomaticBrightnessController"; private static final boolean DEBUG_PRETEND_LIGHT_SENSOR_ABSENT = false; Loading Loading @@ -1140,7 +1145,7 @@ class AutomaticBrightnessController { if (mCurrentBrightnessMapper != null) { return mCurrentBrightnessMapper.convertToFloatScale(nits); } else { return -1.0f; return PowerManager.BRIGHTNESS_INVALID_FLOAT; } } Loading services/core/java/com/android/server/display/BrightnessMappingStrategy.java +4 −3 Original line number Diff line number Diff line Loading @@ -322,9 +322,10 @@ public abstract class BrightnessMappingStrategy { public abstract float convertToNits(float brightness); /** * Converts the provided nits value to a float value if possible. * Converts the provided nit value to a float scale value if possible. * * Returns -1.0f if there's no available mapping for the nits to float. * Returns {@link PowerManager.BRIGHTNESS_INVALID_FLOAT} if there's no available mapping for * the nits to float scale. */ public abstract float convertToFloatScale(float nits); Loading Loading @@ -679,7 +680,7 @@ public abstract class BrightnessMappingStrategy { @Override public float convertToFloatScale(float nits) { return -1.0f; return PowerManager.BRIGHTNESS_INVALID_FLOAT; } @Override Loading services/core/java/com/android/server/display/BrightnessSetting.java +17 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,23 @@ public class BrightnessSetting { } } /** * @return The brightness for the default display in nits. Used when the underlying display * device has changed but we want to persist the nit value. */ public float getBrightnessNitsForDefaultDisplay() { return mPersistentDataStore.getBrightnessNitsForDefaultDisplay(); } /** * Set brightness in nits for the default display. Used when we want to persist the nit value * even if the underlying display device changes. * @param nits The brightness value in nits */ public void setBrightnessNitsForDefaultDisplay(float nits) { mPersistentDataStore.setBrightnessNitsForDefaultDisplay(nits); } private void notifyListeners(float brightness) { for (BrightnessSettingListener l : mListeners) { l.onBrightnessChanged(brightness); Loading Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -6346,4 +6346,8 @@ <bool name="config_batteryStatsResetOnUnplugHighBatteryLevel">true</bool> <!-- Whether to reset Battery Stats on unplug if the battery was significantly charged --> <bool name="config_batteryStatsResetOnUnplugAfterSignificantCharge">true</bool> <!-- Whether we should persist the brightness value in nits for the default display even if the underlying display device changes. --> <bool name="config_persistBrightnessNitsForDefaultDisplay">false</bool> </resources>
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2230,6 +2230,7 @@ <java-symbol type="bool" name="config_preventImeStartupUnlessTextEditor" /> <java-symbol type="array" name="config_nonPreemptibleInputMethods" /> <java-symbol type="bool" name="config_enhancedConfirmationModeEnabled" /> <java-symbol type="bool" name="config_persistBrightnessNitsForDefaultDisplay" /> <java-symbol type="layout" name="resolver_list" /> <java-symbol type="id" name="resolver_list" /> Loading
services/core/java/com/android/server/display/AutomaticBrightnessController.java +7 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,12 @@ import com.android.server.display.brightness.BrightnessEvent; import java.io.PrintWriter; class AutomaticBrightnessController { /** * Manages the associated display brightness when in auto-brightness mode. This is also * responsible for managing the brightness lux-nits mapping strategies. Internally also listens to * the LightSensor and adjusts the system brightness in case of changes in the surrounding lux. */ public class AutomaticBrightnessController { private static final String TAG = "AutomaticBrightnessController"; private static final boolean DEBUG_PRETEND_LIGHT_SENSOR_ABSENT = false; Loading Loading @@ -1140,7 +1145,7 @@ class AutomaticBrightnessController { if (mCurrentBrightnessMapper != null) { return mCurrentBrightnessMapper.convertToFloatScale(nits); } else { return -1.0f; return PowerManager.BRIGHTNESS_INVALID_FLOAT; } } Loading
services/core/java/com/android/server/display/BrightnessMappingStrategy.java +4 −3 Original line number Diff line number Diff line Loading @@ -322,9 +322,10 @@ public abstract class BrightnessMappingStrategy { public abstract float convertToNits(float brightness); /** * Converts the provided nits value to a float value if possible. * Converts the provided nit value to a float scale value if possible. * * Returns -1.0f if there's no available mapping for the nits to float. * Returns {@link PowerManager.BRIGHTNESS_INVALID_FLOAT} if there's no available mapping for * the nits to float scale. */ public abstract float convertToFloatScale(float nits); Loading Loading @@ -679,7 +680,7 @@ public abstract class BrightnessMappingStrategy { @Override public float convertToFloatScale(float nits) { return -1.0f; return PowerManager.BRIGHTNESS_INVALID_FLOAT; } @Override Loading
services/core/java/com/android/server/display/BrightnessSetting.java +17 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,23 @@ public class BrightnessSetting { } } /** * @return The brightness for the default display in nits. Used when the underlying display * device has changed but we want to persist the nit value. */ public float getBrightnessNitsForDefaultDisplay() { return mPersistentDataStore.getBrightnessNitsForDefaultDisplay(); } /** * Set brightness in nits for the default display. Used when we want to persist the nit value * even if the underlying display device changes. * @param nits The brightness value in nits */ public void setBrightnessNitsForDefaultDisplay(float nits) { mPersistentDataStore.setBrightnessNitsForDefaultDisplay(nits); } private void notifyListeners(float brightness) { for (BrightnessSettingListener l : mListeners) { l.onBrightnessChanged(brightness); Loading