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

Commit 85d33ae9 authored by Lucas Silva's avatar Lucas Silva
Browse files

Don't hide the bouncer when resetting keyguard if keyguard is already

showing.

This avoids hiding the bouncer if the user could already be interacting
with it.

Fixes: 277614049
Test: set lock timeout to 5s, pressed power button to start dreaming and
lock device, quickly pulled up the bouncer, and verified it doesn't
dismiss itself after 5s

Change-Id: I59b3867c05e2698737e52eb355749c8b0e734925
parent 1c16aa4c
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -1957,11 +1957,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
        if (mShowing && mKeyguardStateController.isShowing()) {
            if (mPM.isInteractive() && !mHiding) {
                // It's already showing, and we're not trying to show it while the screen is off.
                // We can simply reset all of the views.
                // We can simply reset all of the views, but don't hide the bouncer in case the user
                // is currently interacting with it.
                if (DEBUG) Log.d(TAG, "doKeyguard: not showing (instead, resetting) because it is "
                        + "already showing, we're interactive, and we were not previously hiding. "
                        + "It should be safe to short-circuit here.");
                resetStateLocked();
                resetStateLocked(/* hideBouncer= */ false);
                return;
            } else {
                // We are trying to show the keyguard while the screen is off or while we were in
@@ -2035,8 +2036,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
     * @see #handleReset
     */
    private void resetStateLocked() {
        resetStateLocked(/* hideBouncer= */ true);
    }

    private void resetStateLocked(boolean hideBouncer) {
        if (DEBUG) Log.e(TAG, "resetStateLocked");
        Message msg = mHandler.obtainMessage(RESET);
        Message msg = mHandler.obtainMessage(RESET, hideBouncer ? 1 : 0, 0);
        mHandler.sendMessage(msg);
    }

@@ -2226,7 +2231,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
                    handleHide();
                    break;
                case RESET:
                    handleReset();
                    handleReset(msg.arg1 != 0);
                    break;
                case VERIFY_UNLOCK:
                    Trace.beginSection("KeyguardViewMediator#handleMessage VERIFY_UNLOCK");
@@ -3008,10 +3013,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
     * Handle message sent by {@link #resetStateLocked}
     * @see #RESET
     */
    private void handleReset() {
    private void handleReset(boolean hideBouncer) {
        synchronized (KeyguardViewMediator.this) {
            if (DEBUG) Log.d(TAG, "handleReset");
            mKeyguardViewControllerLazy.get().reset(true /* hideBouncerWhenShowing */);
            mKeyguardViewControllerLazy.get().reset(hideBouncer);
        }

        scheduleNonStrongBiometricIdleTimeout();
+1 −1
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        TestableLooper.get(this).processAllMessages();

        assertTrue(mViewMediator.isShowingAndNotOccluded());
        verify(mStatusBarKeyguardViewManager).reset(anyBoolean());
        verify(mStatusBarKeyguardViewManager).reset(false);
    }

    @Test