From f2e48e380fdb03fefbd31ed8a864f8a51e51e8ae Mon Sep 17 00:00:00 2001 From: Vincent Wang Date: Wed, 29 Mar 2023 03:55:18 +0000 Subject: [PATCH] Fix Biometric prompt not close after opening notification using Quick Tap Bug: b/275532805 Test: [PRE-CONDITION] 1. Select "Show Notification" in Quick Tap. 2. 1 finger is enrolled. [STEPS TO REPRODUCE] 1. Launch biometric prompt. 2. Backtap to show the notification. 3. Backtap again to dismiss the notification. 4. From notification open settings app/access wifi/bluetooth settings by long press. Change-Id: Ifaceac98b8b7d579ba24b57167852a5f6cd8caff --- .../AuthDialogPanelInteractionDetector.kt | 2 +- .../AuthDialogPanelInteractionDetectorTest.kt | 24 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt index 64211b5b138e1..d15a2afa0d4a2 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt @@ -39,7 +39,7 @@ constructor( private fun onPanelExpansionChanged(event: ShadeExpansionChangeEvent) = mainExecutor.execute { action?.let { - if (event.tracking) { + if (event.tracking || event.expanded) { Log.v(TAG, "Detected panel interaction, event: $event") it.onPanelInteraction.run() disable() diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt index 6ddba0b4719cf..b41053cdea50c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt @@ -25,7 +25,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mock -import org.mockito.Mockito.timeout +import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyZeroInteractions import org.mockito.junit.MockitoJUnit @@ -49,17 +49,31 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() { } @Test - fun testEnableDetector_shouldPostRunnable() { + fun testEnableDetector_expandWithTrack_shouldPostRunnable() { detector.enable(action) // simulate notification expand shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f) - verify(action, timeout(5000).times(1)).run() + verify(action).run() + } + + @Test + fun testEnableDetector_trackOnly_shouldPostRunnable() { + detector.enable(action) + // simulate notification expand + shadeExpansionStateManager.onPanelExpansionChanged(5566f, false, true, 5566f) + verify(action).run() + } + + @Test + fun testEnableDetector_expandOnly_shouldPostRunnable() { + detector.enable(action) + // simulate notification expand + shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, false, 5566f) + verify(action).run() } @Test fun testEnableDetector_shouldNotPostRunnable() { - var detector = - AuthDialogPanelInteractionDetector(shadeExpansionStateManager, mContext.mainExecutor) detector.enable(action) detector.disable() shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f)