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

Commit 940c1f1d authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Don't enable the light sensor if it's not being used

Turning the screen on always enabled the ALS, regardless of the
auto-brightness setting. This appears to be an error from
change Ib88310d642d498591e8879c8269d630ff3f7c8af, since
enableLightSensor only applies to the display, and I don't see how
this can affect the button backlights.

Change-Id: I5ec0e757602a10515ba3f1cfe10f38310d989ea6
parent 67f1ff0a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ class PowerManagerService extends IPowerManager.Stub
    private int mScreenBrightnessOverride = -1;
    private int mButtonBrightnessOverride = -1;
    private boolean mUseSoftwareAutoBrightness;
    private boolean mAutoBrightessEnabled;
    private boolean mAutoBrightessEnabled = true;
    private int[] mAutoBrightnessLevels;
    private int[] mLcdBacklightValues;
    private int[] mButtonBacklightValues;
@@ -482,6 +482,7 @@ class PowerManagerService extends IPowerManager.Stub
        }

        public void update(Observable o, Object arg) {

            synchronized (mLocks) {
                // STAY_ON_WHILE_PLUGGED_IN, default to when plugged into AC
                mStayOnConditions = getInt(STAY_ON_WHILE_PLUGGED_IN,
@@ -1675,7 +1676,7 @@ class PowerManagerService extends IPowerManager.Stub
        if (err == 0) {
            mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0);
            if (mUseSoftwareAutoBrightness) {
                enableLightSensor(on);
                enableLightSensor(on && mAutoBrightessEnabled);
                if (!on) {
                    // make sure button and key backlights are off too
                    mButtonLight.turnOff();