From 298a639008149349169ad1008e462f2348e00e05 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 4 Jan 2023 10:38:01 -0800 Subject: [PATCH] [Bouncer] Only show swipe up and try again... when face auth is enrolled and face auth fails. This was previously submitted and then reverted, but the revert was prompted by some additional changes I made to the bouncer. Fixes: 259007288 Test: Enroll in FP and face. Open bouncer and auth via face. Turn off and on and open bouncer again to view initial message. Test: Unit Test Change-Id: Ie8762cfb6e1d74166ce6fa3723e664638708d77c --- .../statusbar/KeyguardIndicationController.java | 3 ++- .../KeyguardIndicationControllerTest.java | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index b7001e476dcf1..6a658b6ee047a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -930,7 +930,8 @@ public class KeyguardIndicationController { if (mStatusBarKeyguardViewManager.isBouncerShowing()) { if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) { return; // udfps affordance is highlighted, no need to show action to unlock - } else if (mKeyguardUpdateMonitor.isFaceEnrolled()) { + } else if (mKeyguardUpdateMonitor.isFaceEnrolled() + && !mKeyguardUpdateMonitor.getIsFaceAuthenticated()) { String message = mContext.getString(R.string.keyguard_retry); mStatusBarKeyguardViewManager.setKeyguardMessage(message, mInitialTextColorState); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index 8d96932f0051f..d2dd43308fcc8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -661,6 +661,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { String message = mContext.getString(R.string.keyguard_retry); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); when(mKeyguardUpdateMonitor.isFaceEnrolled()).thenReturn(true); + when(mKeyguardUpdateMonitor.getIsFaceAuthenticated()).thenReturn(false); mController.setVisible(true); mController.getKeyguardCallback().onBiometricError(FACE_ERROR_TIMEOUT, @@ -669,6 +670,21 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).setKeyguardMessage(eq(message), any()); } + @Test + public void transientIndication_swipeUpToRetry_faceAuthenticated() { + createController(); + String message = mContext.getString(R.string.keyguard_retry); + when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); + when(mKeyguardUpdateMonitor.getIsFaceAuthenticated()).thenReturn(true); + when(mKeyguardUpdateMonitor.isFaceEnrolled()).thenReturn(true); + + mController.setVisible(true); + mController.getKeyguardCallback().onBiometricError(FACE_ERROR_TIMEOUT, + "A message", BiometricSourceType.FACE); + + verify(mStatusBarKeyguardViewManager, never()).setKeyguardMessage(eq(message), any()); + } + @Test public void faceErrorTimeout_whenFingerprintEnrolled_doesNotShowMessage() { createController();