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

Commit dc451299 authored by Fiona Campbell's avatar Fiona Campbell Committed by Automerger Merge Worker
Browse files

BrightnessChangeEvent works for increasing brightness am: 0ce5c2dc am: 7c693c24

parents f29e792d 7c693c24
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -1454,7 +1454,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        // Skip the animation when the screen is off or suspended.
        boolean brightnessAdjusted = false;
        final boolean brightnessIsTemporary =
                (mBrightnessReason.getReason() == BrightnessReason.REASON_TEMPORARY)
                (mBrightnessReasonTemp.getReason() == BrightnessReason.REASON_TEMPORARY)
                        || mAutomaticBrightnessStrategy
                        .isTemporaryAutoBrightnessAdjustmentApplied();
        if (!mPendingScreenOff) {
@@ -2159,11 +2159,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        }, mClock.uptimeMillis());
    }

    private float getAutoBrightnessAdjustmentSetting() {
        final float adj = Settings.System.getFloatForUser(mContext.getContentResolver(),
                Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f, UserHandle.USER_CURRENT);
        return Float.isNaN(adj) ? 0.0f : clampAutoBrightnessAdjustment(adj);
    }

    @Override
    public float getScreenBrightnessSetting() {
@@ -2436,9 +2431,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        }
    }

    private static float clampAutoBrightnessAdjustment(float value) {
        return MathUtils.constrain(value, -1.0f, 1.0f);
    }

    private void noteScreenState(int screenState) {
        // Log screen state change with display id
+7 −0
Original line number Diff line number Diff line
@@ -41,6 +41,13 @@ public final class BrightnessUtils {
                PowerManager.BRIGHTNESS_MAX);
    }

    /**
     * Clamps the brightness value in the maximum and the minimum brightness adjustment range
     */
    public static float clampBrightnessAdjustment(float value) {
        return MathUtils.constrain(value, -1.0f, 1.0f);
    }

    /**
     * A utility to construct the DisplayBrightnessState
     */
+2 −2
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ public class AutomaticBrightnessStrategy {
        final float adj = Settings.System.getFloatForUser(mContext.getContentResolver(),
                Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f, UserHandle.USER_CURRENT);
        mPendingAutoBrightnessAdjustment = Float.isNaN(adj) ? Float.NaN
                : BrightnessUtils.clampAbsoluteBrightness(adj);
                : BrightnessUtils.clampBrightnessAdjustment(adj);
        if (userSwitch) {
            processPendingAutoBrightnessAdjustments();
        }
@@ -402,6 +402,6 @@ public class AutomaticBrightnessStrategy {
    private float getAutoBrightnessAdjustmentSetting() {
        final float adj = Settings.System.getFloatForUser(mContext.getContentResolver(),
                Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0.0f, UserHandle.USER_CURRENT);
        return Float.isNaN(adj) ? 0.0f : BrightnessUtils.clampAbsoluteBrightness(adj);
        return Float.isNaN(adj) ? 0.0f : BrightnessUtils.clampBrightnessAdjustment(adj);
    }
}