Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4ddc072 authored by Christine Franks's avatar Christine Franks Committed by Automerger Merge Worker
Browse files

Merge "Configure DWB transition time per-device" into tm-qpr-dev am: ea95e626 am: a389e64f

parents 2b95a591 a389e64f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -974,6 +974,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.-->
+1 −0
Original line number Diff line number Diff line
@@ -3384,6 +3384,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.
+1 −6
Original line number Diff line number Diff line
@@ -108,11 +108,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;
@@ -663,7 +658,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) -> {
+10 −1
Original line number Diff line number Diff line
@@ -60,7 +60,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;
@@ -126,6 +127,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;
@@ -238,6 +242,11 @@ final class DisplayWhiteBalanceTintController extends TintController {
        return mIsAvailable;
    }

    @Override
    public long getTransitionDurationMilliseconds() {
        return mTransitionDuration;
    }

    @Override
    public void dump(PrintWriter pw) {
        synchronized (mLock) {
+9 −1
Original line number Diff line number Diff line
@@ -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.
     */