diff options
author | Jeff Brown <jeffbrown@google.com> | 2014-08-22 01:59:06 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2014-08-22 02:17:41 -0700 |
commit | 1bfd0f463e279e3ac3f133c5e0ad11ccfd73eed5 (patch) | |
tree | 402710e1d8d6c535108bbcc153b4eb55ba4b950e | |
parent | 7d82751530db56841f7e767fe752abe5faa06e0c (diff) | |
download | frameworks_base-1bfd0f463e279e3ac3f133c5e0ad11ccfd73eed5.zip frameworks_base-1bfd0f463e279e3ac3f133c5e0ad11ccfd73eed5.tar.gz frameworks_base-1bfd0f463e279e3ac3f133c5e0ad11ccfd73eed5.tar.bz2 |
Improve adaptive brightness in very dark rooms.
Added config_screenBrightnessDark to configure the minimum value
that will be used for auto-brightness adjustment. This value is
expected to be less than unadjusted minimum auto-brightness level
to provide some range for the user to make the screen dimmer
in dark rooms.
This configuration value is set to the lowest possible level
by default (1). Individual devices may need to override this value
in their framework resource overlay depending on their backlight
characteristics.
Change-Id: I9bd3a2355c65f894dff89aeaf7661cdf38f4a6ee
-rw-r--r-- | core/res/res/values/config.xml | 53 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/display/DisplayPowerController.java | 37 |
3 files changed, 64 insertions, 27 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index df7268f..c539982 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -673,6 +673,37 @@ --> <integer name="config_doubleTapOnHomeBehavior">0</integer> + <!-- Minimum screen brightness setting allowed by the power manager. + The user is forbidden from setting the brightness below this level. --> + <integer name="config_screenBrightnessSettingMinimum">10</integer> + + <!-- Maximum screen brightness allowed by the power manager. + The user is forbidden from setting the brightness above this level. --> + <integer name="config_screenBrightnessSettingMaximum">255</integer> + + <!-- Default screen brightness setting. + Must be in the range specified by minimum and maximum. --> + <integer name="config_screenBrightnessSettingDefault">102</integer> + + <!-- Screen brightness used to dim the screen while dozing in a very low power state. + May be less than the minimum allowed brightness setting + that can be set by the user. --> + <integer name="config_screenBrightnessDoze">1</integer> + + <!-- Screen brightness used to dim the screen when the user activity + timeout expires. May be less than the minimum allowed brightness setting + that can be set by the user. --> + <integer name="config_screenBrightnessDim">10</integer> + + <!-- Minimum allowable screen brightness to use in a very dark room. + This value sets the floor for the darkest possible auto-brightness + adjustment. It is expected to be somewhat less than the first entry in + config_autoBrightnessLcdBacklightValues so as to allow the user to have + some range of adjustment to dim the screen further than usual in very + dark rooms. The contents of the screen must still be clearly visible + in darkness (although they may not be visible in a bright room). --> + <integer name="config_screenBrightnessDark">1</integer> + <!-- Array of light sensor LUX values to define our levels for auto backlight brightness support. The N entries of this array define N + 1 control points as follows: (1-based arrays) @@ -696,28 +727,6 @@ <integer-array name="config_autoBrightnessLevels"> </integer-array> - <!-- Minimum screen brightness setting allowed by the power manager. - The user is forbidden from setting the brightness below this level. --> - <integer name="config_screenBrightnessSettingMinimum">10</integer> - - <!-- Maximum screen brightness allowed by the power manager. - The user is forbidden from setting the brightness above this level. --> - <integer name="config_screenBrightnessSettingMaximum">255</integer> - - <!-- Default screen brightness setting. - Must be in the range specified by minimum and maximum. --> - <integer name="config_screenBrightnessSettingDefault">102</integer> - - <!-- Screen brightness used to dim the screen while dozing in a very low power state. - May be less than the minimum allowed brightness setting - that can be set by the user. --> - <integer name="config_screenBrightnessDoze">1</integer> - - <!-- Screen brightness used to dim the screen when the user activity - timeout expires. May be less than the minimum allowed brightness setting - that can be set by the user. --> - <integer name="config_screenBrightnessDim">10</integer> - <!-- Array of output values for LCD backlight corresponding to the LUX values in the config_autoBrightnessLevels array. This array should have size one greater than the size of the config_autoBrightnessLevels array. diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b32cd1e..6f0cc5d 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1560,6 +1560,7 @@ <java-symbol type="integer" name="config_screenBrightnessSettingMinimum" /> <java-symbol type="integer" name="config_screenBrightnessSettingMaximum" /> <java-symbol type="integer" name="config_screenBrightnessSettingDefault" /> + <java-symbol type="integer" name="config_screenBrightnessDark" /> <java-symbol type="integer" name="config_screenBrightnessDim" /> <java-symbol type="integer" name="config_screenBrightnessDoze" /> <java-symbol type="integer" name="config_shutdownBatteryTemperature" /> diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 2a1ceaa..38077eb 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -139,6 +139,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // The dim screen brightness. private final int mScreenBrightnessDimConfig; + // The minimum screen brightness to use in a very dark room. + private final int mScreenBrightnessDarkConfig; + // The minimum allowed brightness. private final int mScreenBrightnessRangeMinimum; @@ -247,6 +250,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mContext = context; final Resources resources = context.getResources(); + final int screenBrightnessSettingMinimum = clampAbsoluteBrightness(resources.getInteger( + com.android.internal.R.integer.config_screenBrightnessSettingMinimum)); mScreenBrightnessDozeConfig = clampAbsoluteBrightness(resources.getInteger( com.android.internal.R.integer.config_screenBrightnessDoze)); @@ -254,9 +259,23 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mScreenBrightnessDimConfig = clampAbsoluteBrightness(resources.getInteger( com.android.internal.R.integer.config_screenBrightnessDim)); - int screenBrightnessRangeMinimum = clampAbsoluteBrightness(Math.min(resources.getInteger( - com.android.internal.R.integer.config_screenBrightnessSettingMinimum), - mScreenBrightnessDimConfig)); + mScreenBrightnessDarkConfig = clampAbsoluteBrightness(resources.getInteger( + com.android.internal.R.integer.config_screenBrightnessDark)); + if (mScreenBrightnessDarkConfig > mScreenBrightnessDimConfig) { + Slog.w(TAG, "Expected config_screenBrightnessDark (" + + mScreenBrightnessDarkConfig + ") to be less than or equal to " + + "config_screenBrightnessDim (" + mScreenBrightnessDimConfig + ")."); + } + if (mScreenBrightnessDarkConfig > mScreenBrightnessDimConfig) { + Slog.w(TAG, "Expected config_screenBrightnessDark (" + + mScreenBrightnessDarkConfig + ") to be less than or equal to " + + "config_screenBrightnessSettingMinimum (" + + screenBrightnessSettingMinimum + ")."); + } + + int screenBrightnessRangeMinimum = Math.min(Math.min( + screenBrightnessSettingMinimum, mScreenBrightnessDimConfig), + mScreenBrightnessDarkConfig); mScreenBrightnessRangeMaximum = PowerManager.BRIGHTNESS_ON; @@ -280,8 +299,15 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call + "Auto-brightness will be disabled."); mUseSoftwareAutoBrightnessConfig = false; } else { - if (screenBrightness[0] < screenBrightnessRangeMinimum) { - screenBrightnessRangeMinimum = clampAbsoluteBrightness(screenBrightness[0]); + int bottom = clampAbsoluteBrightness(screenBrightness[0]); + if (mScreenBrightnessDarkConfig > bottom) { + Slog.w(TAG, "config_screenBrightnessDark (" + mScreenBrightnessDarkConfig + + ") should be less than or equal to the first value of " + + "config_autoBrightnessLcdBacklightValues (" + + bottom + ")."); + } + if (bottom < screenBrightnessRangeMinimum) { + screenBrightnessRangeMinimum = bottom; } mAutomaticBrightnessController = new AutomaticBrightnessController(this, handler.getLooper(), sensorManager, screenAutoBrightnessSpline, @@ -905,6 +931,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call pw.println("Display Power Controller Configuration:"); pw.println(" mScreenBrightnessDozeConfig=" + mScreenBrightnessDozeConfig); pw.println(" mScreenBrightnessDimConfig=" + mScreenBrightnessDimConfig); + pw.println(" mScreenBrightnessDarkConfig=" + mScreenBrightnessDarkConfig); pw.println(" mScreenBrightnessRangeMinimum=" + mScreenBrightnessRangeMinimum); pw.println(" mScreenBrightnessRangeMaximum=" + mScreenBrightnessRangeMaximum); pw.println(" mUseSoftwareAutoBrightnessConfig=" |