summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt55
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt3
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt27
4 files changed, 73 insertions, 16 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt
index c74c396741d7..c29d700396af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt
@@ -21,9 +21,9 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.util.Log
+import com.android.internal.logging.UiEventLogger
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.dagger.SysUISingleton
-import com.android.systemui.util.time.SystemClock
import javax.inject.Inject
// Class to track avalanche trigger event time.
@@ -33,6 +33,7 @@ class AvalancheProvider
constructor(
private val broadcastDispatcher: BroadcastDispatcher,
private val logger: VisualInterruptionDecisionLogger,
+ private val uiEventLogger: UiEventLogger,
) {
val TAG = "AvalancheProvider"
val timeoutMs = 120000
@@ -56,6 +57,7 @@ constructor(
return
}
Log.d(TAG, "broadcastReceiver received intent.action=" + intent.action)
+ uiEventLogger.log(AvalancheSuppressor.AvalancheEvent.START);
startTime = System.currentTimeMillis()
}
}
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 938a71fd7b82..42a5bdf0f19b 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
@@ -33,6 +33,8 @@ import android.os.PowerManager
import android.provider.Settings
import android.provider.Settings.Global.HEADS_UP_NOTIFICATIONS_ENABLED
import android.provider.Settings.Global.HEADS_UP_OFF
+import com.android.internal.logging.UiEventLogger
+import com.android.internal.logging.UiEvent;
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.settings.UserTracker
@@ -241,12 +243,12 @@ class AlertKeyguardVisibilitySuppressor(
override fun shouldSuppress(entry: NotificationEntry) =
keyguardNotificationVisibilityProvider.shouldHideNotification(entry)
}
-
class AvalancheSuppressor(
private val avalancheProvider: AvalancheProvider,
private val systemClock: SystemClock,
private val systemSettings: SystemSettings,
private val packageManager: PackageManager,
+ private val uiEventLogger: UiEventLogger,
) :
VisualInterruptionFilter(
types = setOf(PEEK, PULSE),
@@ -266,6 +268,44 @@ class AvalancheSuppressor(
SUPPRESS
}
+ enum class AvalancheEvent(private val id: Int) : UiEventLogger.UiEventEnum {
+ @UiEvent(doc = "An avalanche event occurred but this notification was suppressed by a " +
+ "non-avalanche suppressor.")
+ START(1802),
+
+ @UiEvent(doc = "HUN was suppressed in avalanche.")
+ SUPPRESS(1803),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is high priority.")
+ ALLOW_CONVERSATION_AFTER_AVALANCHE(1804),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is a high priority conversation.")
+ ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME(1805),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is a call.")
+ ALLOW_CALLSTYLE(1806),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is a calendar notification.")
+ ALLOW_CATEGORY_REMINDER(1807),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is a calendar notification.")
+ ALLOW_CATEGORY_EVENT(1808),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it has a full screen intent and " +
+ "the full screen intent permission is granted.")
+ ALLOW_FSI_WITH_PERMISSION_ON(1809),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is colorized.")
+ ALLOW_COLORIZED(1810),
+
+ @UiEvent(doc = "HUN allowed during avalanche because it is an emergency notification.")
+ ALLOW_EMERGENCY(1811);
+
+ override fun getId(): Int {
+ return id
+ }
+ }
+
override fun shouldSuppress(entry: NotificationEntry): Boolean {
if (!isCooldownEnabled()) {
return false
@@ -287,41 +327,46 @@ class AvalancheSuppressor(
entry.ranking.isConversation &&
entry.sbn.notification.getWhen() > avalancheProvider.startTime
) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_CONVERSATION_AFTER_AVALANCHE)
return State.ALLOW_CONVERSATION_AFTER_AVALANCHE
}
if (entry.channel?.isImportantConversation == true) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME)
return State.ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME
}
if (entry.sbn.notification.isStyle(Notification.CallStyle::class.java)) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_CALLSTYLE)
return State.ALLOW_CALLSTYLE
}
if (entry.sbn.notification.category == CATEGORY_REMINDER) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_CATEGORY_REMINDER)
return State.ALLOW_CATEGORY_REMINDER
}
if (entry.sbn.notification.category == CATEGORY_EVENT) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_CATEGORY_EVENT)
return State.ALLOW_CATEGORY_EVENT
}
if (entry.sbn.notification.fullScreenIntent != null) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_FSI_WITH_PERMISSION_ON)
return State.ALLOW_FSI_WITH_PERMISSION_ON
}
-
- if (entry.sbn.notification.isColorized) {
- return State.ALLOW_COLORIZED
- }
if (entry.sbn.notification.isColorized) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_COLORIZED)
return State.ALLOW_COLORIZED
}
if (
packageManager.checkPermission(RECEIVE_EMERGENCY_BROADCAST, entry.sbn.packageName) ==
PERMISSION_GRANTED
) {
+ uiEventLogger.log(AvalancheEvent.ALLOW_EMERGENCY)
return State.ALLOW_EMERGENCY
}
+ uiEventLogger.log(AvalancheEvent.SUPPRESS)
return State.SUPPRESS
}
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 7e16cd5a693f..84f8662f5fee 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
@@ -178,7 +178,8 @@ constructor(
if (NotificationAvalancheSuppression.isEnabled) {
addFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
)
avalancheProvider.register()
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt
index 7903a731c1d0..e984200c305e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt
@@ -91,7 +91,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(
@@ -110,7 +111,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldNotHeadsUp(
@@ -129,7 +131,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(
@@ -146,7 +149,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(
@@ -163,7 +167,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(
@@ -180,7 +185,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(
@@ -197,7 +203,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
assertFsiNotSuppressed()
}
@@ -208,7 +215,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
avalancheProvider.startTime = whenAgo(10)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(
@@ -232,7 +240,8 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro
).thenReturn(PERMISSION_GRANTED)
withFilter(
- AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager)
+ AvalancheSuppressor(avalancheProvider, systemClock, systemSettings, packageManager,
+ uiEventLogger)
) {
ensurePeekState()
assertShouldHeadsUp(