summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Tuttle <juliatuttle@google.com> 2024-03-26 17:44:20 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-03-26 17:44:20 +0000
commit60d6833f211a08248d59763c00f855612de7d51a (patch)
tree8ff8d03aa8f7e4988bb9847ef0ad7eb706095ff8
parent23758d579f930a0d143445e64c625dc443b6386b (diff)
parent5fef41807224b1f04fcded9c9e7c63dbc31b7308 (diff)
Merge changes I0437f1a2,Icbe9bcbb,Ia94dbde4,I7ba38220 into main
* changes: VisualInterruptionDecisionProvider: suppress peek/pulse when app suspended NotificationInterruptStateProvider: suppress peek/pulse when app suspended VisualInterruptionDecisionProviderTestBase: test app suspended Make ktfmt happy.
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptLogger.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt35
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt26
5 files changed, 54 insertions, 39 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 683681679569..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") {
@@ -228,11 +228,11 @@ class AlertKeyguardVisibilitySuppressor(
keyguardNotificationVisibilityProvider.shouldHideNotification(entry)
}
-
class AvalancheSuppressor(
private val avalancheProvider: AvalancheProvider,
private val systemClock: SystemClock,
-) : VisualInterruptionFilter(
+) :
+ VisualInterruptionFilter(
types = setOf(PEEK, PULSE),
reason = "avalanche",
) {
@@ -261,7 +261,7 @@ class AvalancheSuppressor(
return suppress
}
- private fun calculateState(entry: NotificationEntry): State {
+ private fun calculateState(entry: NotificationEntry): State {
if (
entry.ranking.isConversation &&
entry.sbn.notification.`when` > avalancheProvider.startTime
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptLogger.kt
index 334e08d5a78f..a2f97bdbc7a1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptLogger.kt
@@ -56,11 +56,11 @@ class NotificationInterruptLogger @Inject constructor(
}
}
- fun logSuspendedAppBubble(entry: NotificationEntry) {
+ fun logNoAlertingAppSuspended(entry: NotificationEntry) {
buffer.log(TAG, DEBUG, {
str1 = entry.logKey
}, {
- "No bubble up: notification: app $str1 is suspended"
+ "No alerting: app is suspended: $str1"
})
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
index a655c7246638..d5911141fc0f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/NotificationInterruptStateProviderImpl.java
@@ -204,11 +204,6 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
return false;
}
- if (entry.getRanking().isSuspended()) {
- mLogger.logSuspendedAppBubble(entry);
- return false;
- }
-
if (entry.getBubbleMetadata() == null
|| (entry.getBubbleMetadata().getShortcutId() == null
&& entry.getBubbleMetadata().getIntent() == null)) {
@@ -559,6 +554,13 @@ public class NotificationInterruptStateProviderImpl implements NotificationInter
}
}
+ if (entry.getRanking().isSuspended()) {
+ if (log) {
+ mLogger.logNoAlertingAppSuspended(entry);
+ }
+ return false;
+ }
+
if (mKeyguardNotificationVisibilityProvider.shouldHideNotification(entry)) {
if (log) mLogger.logNoAlertingNotificationHidden(entry);
return false;
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 dabb18b5a1c4..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
@@ -46,23 +46,22 @@ import javax.inject.Inject
class VisualInterruptionDecisionProviderImpl
@Inject
constructor(
- private val ambientDisplayConfiguration: AmbientDisplayConfiguration,
- private val batteryController: BatteryController,
- deviceProvisionedController: DeviceProvisionedController,
- private val eventLog: EventLog,
- private val globalSettings: GlobalSettings,
- private val headsUpManager: HeadsUpManager,
- private val keyguardNotificationVisibilityProvider: KeyguardNotificationVisibilityProvider,
- keyguardStateController: KeyguardStateController,
- private val logger: VisualInterruptionDecisionLogger,
- @Main private val mainHandler: Handler,
- private val powerManager: PowerManager,
- private val statusBarStateController: StatusBarStateController,
- private val systemClock: SystemClock,
- private val uiEventLogger: UiEventLogger,
- private val userTracker: UserTracker,
- private val avalancheProvider: AvalancheProvider
-
+ private val ambientDisplayConfiguration: AmbientDisplayConfiguration,
+ private val batteryController: BatteryController,
+ deviceProvisionedController: DeviceProvisionedController,
+ private val eventLog: EventLog,
+ private val globalSettings: GlobalSettings,
+ private val headsUpManager: HeadsUpManager,
+ private val keyguardNotificationVisibilityProvider: KeyguardNotificationVisibilityProvider,
+ keyguardStateController: KeyguardStateController,
+ private val logger: VisualInterruptionDecisionLogger,
+ @Main private val mainHandler: Handler,
+ private val powerManager: PowerManager,
+ private val statusBarStateController: StatusBarStateController,
+ private val systemClock: SystemClock,
+ private val uiEventLogger: UiEventLogger,
+ private val userTracker: UserTracker,
+ private val avalancheProvider: AvalancheProvider
) : VisualInterruptionDecisionProvider {
init {
@@ -164,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) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt
index 66a306e3fc02..24f670831193 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderTestBase.kt
@@ -327,6 +327,13 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() {
}
@Test
+ fun testShouldNotPeek_appSuspended() {
+ ensurePeekState()
+ assertShouldNotBubble(buildPeekEntry { packageSuspended = true })
+ assertNoEventsLogged()
+ }
+
+ @Test
fun testShouldNotPeek_hiddenOnKeyguard() {
ensurePeekState({ keyguardShouldHideNotification = true })
assertShouldNotHeadsUp(buildPeekEntry())
@@ -412,6 +419,13 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() {
}
@Test
+ fun testShouldNotPulse_appSuspended() {
+ ensurePulseState()
+ assertShouldNotHeadsUp(buildPulseEntry { packageSuspended = true })
+ assertNoEventsLogged()
+ }
+
+ @Test
fun testShouldNotPulse_hiddenOnKeyguard() {
ensurePulseState({ keyguardShouldHideNotification = true })
assertShouldNotHeadsUp(buildPulseEntry())
@@ -595,16 +609,16 @@ abstract class VisualInterruptionDecisionProviderTestBase : SysuiTestCase() {
}
@Test
- fun testShouldNotBubble_hiddenOnKeyguard() {
- ensureBubbleState({ keyguardShouldHideNotification = true })
- assertShouldNotBubble(buildBubbleEntry())
+ fun testShouldNotBubble_appSuspended() {
+ ensureBubbleState()
+ assertShouldNotBubble(buildBubbleEntry { packageSuspended = true })
assertNoEventsLogged()
}
@Test
- fun testShouldNotBubble_bubbleAppSuspended() {
- ensureBubbleState()
- assertShouldNotBubble(buildBubbleEntry { packageSuspended = true })
+ fun testShouldNotBubble_hiddenOnKeyguard() {
+ ensureBubbleState({ keyguardShouldHideNotification = true })
+ assertShouldNotBubble(buildBubbleEntry())
assertNoEventsLogged()
}