Merge "DO NOT MERGE: Cap doze autobrightness when collecting new sensor samples" into cw-f-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e2590cccfd
@@ -1178,9 +1178,13 @@
|
|||||||
<integer-array name="config_dynamicHysteresisLuxLevels">
|
<integer-array name="config_dynamicHysteresisLuxLevels">
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
<!-- This flag requires config_dozeSensorLuxLevels to have one or more entries and only affects
|
<!-- This flag requires config_dozeBrightnessBacklightValues to have two or more entries; it is
|
||||||
the screen brightness while dozing. The screen brightness of a device is based off of a
|
recommended that config_screenBrightnessDoze be greater than or equal to all these entries
|
||||||
ring buffer of the last n seconds of ambient light sensor sample readings.
|
since this value is used as the doze screen brightness until a new sensor sample is
|
||||||
|
acquired. This flag only affects the screen brightness while dozing.
|
||||||
|
|
||||||
|
The screen brightness of a device is based off of a ring buffer of the last n seconds of
|
||||||
|
ambient light sensor sample readings.
|
||||||
|
|
||||||
If this flag is true, then this buffer is cleared and the screen brightness is based off of
|
If this flag is true, then this buffer is cleared and the screen brightness is based off of
|
||||||
ambient light sensor readings that are obtained while the device is dozing. This mode may
|
ambient light sensor readings that are obtained while the device is dozing. This mode may
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
// True if should use light sensor to automatically determine doze screen brightness.
|
// True if should use light sensor to automatically determine doze screen brightness.
|
||||||
private final boolean mAllowAutoBrightnessWhileDozingConfig;
|
private final boolean mAllowAutoBrightnessWhileDozingConfig;
|
||||||
|
|
||||||
|
// True if using only new sensor samples to automatically determine doze screen brightness.
|
||||||
|
private boolean mUseNewSensorSamplesForDoze;
|
||||||
|
|
||||||
// True if we should fade the screen while turning it off, false if we should play
|
// True if we should fade the screen while turning it off, false if we should play
|
||||||
// a stylish color fade animation instead.
|
// a stylish color fade animation instead.
|
||||||
private boolean mColorFadeFadesConfig;
|
private boolean mColorFadeFadesConfig;
|
||||||
@@ -345,10 +348,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
com.android.internal.R.array.config_dozeSensorLuxLevels);
|
com.android.internal.R.array.config_dozeSensorLuxLevels);
|
||||||
int[] dozeBrightnessBacklightValues = resources.getIntArray(
|
int[] dozeBrightnessBacklightValues = resources.getIntArray(
|
||||||
com.android.internal.R.array.config_dozeBrightnessBacklightValues);
|
com.android.internal.R.array.config_dozeBrightnessBacklightValues);
|
||||||
boolean useNewSensorSamplesForDoze = resources.getBoolean(
|
mUseNewSensorSamplesForDoze = resources.getBoolean(
|
||||||
com.android.internal.R.bool.config_useNewSensorSamplesForDoze);
|
com.android.internal.R.bool.config_useNewSensorSamplesForDoze);
|
||||||
LuxLevels luxLevels = new LuxLevels(brightHysteresisLevels, darkHysteresisLevels,
|
LuxLevels luxLevels = new LuxLevels(brightHysteresisLevels, darkHysteresisLevels,
|
||||||
luxHysteresisLevels, useNewSensorSamplesForDoze, dozeSensorLuxLevels,
|
luxHysteresisLevels, mUseNewSensorSamplesForDoze, dozeSensorLuxLevels,
|
||||||
dozeBrightnessBacklightValues);
|
dozeBrightnessBacklightValues);
|
||||||
|
|
||||||
Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness);
|
Spline screenAutoBrightnessSpline = createAutoBrightnessSpline(lux, screenBrightness);
|
||||||
@@ -671,10 +674,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
mAppliedAutoBrightness = false;
|
mAppliedAutoBrightness = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use default brightness when dozing unless overridden.
|
// Use default brightness when dozing unless overridden or if collecting sensor samples.
|
||||||
if (brightness < 0 && (state == Display.STATE_DOZE
|
if (state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND) {
|
||||||
|| state == Display.STATE_DOZE_SUSPEND)) {
|
if (brightness < 0) {
|
||||||
brightness = mScreenBrightnessDozeConfig;
|
brightness = mScreenBrightnessDozeConfig;
|
||||||
|
} else if (mUseNewSensorSamplesForDoze) {
|
||||||
|
brightness = Math.min(brightness, mScreenBrightnessDozeConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply manual brightness.
|
// Apply manual brightness.
|
||||||
|
|||||||
Reference in New Issue
Block a user