Merge "Fix screen-on speed during phone call" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a0cecdfe8f
@@ -1067,12 +1067,22 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
mColorFadeEnabled && mPowerState.getColorFadeLevel() == 1.0f;
|
mColorFadeEnabled && mPowerState.getColorFadeLevel() == 1.0f;
|
||||||
final boolean brightnessIsTemporary =
|
final boolean brightnessIsTemporary =
|
||||||
mAppliedTemporaryBrightness || mAppliedTemporaryAutoBrightnessAdjustment;
|
mAppliedTemporaryBrightness || mAppliedTemporaryAutoBrightnessAdjustment;
|
||||||
if (initialRampSkip || hasBrightnessBuckets
|
// We only want to animate the brightness if it is between 0.0f and 1.0f.
|
||||||
|| wasOrWillBeInVr || !isDisplayContentVisible || brightnessIsTemporary) {
|
// brightnessState can contain the values -1.0f and NaN, which we do not want to
|
||||||
animateScreenBrightness(brightnessState, SCREEN_ANIMATION_RATE_MINIMUM);
|
// animate to. To avoid this, we check the value first.
|
||||||
} else {
|
// If the brightnessState is off (-1.0f) we still want to animate to the minimum
|
||||||
animateScreenBrightness(brightnessState,
|
// brightness (0.0f) to accommodate for LED displays, which can appear bright to the
|
||||||
slowChange ? mBrightnessRampRateSlow : mBrightnessRampRateFast);
|
// user even when the display is all black.
|
||||||
|
float animateValue = brightnessState == PowerManager.BRIGHTNESS_OFF_FLOAT
|
||||||
|
? PowerManager.BRIGHTNESS_MIN : brightnessState;
|
||||||
|
if (isValidBrightnessValue(animateValue)) {
|
||||||
|
if (initialRampSkip || hasBrightnessBuckets
|
||||||
|
|| wasOrWillBeInVr || !isDisplayContentVisible || brightnessIsTemporary) {
|
||||||
|
animateScreenBrightness(animateValue, SCREEN_ANIMATION_RATE_MINIMUM);
|
||||||
|
} else {
|
||||||
|
animateScreenBrightness(animateValue,
|
||||||
|
slowChange ? mBrightnessRampRateSlow : mBrightnessRampRateFast);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!brightnessIsTemporary) {
|
if (!brightnessIsTemporary) {
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ final class DisplayPowerState {
|
|||||||
/**
|
/**
|
||||||
* Sets the display brightness.
|
* Sets the display brightness.
|
||||||
*
|
*
|
||||||
* @param brightness The brightness, ranges from 0 (minimum / off) to 255 (brightest).
|
* @param brightness The brightness, ranges from 0.0f (minimum / off) to 1.0f (brightest).
|
||||||
*/
|
*/
|
||||||
public void setScreenBrightness(float brightness) {
|
public void setScreenBrightness(float brightness) {
|
||||||
if (mScreenBrightness != brightness) {
|
if (mScreenBrightness != brightness) {
|
||||||
|
|||||||
Reference in New Issue
Block a user