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

Commit bb923857 authored by Rupesh Bansal's avatar Rupesh Bansal
Browse files

Fix the isUserSetBrightness flag being sent to BrightnessTracker

Bug: 270939084
Test: Manually verify the flag being sent to the BrightnessTracker
Change-Id: I5cae9aad26db46ea0a99a3488ad8da77dee8e5e7
parent 61804812
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -320,7 +320,7 @@ public class BrightnessTracker {
     * Notify the BrightnessTracker that the user has changed the brightness of the display.
     */
    public void notifyBrightnessChanged(float brightness, boolean userInitiated,
            float powerBrightnessFactor, boolean isUserSetBrightness,
            float powerBrightnessFactor, boolean wasShortTermModelActive,
            boolean isDefaultBrightnessConfig, String uniqueDisplayId, float[] luxValues,
            long[] luxTimestamps) {
        if (DEBUG) {
@@ -329,7 +329,7 @@ public class BrightnessTracker {
        }
        Message m = mBgHandler.obtainMessage(MSG_BRIGHTNESS_CHANGED,
                userInitiated ? 1 : 0, 0 /*unused*/, new BrightnessChangeValues(brightness,
                        powerBrightnessFactor, isUserSetBrightness, isDefaultBrightnessConfig,
                        powerBrightnessFactor, wasShortTermModelActive, isDefaultBrightnessConfig,
                        mInjector.currentTimeMillis(), uniqueDisplayId, luxValues, luxTimestamps));
        m.sendToTarget();
    }
@@ -343,7 +343,7 @@ public class BrightnessTracker {
    }

    private void handleBrightnessChanged(float brightness, boolean userInitiated,
            float powerBrightnessFactor, boolean isUserSetBrightness,
            float powerBrightnessFactor, boolean wasShortTermModelActive,
            boolean isDefaultBrightnessConfig, long timestamp, String uniqueDisplayId,
            float[] luxValues, long[] luxTimestamps) {
        BrightnessChangeEvent.Builder builder;
@@ -368,7 +368,7 @@ public class BrightnessTracker {
            builder.setBrightness(brightness);
            builder.setTimeStamp(timestamp);
            builder.setPowerBrightnessFactor(powerBrightnessFactor);
            builder.setUserBrightnessPoint(isUserSetBrightness);
            builder.setUserBrightnessPoint(wasShortTermModelActive);
            builder.setIsDefaultBrightnessConfig(isDefaultBrightnessConfig);
            builder.setUniqueDisplayId(uniqueDisplayId);

@@ -997,7 +997,7 @@ public class BrightnessTracker {
                    BrightnessChangeValues values = (BrightnessChangeValues) msg.obj;
                    boolean userInitiatedChange = (msg.arg1 == 1);
                    handleBrightnessChanged(values.brightness, userInitiatedChange,
                            values.powerBrightnessFactor, values.isUserSetBrightness,
                            values.powerBrightnessFactor, values.wasShortTermModelActive,
                            values.isDefaultBrightnessConfig, values.timestamp,
                            values.uniqueDisplayId, values.luxValues, values.luxTimestamps);
                    break;
@@ -1031,7 +1031,7 @@ public class BrightnessTracker {
    private static class BrightnessChangeValues {
        public final float brightness;
        public final float powerBrightnessFactor;
        public final boolean isUserSetBrightness;
        public final boolean wasShortTermModelActive;
        public final boolean isDefaultBrightnessConfig;
        public final long timestamp;
        public final String uniqueDisplayId;
@@ -1039,11 +1039,11 @@ public class BrightnessTracker {
        public final long[] luxTimestamps;

        BrightnessChangeValues(float brightness, float powerBrightnessFactor,
                boolean isUserSetBrightness, boolean isDefaultBrightnessConfig,
                boolean wasShortTermModelActive, boolean isDefaultBrightnessConfig,
                long timestamp, String uniqueDisplayId, float[] luxValues, long[] luxTimestamps) {
            this.brightness = brightness;
            this.powerBrightnessFactor = powerBrightnessFactor;
            this.isUserSetBrightness = isUserSetBrightness;
            this.wasShortTermModelActive = wasShortTermModelActive;
            this.isDefaultBrightnessConfig = isDefaultBrightnessConfig;
            this.timestamp = timestamp;
            this.uniqueDisplayId = uniqueDisplayId;
+6 −6
Original line number Diff line number Diff line
@@ -1538,10 +1538,10 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        // user, or is a temporary adjustment.
        boolean userInitiatedChange = (Float.isNaN(brightnessState))
                && (autoBrightnessAdjustmentChanged || userSetBrightnessChanged);
        boolean hadUserBrightnessPoint = false;
        boolean wasShortTermModelActive = false;
        // Configure auto-brightness.
        if (mAutomaticBrightnessController != null) {
            hadUserBrightnessPoint = mAutomaticBrightnessController.hasUserDataPoints();
            wasShortTermModelActive = mAutomaticBrightnessController.hasUserDataPoints();
            mAutomaticBrightnessController.configure(autoBrightnessState,
                    mBrightnessConfiguration,
                    mLastUserSetScreenBrightness,
@@ -1823,7 +1823,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                    userInitiatedChange = false;
                }
                notifyBrightnessTrackerChanged(brightnessState, userInitiatedChange,
                        hadUserBrightnessPoint);
                        wasShortTermModelActive);
            }

            // We save the brightness info *after* the brightness setting has been changed and
@@ -1865,7 +1865,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        mTempBrightnessEvent.setRbcStrength(mCdsi != null
                ? mCdsi.getReduceBrightColorsStrength() : -1);
        mTempBrightnessEvent.setPowerFactor(mPowerRequest.screenLowPowerBrightnessFactor);
        mTempBrightnessEvent.setWasShortTermModelActive(hadUserBrightnessPoint);
        mTempBrightnessEvent.setWasShortTermModelActive(wasShortTermModelActive);
        // Temporary is what we use during slider interactions. We avoid logging those so that
        // we don't spam logcat when the slider is being used.
        boolean tempToTempTransition =
@@ -2634,7 +2634,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    }

    private void notifyBrightnessTrackerChanged(float brightness, boolean userInitiated,
            boolean hadUserDataPoint) {
            boolean wasShortTermModelActive) {
        final float brightnessInNits = convertToNits(brightness);
        if (mUseAutoBrightness && brightnessInNits >= 0.0f
                && mAutomaticBrightnessController != null && mBrightnessTracker != null) {
@@ -2645,7 +2645,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                    ? mPowerRequest.screenLowPowerBrightnessFactor
                    : 1.0f;
            mBrightnessTracker.notifyBrightnessChanged(brightnessInNits, userInitiated,
                    powerFactor, hadUserDataPoint,
                    powerFactor, wasShortTermModelActive,
                    mAutomaticBrightnessController.isDefaultConfig(), mUniqueDisplayId,
                    mAutomaticBrightnessController.getLastSensorValues(),
                    mAutomaticBrightnessController.getLastSensorTimestamps());
+6 −6
Original line number Diff line number Diff line
@@ -1250,10 +1250,10 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        // user, or is a temporary adjustment.
        boolean userInitiatedChange = (Float.isNaN(brightnessState))
                && (autoBrightnessAdjustmentChanged || userSetBrightnessChanged);
        boolean hadUserBrightnessPoint = false;
        boolean wasShortTermModelActive = false;
        // Configure auto-brightness.
        if (mAutomaticBrightnessController != null) {
            hadUserBrightnessPoint = mAutomaticBrightnessController.hasUserDataPoints();
            wasShortTermModelActive = mAutomaticBrightnessController.hasUserDataPoints();
            mAutomaticBrightnessController.configure(autoBrightnessState,
                    mBrightnessConfiguration,
                    mDisplayBrightnessController.getLastUserSetScreenBrightness(),
@@ -1537,7 +1537,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
                    userInitiatedChange = false;
                }
                notifyBrightnessTrackerChanged(brightnessState, userInitiatedChange,
                        hadUserBrightnessPoint);
                        wasShortTermModelActive);
            }

            // We save the brightness info *after* the brightness setting has been changed and
@@ -1579,7 +1579,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        mTempBrightnessEvent.setRbcStrength(mCdsi != null
                ? mCdsi.getReduceBrightColorsStrength() : -1);
        mTempBrightnessEvent.setPowerFactor(mPowerRequest.screenLowPowerBrightnessFactor);
        mTempBrightnessEvent.setWasShortTermModelActive(hadUserBrightnessPoint);
        mTempBrightnessEvent.setWasShortTermModelActive(wasShortTermModelActive);
        mTempBrightnessEvent.setDisplayBrightnessStrategyName(displayBrightnessState
                .getDisplayBrightnessStrategyName());
        // Temporary is what we use during slider interactions. We avoid logging those so that
@@ -2220,7 +2220,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
    }

    private void notifyBrightnessTrackerChanged(float brightness, boolean userInitiated,
            boolean hadUserDataPoint) {
            boolean wasShortTermModelActive) {
        final float brightnessInNits = convertToNits(brightness);
        if (mUseAutoBrightness && brightnessInNits >= 0.0f
                && mAutomaticBrightnessController != null && mBrightnessTracker != null) {
@@ -2231,7 +2231,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
                    ? mPowerRequest.screenLowPowerBrightnessFactor
                    : 1.0f;
            mBrightnessTracker.notifyBrightnessChanged(brightnessInNits, userInitiated,
                    powerFactor, hadUserDataPoint,
                    powerFactor, wasShortTermModelActive,
                    mAutomaticBrightnessController.isDefaultConfig(), mUniqueDisplayId,
                    mAutomaticBrightnessController.getLastSensorValues(),
                    mAutomaticBrightnessController.getLastSensorTimestamps());