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

Commit 5878442b authored by Dan Gittik's avatar Dan Gittik
Browse files

Fixed auto-brightness when ALS malfunctions.

When the ALS is broken or misbehaving, auto-brightness might get
stuck in a state where it completely ignores user data points;
this fixes the issue, and reverts to manual brightness whenever
auto-brightness can't be used reliably.

Test: manual.

Change-Id: I5eb80b99dbf7cc25229dc217732515b2a4ac1b79
Fixes: 77280930
parent 0d130cbc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -222,6 +222,9 @@ class AutomaticBrightnessController {
    }

    public int getAutomaticScreenBrightness() {
        if (!mAmbientLuxValid) {
            return -1;
        }
        if (mDisplayPolicy == DisplayPowerRequest.POLICY_DOZE) {
            return (int) (mScreenAutoBrightness * mDozeScaleFactor);
        }
@@ -346,6 +349,7 @@ class AutomaticBrightnessController {
        pw.println("  mLightSensorEnabled=" + mLightSensorEnabled);
        pw.println("  mLightSensorEnableTime=" + TimeUtils.formatUptime(mLightSensorEnableTime));
        pw.println("  mAmbientLux=" + mAmbientLux);
        pw.println("  mAmbientLuxValid=" + mAmbientLuxValid);
        pw.println("  mAmbientLightHorizon=" + mAmbientLightHorizon);
        pw.println("  mBrighteningLuxThreshold=" + mBrighteningLuxThreshold);
        pw.println("  mDarkeningLuxThreshold=" + mDarkeningLuxThreshold);