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

Commit 1c1cbbc1 authored by Josh Stone's avatar Josh Stone
Browse files

Only check electron beam for on/off transitions [issue 3263]

When deciding whether to fade a brightness change, the electron beam
settings should only apply when we're toggling on or off.  If we're just
adjusting the brightness level, let it fade normally.

Change-Id: Ibb800c4e49bf91ef97cb4a57168fb58d4ebf667a
parent faea1156
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -2118,11 +2118,12 @@ class PowerManagerService extends IPowerManager.Stub
        }

        public void run() {
            if (mAnimateScreenLights ||
                    (!mAnimateScreenLights && Settings.System.getInt(mContext.getContentResolver(),
                            ELECTRON_BEAM_ANIMATION_OFF,
                            mContext.getResources().getBoolean(
                                    com.android.internal.R.bool.config_enableScreenOffAnimation) ? 1 : 0) == 0)) {
            // Check for the electron beam for fully on/off transitions.
            // Otherwise, allow it to fade the brightness as normal.
            final boolean electrifying = animating &&
                ((mElectronBeamAnimationOff && targetValue == Power.BRIGHTNESS_OFF) ||
                 (mElectronBeamAnimationOn && (int)curValue == Power.BRIGHTNESS_OFF));
            if (mAnimateScreenLights || !electrifying) {
                synchronized (mLocks) {
                    long now = SystemClock.uptimeMillis();
                    boolean more = mScreenBrightness.stepLocked();
@@ -2132,9 +2133,7 @@ class PowerManagerService extends IPowerManager.Stub
                }
            } else {
                synchronized (mLocks) {
                    // we're turning off
                    final boolean animate = animating && targetValue == Power.BRIGHTNESS_OFF;
                    if (animate) {
                    if (electrifying) {
                        // It's pretty scary to hold mLocks for this long, and we should
                        // redesign this, but it works for now.
                        nativeStartSurfaceFlingerAnimation(