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

Commit 3a64ed78 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Shorter scrim delay if display is on

Reduces the scrim blanking delay in cases where the display
was already on:
- AOD enabled and display doesn't require blanking.
- Pulsing notification since we're already in a high power state.

Test: unlock with fp
Test: double tap pulsing notification
Test: unlock with fp when pulsing
Test: unlock with pin
Change-Id: I5aa98d7affc92119af6f8777462460a2b05e1374
Fixes: 73187454
parent 46304584
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
    private boolean mScreenBlankingCallbackCalled;
    private Callback mCallback;
    private boolean mWallpaperSupportsAmbientMode;
    private boolean mScreenOn;

    // Scrim blanking callbacks
    private Choreographer.FrameCallback mPendingFrameCallback;
@@ -785,10 +786,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,

            // Setting power states can happen after we push out the frame. Make sure we
            // stay fully opaque until the power state request reaches the lower levels.
            final int delay = mScreenOn ? 16 : 500;
            if (DEBUG) {
                Log.d(TAG, "Waiting for the screen to turn on...");
                Log.d(TAG, "Fading out scrims with delay: " + delay);
            }
            getHandler().postDelayed(mBlankingTransitionRunnable, 500);
            getHandler().postDelayed(mBlankingTransitionRunnable, delay);
        };
        doOnTheNextFrame(mPendingFrameCallback);
    }
@@ -904,6 +906,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
     * Interrupts blanking transitions once the display notifies that it's already on.
     */
    public void onScreenTurnedOn() {
        mScreenOn = true;
        final Handler handler = getHandler();
        if (handler.hasCallbacks(mBlankingTransitionRunnable)) {
            if (DEBUG) {
@@ -914,6 +917,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
        }
    }

    public void onScreenTurnedOff() {
        mScreenOn = false;
    }

    public interface Callback {
        default void onStart() {
        }
+1 −0
Original line number Diff line number Diff line
@@ -4413,6 +4413,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        @Override
        public void onScreenTurnedOff() {
            mFalsingManager.onScreenOff();
            mScrimController.onScreenTurnedOff();
            // If we pulse in from AOD, we turn the screen off first. However, updatingIsKeyguard
            // in that case destroys the HeadsUpManager state, so don't do it in that case.
            if (!isPulsing()) {