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

Commit 37780370 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Fix button backlights that depend on ALS

On a few devices, lighting the buttons when the screen turns on
depends on the lightsensor, regardless of the user preference.
So go back to enabling the sensor whenever the screen turns on, and
enforce the user preference after running through the light settings
once.

Change-Id: I6f036a32315eb7688a9cd11d4bd70dbca1b2fa8b
parent fad9bf0a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1676,7 +1676,7 @@ class PowerManagerService extends IPowerManager.Stub
        if (err == 0) {
            mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0);
            if (mUseSoftwareAutoBrightness) {
                enableLightSensor(on && mAutoBrightessEnabled);
                enableLightSensor(on);
                if (!on) {
                    // make sure button and key backlights are off too
                    mButtonLight.turnOff();
@@ -1689,6 +1689,12 @@ class PowerManagerService extends IPowerManager.Stub
                    lightFilterStop();
                    resetLastLightValues();
                }
                else if (!mAutoBrightessEnabled) {
                    /* Force a light sensor reset since we enabled it
                       when the screen came on */
                    mAutoBrightessEnabled = true;
                    setScreenBrightnessMode(Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
                }
            }
        }
        return err;
@@ -2573,6 +2579,7 @@ class PowerManagerService extends IPowerManager.Stub
            return;
        }


        // do not allow light sensor value to decrease unless
        // user has actively permitted it
        if (mLightDecrease) {