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

Commit 7a5e4c91 authored by Adrian Roos's avatar Adrian Roos
Browse files

WakeAndUnlock: Make sure to wait for screen turning on

Fixes an issue where instead of waiting for screen on
we start the unlock transition immediately when the screen
is already on. Instead, we have to wait for it to turn off
and then on again.

Change-Id: Ib1f66edc6ad2d3e71c4bf928b4b0e7531babf6e0
Fixes: 64080116
Test: Unlock via fingerprint a lot. Verify the status bar does not flicker.
parent 273bb516
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.LatencyTracker;
import com.android.systemui.Dependency;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;

/**
@@ -101,6 +102,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
    private final Context mContext;
    private int mPendingAuthenticatedUserId = -1;
    private boolean mPendingShowBouncer;
    private boolean mHasScreenTurnedOnSinceAuthenticating;

    public FingerprintUnlockController(Context context,
            DozeScrimController dozeScrimController,
@@ -113,6 +115,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
        mUpdateMonitor = KeyguardUpdateMonitor.getInstance(context);
        mUpdateMonitor.registerCallback(this);
        Dependency.get(WakefulnessLifecycle.class).addObserver(mWakefulnessObserver);
        Dependency.get(ScreenLifecycle.class).addObserver(mScreenObserver);
        mStatusBarWindowManager = Dependency.get(StatusBarWindowManager.class);
        mDozeScrimController = dozeScrimController;
        mKeyguardViewMediator = keyguardViewMediator;
@@ -186,6 +189,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
        }
        boolean wasDeviceInteractive = mUpdateMonitor.isDeviceInteractive();
        mMode = calculateMode();
        mHasScreenTurnedOnSinceAuthenticating = false;
        if (mMode == MODE_WAKE_AND_UNLOCK_PULSING && pulsingOrAod()) {
            // If we are waking the device up while we are pulsing the clock and the
            // notifications would light up first, creating an unpleasant animation.
@@ -228,6 +232,7 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
                            true /* allowEnterAnimation */);
                } else {
                    Trace.beginSection("MODE_WAKE_AND_UNLOCK");

                    mDozeScrimController.abortDoze();
                }
                mStatusBarWindowManager.setStatusBarFocusable(false);
@@ -354,4 +359,16 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback {
            }
        }
    };

    private final ScreenLifecycle.Observer mScreenObserver =
            new ScreenLifecycle.Observer() {
                @Override
                public void onScreenTurnedOn() {
                    mHasScreenTurnedOnSinceAuthenticating = true;
                }
            };

    public boolean hasScreenTurnedOnSinceAuthenticating() {
        return mHasScreenTurnedOnSinceAuthenticating;
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb

    protected final Context mContext;
    private final StatusBarWindowManager mStatusBarWindowManager;
    private final boolean mDisplayBlanksAfterDoze;

    protected LockPatternUtils mLockPatternUtils;
    protected ViewMediatorCallback mViewMediatorCallback;
@@ -121,6 +122,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        mLockPatternUtils = lockPatternUtils;
        mStatusBarWindowManager = Dependency.get(StatusBarWindowManager.class);
        KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitorCallback);
        mDisplayBlanksAfterDoze = context.getResources().getBoolean(
                com.android.internal.R.bool.config_displayBlanksAfterDoze);
    }

    public void registerStatusBar(StatusBar statusBar,
@@ -373,7 +376,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
                if (!staying) {
                    mStatusBarWindowManager.setKeyguardFadingAway(true);
                    if (mFingerprintUnlockController.getMode() == MODE_WAKE_AND_UNLOCK) {
                        if (!mScreenTurnedOn) {
                        boolean turnedOnSinceAuth =
                                mFingerprintUnlockController.hasScreenTurnedOnSinceAuthenticating();
                        if (!mScreenTurnedOn || mDisplayBlanksAfterDoze && !turnedOnSinceAuth) {
                            // Not ready to animate yet; either because the screen is not on yet,
                            // or it is on but will turn off before waking out of doze.
                            mDeferScrimFadeOut = true;
                        } else {