Configure DWB transition time per-device

Default is still 3000 millis

Bug: 265363036
Test: builds
Change-Id: I16534383c539b71e1dd02c4ecdfa1fa40d2bfed0
This commit is contained in:
Christine Franks
2023-01-20 08:21:48 -08:00
parent a1531f2c28
commit d4861c220e
5 changed files with 24 additions and 8 deletions

View File

@@ -984,6 +984,9 @@
<!-- Boolean indicating whether light mode is allowed when DWB is turned on. -->
<bool name="config_displayWhiteBalanceLightModeAllowed">true</bool>
<!-- Duration, in milliseconds, of the display white balance animated transitions. -->
<integer name="config_displayWhiteBalanceTransitionTime">3000</integer>
<!-- Device states where the sensor based rotation values should be reversed around the Z axis
for the default display.
TODO(b/265312193): Remove this workaround when this bug is fixed.-->

View File

@@ -3435,6 +3435,7 @@
<java-symbol type="array" name="config_displayWhiteBalanceDisplayPrimaries" />
<java-symbol type="array" name="config_displayWhiteBalanceDisplayNominalWhite" />
<java-symbol type="bool" name="config_displayWhiteBalanceLightModeAllowed" />
<java-symbol type="integer" name="config_displayWhiteBalanceTransitionTime" />
<!-- Device states where the sensor based rotation values should be reversed around the Z axis
for the default display.

View File

@@ -107,11 +107,6 @@ public final class ColorDisplayService extends SystemService {
Matrix.setIdentityM(MATRIX_IDENTITY, 0);
}
/**
* The transition time, in milliseconds, for Night Display to turn on/off.
*/
private static final long TRANSITION_DURATION = 3000L;
private static final int MSG_USER_CHANGED = 0;
private static final int MSG_SET_UP = 1;
private static final int MSG_APPLY_NIGHT_DISPLAY_IMMEDIATE = 2;
@@ -661,7 +656,7 @@ public final class ColorDisplayService extends SystemService {
TintValueAnimator valueAnimator = TintValueAnimator.ofMatrix(COLOR_MATRIX_EVALUATOR,
from == null ? MATRIX_IDENTITY : from, to);
tintController.setAnimator(valueAnimator);
valueAnimator.setDuration(TRANSITION_DURATION);
valueAnimator.setDuration(tintController.getTransitionDurationMilliseconds());
valueAnimator.setInterpolator(AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.fast_out_slow_in));
valueAnimator.addUpdateListener((ValueAnimator animator) -> {

View File

@@ -59,7 +59,8 @@ final class DisplayWhiteBalanceTintController extends TintController {
private float[] mCurrentColorTemperatureXYZ;
@VisibleForTesting
boolean mSetUp = false;
private float[] mMatrixDisplayWhiteBalance = new float[16];
private final float[] mMatrixDisplayWhiteBalance = new float[16];
private long mTransitionDuration;
private Boolean mIsAvailable;
// This feature becomes disallowed if the device is in an unsupported strong/light state.
private boolean mIsAllowed = true;
@@ -119,6 +120,9 @@ final class DisplayWhiteBalanceTintController extends TintController {
final int colorTemperature = res.getInteger(
R.integer.config_displayWhiteBalanceColorTemperatureDefault);
mTransitionDuration = res.getInteger(
R.integer.config_displayWhiteBalanceTransitionTime);
synchronized (mLock) {
mDisplayColorSpaceRGB = displayColorSpaceRGB;
mDisplayNominalWhiteXYZ = displayNominalWhiteXYZ;
@@ -231,6 +235,11 @@ final class DisplayWhiteBalanceTintController extends TintController {
return mIsAvailable;
}
@Override
public long getTransitionDurationMilliseconds() {
return mTransitionDuration;
}
@Override
public void dump(PrintWriter pw) {
synchronized (mLock) {

View File

@@ -16,7 +16,6 @@
package com.android.server.display.color;
import android.animation.ValueAnimator;
import android.content.Context;
import android.util.Slog;
@@ -24,6 +23,11 @@ import java.io.PrintWriter;
abstract class TintController {
/**
* The default transition time, in milliseconds, for color transforms to turn on/off.
*/
private static final long TRANSITION_DURATION = 3000L;
private ColorDisplayService.TintValueAnimator mAnimator;
private Boolean mIsActivated;
@@ -66,6 +70,10 @@ abstract class TintController {
return mIsActivated == null;
}
public long getTransitionDurationMilliseconds() {
return TRANSITION_DURATION;
}
/**
* Dump debug information.
*/