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

Commit bc05aa2e authored by Christine Franks's avatar Christine Franks Committed by Android (Google) Code Review
Browse files

Merge "Move DWB transform animation onto TintHandler"

parents ebc78db8 c7fb9457
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line 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_IMMEDIATE = 0;
    private static final int MSG_APPLY_NIGHT_DISPLAY_ANIMATED = 1;
    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_GLOBAL_SATURATION = 2;
    private static final int MSG_APPLY_DISPLAY_WHITE_BALANCE = 3;


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


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


            if (mDisplayWhiteBalanceTintController.isActivated()) {
            if (mDisplayWhiteBalanceTintController.isActivated()) {
                applyTint(mDisplayWhiteBalanceTintController, false);
                mHandler.sendEmptyMessage(MSG_APPLY_DISPLAY_WHITE_BALANCE);
                return true;
                return true;
            }
            }
            return false;
            return false;
@@ -1602,6 +1603,9 @@ public final class ColorDisplayService extends SystemService {
                case MSG_APPLY_NIGHT_DISPLAY_ANIMATED:
                case MSG_APPLY_NIGHT_DISPLAY_ANIMATED:
                    applyTint(mNightDisplayTintController, false);
                    applyTint(mNightDisplayTintController, false);
                    break;
                    break;
                case MSG_APPLY_DISPLAY_WHITE_BALANCE:
                    applyTint(mDisplayWhiteBalanceTintController, false);
                    break;
            }
            }
        }
        }
    }
    }
+16 −25
Original line number Original line Diff line number Diff line
@@ -87,7 +87,7 @@ public class DisplayTransformManager {
     * Map of level -> color transformation matrix.
     * Map of level -> color transformation matrix.
     */
     */
    @GuardedBy("mColorMatrix")
    @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()}.
     * 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.
     * 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];
        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.
     * Propagates the provided color transformation matrix to the SurfaceFlinger.
     */
     */