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
This commit is contained in:
Matt Pietal
2022-05-24 11:31:46 -04:00
parent 80aeafc595
commit 1de979862b
2 changed files with 16 additions and 1 deletions

View File

@@ -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();
}

View File

@@ -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);