Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fef4180 authored by Julia Tuttle's avatar Julia Tuttle
Browse files

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
parent 93c3afad
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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") {
+1 −1
Original line number Diff line number Diff line
@@ -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) {