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

Commit d3269219 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't report slider events with bad lux readings."

parents 8338f517 b54d40ba
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -288,6 +288,10 @@ class AutomaticBrightnessController {
        return mScreenAutoBrightness;
    }

    public boolean hasValidAmbientLux() {
        return mAmbientLuxValid;
    }

    public float getAutomaticScreenBrightnessAdjustment() {
        return mBrightnessMapper.getAutoBrightnessAdjustment();
    }
@@ -648,9 +652,9 @@ class AutomaticBrightnessController {
                mLightSensorWarmUpTimeConfig + mLightSensorEnableTime;
            if (time < timeWhenSensorWarmedUp) {
                if (mLoggingEnabled) {
                    Slog.d(TAG, "updateAmbientLux: Sensor not  ready yet: " +
                            "time=" + time + ", " +
                            "timeWhenSensorWarmedUp=" + timeWhenSensorWarmedUp);
                    Slog.d(TAG, "updateAmbientLux: Sensor not ready yet: "
                            + "time=" + time + ", "
                            + "timeWhenSensorWarmedUp=" + timeWhenSensorWarmedUp);
                }
                mHandler.sendEmptyMessageAtTime(MSG_UPDATE_AMBIENT_LUX,
                        timeWhenSensorWarmedUp);
+7 −1
Original line number Diff line number Diff line
@@ -874,7 +874,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call

        // If the brightness is already set then it's been overridden by something other than the
        // user, or is a temporary adjustment.
        final boolean userInitiatedChange = brightness < 0
        boolean userInitiatedChange = brightness < 0
                && (autoBrightnessAdjustmentChanged || userSetBrightnessChanged);

        boolean hadUserBrightnessPoint = false;
@@ -1010,6 +1010,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            }

            if (!brightnessIsTemporary) {
                if (userInitiatedChange && (mAutomaticBrightnessController == null
                        || !mAutomaticBrightnessController.hasValidAmbientLux())) {
                    // If we don't have a valid lux reading we can't report a valid
                    // slider event so notify as if the system changed the brightness.
                    userInitiatedChange = false;
                }
                notifyBrightnessChanged(brightness, userInitiatedChange, hadUserBrightnessPoint);
            }