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

Commit 466dc04d authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Use -1.0f in SurfaceControl to turn off brightness

-1.0f is sent to SurfaceControl if the brightess is equal to 0.
0 was originally used; -1.0f is being used in preparation for using floating
point brightness in the whole framework.

Test: Manual
Bug: b/139959979
Change-Id: I7d72a8c39d1c225ea9c2a2651366111df3be355d
parent af30a90e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -84,8 +84,12 @@ public class LightsService extends SystemService {
                    if (DEBUG) {
                        Slog.d(TAG, "Using new setBrightness path!");
                    }
                    if (brightness == 0) {
                        SurfaceControl.setDisplayBrightness(mDisplayToken, -1.0f);
                    } else {
                        SurfaceControl.setDisplayBrightness(mDisplayToken,
                            (float) brightness / mSurfaceControlMaximumBrightness);
                                (float) (brightness - 1) / (mSurfaceControlMaximumBrightness - 1));
                    }
                } else {
                    int color = brightness & 0x000000ff;
                    color = 0xff000000 | (color << 16) | (color << 8) | color;