summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vincent Wang <firewall@google.com> 2023-04-12 06:00:20 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-04-12 06:00:20 +0000
commit5a0eb9c2aefbe3405bdd772c543f50eb3baecaec (patch)
tree387eb55b50f1c3d4df08b6981114a57c5993a3f1
parentbe0315f9448a353bf61a5cd5c4d0b8d1d0b09c8d (diff)
parent28ba1dd2cb181808416ca18ecd605c3b2e452569 (diff)
Merge "Fix Biometric prompt is getting dismissed while receiving the heads-up notification" into udc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt19
2 files changed, 13 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetector.kt
index d15a2afa0d4a..6c62a3936910 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 || event.expanded) {
+ if (event.tracking || (event.expanded && event.fraction > 0)) {
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 b41053cdea50..ef750be90b4b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthDialogPanelInteractionDetectorTest.kt
@@ -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)
}
}