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

Commit 1de97986 authored by Matt Pietal's avatar Matt Pietal
Browse files

Run cancelAction if bouncer is canceled

The cancelAction was never run on non-UDFPS devices when the bouncer
was canceled. The check for bouncerIsOrWillBeShowing() will always be
true, so move the call to cancel AFTER the bouncer hide() invocation.

Fixes: 233741191
Test: atest StatusBarKeyguardViewManagerTest
Change-Id: I0ababa6b69cdc3fea558c063a8d3839172470ee1
parent 80aeafc5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -480,12 +480,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        if (mBouncer == null) {
            return;
        }
        mBouncer.hide(destroyView);
        if (mShowing) {
            // If we were showing the bouncer and then aborting, we need to also clear out any
            // potential actions unless we actually unlocked.
            cancelPostAuthActions();
        }
        mBouncer.hide(destroyView);
        cancelPendingWakeupAction();
    }

+15 −0
Original line number Diff line number Diff line
@@ -312,12 +312,27 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
        mStatusBarKeyguardViewManager.dismissWithAction(
                action, cancelAction, true /* afterKeyguardGone */);

        when(mBouncer.isShowing()).thenReturn(false);
        mStatusBarKeyguardViewManager.hideBouncer(true);
        mStatusBarKeyguardViewManager.hide(0, 30);
        verify(action, never()).onDismiss();
        verify(cancelAction).run();
    }

    @Test
    public void testHidingBouncer_cancelsGoneRunnable() {
        OnDismissAction action = mock(OnDismissAction.class);
        Runnable cancelAction = mock(Runnable.class);
        mStatusBarKeyguardViewManager.dismissWithAction(
                action, cancelAction, true /* afterKeyguardGone */);

        when(mBouncer.isShowing()).thenReturn(false);
        mStatusBarKeyguardViewManager.hideBouncer(true);

        verify(action, never()).onDismiss();
        verify(cancelAction).run();
    }

    @Test
    public void testHiding_doesntCancelWhenShowing() {
        OnDismissAction action = mock(OnDismissAction.class);