summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Tuttle <juliatuttle@google.com> 2024-03-20 15:40:38 -0400
committer Julia Tuttle <juliatuttle@google.com> 2024-03-22 12:49:15 -0400
commit5fef41807224b1f04fcded9c9e7c63dbc31b7308 (patch)
tree8737e52ec11af1888fdb07f95aec183e47eda7af
parent93c3afadb54c4dce39433b98065207ebf9e8d6e9 (diff)
VisualInterruptionDecisionProvider: suppress peek/pulse when app suspended
If an app is suspended in focus mode, we should suppress peek and pulse; otherwise, the notifications may *immediately* peek or pulse when focus mode ends. Modify the new BubbleAppSuspendedSuppressor to suppress interruptions from suspended apps for peek, pulse, and bubble; and rename/rearrange code as necessary. Note that, despite touching code in the visual interruptions refactor, this change is *not* related to or flagged by the refactor's feature flag; this is a long-standing omission in our interruption logic, not a bug in the refactored code. Bug: 329620290 Flag: NA Test: atest VisualInterruptionDecisionProviderImplTest Change-Id: I0437f1a286183a28689b7ef0c8a604a7bc0398b6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt2
2 files changed, 6 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt
index 66b80ca97ffb..c4d9ab7a47c2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt
@@ -207,11 +207,6 @@ class BubbleNotAllowedSuppressor() :
override fun shouldSuppress(entry: NotificationEntry) = !entry.canBubble()
}
-class BubbleAppSuspendedSuppressor :
- VisualInterruptionFilter(types = setOf(BUBBLE), reason = "app is suspended") {
- override fun shouldSuppress(entry: NotificationEntry) = entry.ranking.isSuspended
-}
-
class BubbleNoMetadataSuppressor() :
VisualInterruptionFilter(types = setOf(BUBBLE), reason = "has no or invalid bubble metadata") {
@@ -221,6 +216,11 @@ class BubbleNoMetadataSuppressor() :
override fun shouldSuppress(entry: NotificationEntry) = !isValidMetadata(entry.bubbleMetadata)
}
+class AlertAppSuspendedSuppressor :
+ VisualInterruptionFilter(types = setOf(PEEK, PULSE, BUBBLE), reason = "app is suspended") {
+ override fun shouldSuppress(entry: NotificationEntry) = entry.ranking.isSuspended
+}
+
class AlertKeyguardVisibilitySuppressor(
private val keyguardNotificationVisibilityProvider: KeyguardNotificationVisibilityProvider
) : VisualInterruptionFilter(types = setOf(PEEK, PULSE, BUBBLE), reason = "hidden on keyguard") {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt
index 7937b8676e98..375b6e5cb6a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt
@@ -163,10 +163,10 @@ constructor(
addFilter(PulseLockscreenVisibilityPrivateSuppressor())
addFilter(PulseLowImportanceSuppressor())
addFilter(BubbleNotAllowedSuppressor())
- addFilter(BubbleAppSuspendedSuppressor())
addFilter(BubbleNoMetadataSuppressor())
addFilter(HunGroupAlertBehaviorSuppressor())
addFilter(HunJustLaunchedFsiSuppressor())
+ addFilter(AlertAppSuspendedSuppressor())
addFilter(AlertKeyguardVisibilitySuppressor(keyguardNotificationVisibilityProvider))
if (NotificationAvalancheSuppression.isEnabled) {