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

Commit c7fb9457 authored by Christine Franks's avatar Christine Franks
Browse files

Move DWB transform animation onto TintHandler

Bug: 123089578
Test: atest FrameworksServicesTests:ColorDisplayServiceTest

Change-Id: I7882b3cf3be27b98a5eddd3a2b628c213538a5b3
parent d6e59160
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ public final class ColorDisplayService extends SystemService {
    private static final int MSG_APPLY_NIGHT_DISPLAY_IMMEDIATE = 0;
    private static final int MSG_APPLY_NIGHT_DISPLAY_ANIMATED = 1;
    private static final int MSG_APPLY_GLOBAL_SATURATION = 2;
    private static final int MSG_APPLY_DISPLAY_WHITE_BALANCE = 3;

    /**
     * Return value if a setting has not been set.
@@ -871,7 +872,7 @@ public final class ColorDisplayService extends SystemService {
        // If disabled, clear the tint. If enabled, do nothing more here and let the next
        // temperature update set the correct tint.
        if (!activated) {
            applyTint(mDisplayWhiteBalanceTintController, false);
            mHandler.sendEmptyMessage(MSG_APPLY_DISPLAY_WHITE_BALANCE);
        }
    }

@@ -1543,7 +1544,7 @@ public final class ColorDisplayService extends SystemService {
            mDisplayWhiteBalanceTintController.setMatrix(cct);

            if (mDisplayWhiteBalanceTintController.isActivated()) {
                applyTint(mDisplayWhiteBalanceTintController, false);
                mHandler.sendEmptyMessage(MSG_APPLY_DISPLAY_WHITE_BALANCE);
                return true;
            }
            return false;
@@ -1603,6 +1604,9 @@ public final class ColorDisplayService extends SystemService {
                case MSG_APPLY_NIGHT_DISPLAY_ANIMATED:
                    applyTint(mNightDisplayTintController, false);
                    break;
                case MSG_APPLY_DISPLAY_WHITE_BALANCE:
                    applyTint(mDisplayWhiteBalanceTintController, false);
                    break;
            }
        }
    }
+16 −25
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ public class DisplayTransformManager {
     * Map of level -> color transformation matrix.
     */
    @GuardedBy("mColorMatrix")
    private final SparseArray<float[]> mColorMatrix = new SparseArray<>(3);
    private final SparseArray<float[]> mColorMatrix = new SparseArray<>(5);
    /**
     * Temporary matrix used internally by {@link #computeColorMatrixLocked()}.
     */
@@ -147,6 +147,21 @@ public class DisplayTransformManager {
        }
    }

    /**
     * Sets the current Daltonization mode. This adjusts the color space to correct for or simulate
     * various types of color blindness.
     *
     * @param mode the new Daltonization mode, or -1 to disable
     */
    public void setDaltonizerMode(int mode) {
        synchronized (mDaltonizerModeLock) {
            if (mDaltonizerMode != mode) {
                mDaltonizerMode = mode;
                applyDaltonizerMode(mode);
            }
        }
    }

    /**
     * Returns the composition of all current color matrices, or {@code null} if there are none.
     */
@@ -166,30 +181,6 @@ public class DisplayTransformManager {
        return result[count % 2];
    }

    /**
     * Returns the current Daltonization mode.
     */
    public int getDaltonizerMode() {
        synchronized (mDaltonizerModeLock) {
            return mDaltonizerMode;
        }
    }

    /**
     * Sets the current Daltonization mode. This adjusts the color space to correct for or simulate
     * various types of color blindness.
     *
     * @param mode the new Daltonization mode, or -1 to disable
     */
    public void setDaltonizerMode(int mode) {
        synchronized (mDaltonizerModeLock) {
            if (mDaltonizerMode != mode) {
                mDaltonizerMode = mode;
                applyDaltonizerMode(mode);
            }
        }
    }

    /**
     * Propagates the provided color transformation matrix to the SurfaceFlinger.
     */