Fix Biometric prompt is getting dismissed while receiving the heads-up notification

NotificationPanelView treats heads-up as Expaned, we should check
fraction at the sametime to avoid dismissing BP when heads-up displayed

Bug: b/277303696
Test: atest AuthDialogPanelInteractionDetectorTest
Change-Id: I84f791b88f5d6230c662b0348a9aba77a4c4eb58
This commit is contained in:
Vincent Wang
2023-04-11 09:19:27 +00:00
parent bb0278a3a3
commit 28ba1dd2cb
2 changed files with 13 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ constructor(
private fun onPanelExpansionChanged(event: ShadeExpansionChangeEvent) =
mainExecutor.execute {
action?.let {
if (event.tracking || event.expanded) {
if (event.tracking || (event.expanded && event.fraction > 0)) {
Log.v(TAG, "Detected panel interaction, event: $event")
it.onPanelInteraction.run()
disable()

View File

@@ -51,32 +51,37 @@ class AuthDialogPanelInteractionDetectorTest : SysuiTestCase() {
@Test
fun testEnableDetector_expandWithTrack_shouldPostRunnable() {
detector.enable(action)
// simulate notification expand
shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f)
shadeExpansionStateManager.onPanelExpansionChanged(1.0f, true, true, 0f)
verify(action).run()
}
@Test
fun testEnableDetector_trackOnly_shouldPostRunnable() {
detector.enable(action)
// simulate notification expand
shadeExpansionStateManager.onPanelExpansionChanged(5566f, false, true, 5566f)
shadeExpansionStateManager.onPanelExpansionChanged(1.0f, false, true, 0f)
verify(action).run()
}
@Test
fun testEnableDetector_expandOnly_shouldPostRunnable() {
detector.enable(action)
// simulate notification expand
shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, false, 5566f)
shadeExpansionStateManager.onPanelExpansionChanged(1.0f, true, false, 0f)
verify(action).run()
}
@Test
fun testEnableDetector_expandWithoutFraction_shouldPostRunnable() {
detector.enable(action)
// simulate headsup notification
shadeExpansionStateManager.onPanelExpansionChanged(0.0f, true, false, 0f)
verifyZeroInteractions(action)
}
@Test
fun testEnableDetector_shouldNotPostRunnable() {
detector.enable(action)
detector.disable()
shadeExpansionStateManager.onPanelExpansionChanged(5566f, true, true, 5566f)
shadeExpansionStateManager.onPanelExpansionChanged(1.0f, true, true, 0f)
verifyZeroInteractions(action)
}
}