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

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

Revert "Revert Change I5ec0e757: Don't enable the light sensor if it's not being used"

This reverts commit 8b1c67ae.
We want to fully disable the lightsensor when it's not used, for two reasons:
1 - Power savings
2 - Sensors that control the backlight directly need to be disabled when
brightness control is set to manual. Forcibly enabling the sensor when
the screen turns on makes these devices incapable of using manual
brightness.

Change-Id: I64c1114348ff096e0a72b265f6f141d1ecef249c
parent c58ecabc
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();