From a055a671dfeb46b19f080e96cc3de3afbc5686c9 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Tue, 16 Jul 2019 13:46:25 -0700 Subject: [PATCH] Dismiss bouncer properly on SHADE_LOCKED Test: atest BiometricsUnlockControllerTest Test: dismiss bouncer after hitting reply button Test: hit back on bouncer on shade_locked Test: tap on padlock on camera app, swipe up to retry Bug: 134096479 Fixes: 137517676 Change-Id: I12e5bbd2c5ceac642a281fc16c5398e09e65ca9d --- .../phone/BiometricUnlockController.java | 7 +++-- .../phone/BiometricsUnlockControllerTest.java | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index ea25ca89c8834..6a0d6e1954ab6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -467,8 +467,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { } if (mStatusBarKeyguardViewManager.isShowing()) { if (mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing() && unlockingAllowed) { - return bypass && !mKeyguardBypassController.canPlaySubtleWindowAnimations() - ? MODE_UNLOCK_COLLAPSING : MODE_UNLOCK_FADING; + if (bypass && mKeyguardBypassController.canPlaySubtleWindowAnimations()) { + return MODE_UNLOCK_FADING; + } else { + return MODE_DISMISS_BOUNCER; + } } else if (unlockingAllowed) { return bypass ? MODE_UNLOCK_FADING : MODE_NONE; } else { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index a99dc7fb6924b..7d9920db36a45 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.phone; +import static com.google.common.truth.Truth.assertThat; + import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; @@ -191,6 +193,34 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); } + @Test + public void onBiometricAuthenticated_whenBypassOnBouncer_dismissBouncer() { + reset(mKeyguardBypassController); + when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true); + when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); + when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true); + when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true); + mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, + BiometricSourceType.FACE); + + verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); + assertThat(mBiometricUnlockController.getMode()) + .isEqualTo(BiometricUnlockController.MODE_DISMISS_BOUNCER); + } + + @Test + public void onBiometricAuthenticated_whenBypassOnBouncer_respectsCanPlaySubtleAnim() { + when(mUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true); + when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); + when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true); + mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, + BiometricSourceType.FACE); + + verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); + assertThat(mBiometricUnlockController.getMode()) + .isEqualTo(BiometricUnlockController.MODE_UNLOCK_FADING); + } + @Test public void onBiometricAuthenticated_whenFaceAndPulsing_dontDismissKeyguard() { reset(mUpdateMonitor);