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

Commit 82a4d842 authored by Christine Franks's avatar Christine Franks
Browse files

DO NOT MERGE - Update night display coefficients

Bug: 63438695
Test: manual - turn on night display
Change-Id: Ieeff74a6ba250f4965ec5e253fbc1e2349e6e1ba
parent 5bbf44e7
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -111,11 +111,7 @@ public final class NightDisplayService extends SystemService
    private float[] mMatrixNight = new float[16];

    /**
     *  These coefficients were generated by an LLS quadratic regression fitted to the
     *  overdetermined system based on experimental readings (and subsequent conversion from xy
     *  chromaticity coordinates to gamma-corrected RGB values): { (temperature, R, G, B) } ->
     *  { (7304, 1.0, 1.0, 1.0), (4082, 1.0, 0.857, 0.719), (2850, 1.0, .754, .516),
     *  (2596, 1.0, 0.722, 0.454) }. The 3x3 matrix is formatted like so:
     *  The 3x3 color transformation matrix is formatted like so:
     *  <table>
     *      <tr><td>R: a coefficient</td><td>G: a coefficient</td><td>B: a coefficient</td></tr>
     *      <tr><td>R: b coefficient</td><td>G: b coefficient</td><td>B: b coefficient</td></tr>
@@ -123,9 +119,9 @@ public final class NightDisplayService extends SystemService
     *  </table>
     */
    private static final float[] mColorTempCoefficients = new float[] {
            0.0f, -0.00000000962353339f, -0.0000000189359041f,
            0.0f, 0.000153045476f, 0.000302412211f,
            1.0f, 0.390782778f, -0.198650895f
            0.0f, -0.0000000871377221f, -0.0000000753960646f,
            0.0f, 0.000750142586f, .000725567598f,
            1.0f, -.830130222f, -1.15546312f
    };

    private int mCurrentUser = UserHandle.USER_NULL;
@@ -410,7 +406,7 @@ public final class NightDisplayService extends SystemService
            return;
        }

        Matrix.setIdentityM(mMatrixNight, 0);
        Matrix.setIdentityM(outTemp, 0);

        final float squareTemperature = colorTemperature * colorTemperature;
        final float red = squareTemperature * mColorTempCoefficients[0]