Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +6 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.StatusBarState.SHADE import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.MAX_HUN_WHEN_AGE_MS import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.HUN_SUPPRESSED_OLD_WHEN import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.BUBBLE import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PEEK import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PULSE Loading Loading @@ -141,7 +142,11 @@ class PeekDeviceNotInUseSuppressor( } class PeekOldWhenSuppressor(private val systemClock: SystemClock) : VisualInterruptionFilter(types = setOf(PEEK), reason = "has old `when`") { VisualInterruptionFilter( types = setOf(PEEK), reason = "has old `when`", uiEventId = HUN_SUPPRESSED_OLD_WHEN ) { private fun whenAge(entry: NotificationEntry) = systemClock.currentTimeMillis() - entry.sbn.notification.`when` Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/FullScreenIntentDecisionProvider.kt +27 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.interruption import android.app.NotificationManager.IMPORTANCE_HIGH import android.os.PowerManager import com.android.internal.logging.UiEventLogger.UiEventEnum import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.notification.collection.NotificationEntry Loading @@ -37,6 +38,10 @@ import com.android.systemui.statusbar.notification.interruption.FullScreenIntent import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_SUPPRESSED_ONLY_BY_DND import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_SUPPRESSIVE_BUBBLE_METADATA import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_NO_HUN_OR_KEYGUARD import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_SUPPRESSIVE_BUBBLE_METADATA import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR import com.android.systemui.statusbar.notification.interruption.VisualInterruptionSuppressor.EventLogData import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.KeyguardStateController Loading @@ -52,6 +57,8 @@ class FullScreenIntentDecisionProvider( val logReason: String val shouldLog: Boolean val isWarning: Boolean val uiEventId: UiEventEnum? val eventLogData: EventLogData? } private enum class DecisionImpl( Loading @@ -60,7 +67,9 @@ class FullScreenIntentDecisionProvider( override val wouldFsiWithoutDnd: Boolean = shouldFsi, val supersedesDnd: Boolean = false, override val shouldLog: Boolean = true, override val isWarning: Boolean = false override val isWarning: Boolean = false, override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : Decision { NO_FSI_NO_FULL_SCREEN_INTENT( false, Loading @@ -73,9 +82,17 @@ class FullScreenIntentDecisionProvider( NO_FSI_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR( false, "suppressive group alert behavior", isWarning = true isWarning = true, uiEventId = FSI_SUPPRESSED_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR, eventLogData = EventLogData("231322873", "groupAlertBehavior") ), NO_FSI_SUPPRESSIVE_BUBBLE_METADATA( false, "suppressive bubble metadata", isWarning = true, uiEventId = FSI_SUPPRESSED_SUPPRESSIVE_BUBBLE_METADATA, eventLogData = EventLogData("274759612", "bubbleMetadata") ), NO_FSI_SUPPRESSIVE_BUBBLE_METADATA(false, "suppressive bubble metadata", isWarning = true), NO_FSI_PACKAGE_SUSPENDED(false, "package suspended"), FSI_DEVICE_NOT_INTERACTIVE(true, "device is not interactive"), FSI_DEVICE_DREAMING(true, "device is dreaming"), Loading @@ -84,7 +101,13 @@ class FullScreenIntentDecisionProvider( FSI_KEYGUARD_OCCLUDED(true, "keyguard is occluded"), FSI_LOCKED_SHADE(true, "locked shade"), FSI_DEVICE_NOT_PROVISIONED(true, "device not provisioned"), NO_FSI_NO_HUN_OR_KEYGUARD(false, "no HUN or keyguard", isWarning = true), NO_FSI_NO_HUN_OR_KEYGUARD( false, "no HUN or keyguard", isWarning = true, uiEventId = FSI_SUPPRESSED_NO_HUN_OR_KEYGUARD, eventLogData = EventLogData("231322873", "no hun or keyguard") ), NO_FSI_SUPPRESSED_BY_DND(false, "suppressed by DND", wouldFsiWithoutDnd = false), NO_FSI_SUPPRESSED_ONLY_BY_DND(false, "suppressed only by DND", wouldFsiWithoutDnd = true) } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt +38 −5 Original line number Diff line number Diff line Loading @@ -20,12 +20,15 @@ import android.os.Handler import android.os.PowerManager import android.util.Log import com.android.internal.annotations.VisibleForTesting import com.android.internal.logging.UiEventLogger import com.android.internal.logging.UiEventLogger.UiEventEnum import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.interruption.VisualInterruptionDecisionProvider.Decision import com.android.systemui.statusbar.notification.interruption.VisualInterruptionDecisionProvider.FullScreenIntentDecision import com.android.systemui.statusbar.notification.interruption.VisualInterruptionSuppressor.EventLogData import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.BUBBLE import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PEEK import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PULSE Loading @@ -33,6 +36,7 @@ import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.EventLog import com.android.systemui.util.settings.GlobalSettings import com.android.systemui.util.time.SystemClock import javax.inject.Inject Loading @@ -43,6 +47,7 @@ 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, Loading @@ -52,14 +57,25 @@ constructor( private val powerManager: PowerManager, private val statusBarStateController: StatusBarStateController, private val systemClock: SystemClock, private val uiEventLogger: UiEventLogger, private val userTracker: UserTracker, ) : VisualInterruptionDecisionProvider { interface Loggable { val uiEventId: UiEventEnum? val eventLogData: EventLogData? } private class DecisionImpl( override val shouldInterrupt: Boolean, override val logReason: String ) : Decision private data class LoggableDecision private constructor(val decision: DecisionImpl) { private data class LoggableDecision private constructor( val decision: DecisionImpl, override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : Loggable { companion object { val unsuppressed = LoggableDecision(DecisionImpl(shouldInterrupt = true, logReason = "not suppressed")) Loading @@ -74,7 +90,9 @@ constructor( fun suppressed(suppressor: VisualInterruptionSuppressor) = LoggableDecision( DecisionImpl(shouldInterrupt = false, logReason = suppressor.reason) DecisionImpl(shouldInterrupt = false, logReason = suppressor.reason), uiEventId = suppressor.uiEventId, eventLogData = suppressor.eventLogData ) } } Loading @@ -82,7 +100,7 @@ constructor( private class FullScreenIntentDecisionImpl( val entry: NotificationEntry, private val fsiDecision: FullScreenIntentDecisionProvider.Decision ) : FullScreenIntentDecision { ) : FullScreenIntentDecision, Loggable { var hasBeenLogged = false override val shouldInterrupt Loading @@ -99,6 +117,12 @@ constructor( val isWarning get() = fsiDecision.isWarning override val uiEventId get() = fsiDecision.uiEventId override val eventLogData get() = fsiDecision.eventLogData } private val fullScreenIntentDecisionProvider = Loading Loading @@ -214,9 +238,10 @@ constructor( private fun logDecision( type: VisualInterruptionType, entry: NotificationEntry, loggable: LoggableDecision loggableDecision: LoggableDecision ) { logger.logDecision(type.name, entry, loggable.decision) logger.logDecision(type.name, entry, loggableDecision.decision) logEvents(entry, loggableDecision) } override fun makeUnloggedFullScreenIntentDecision( Loading Loading @@ -250,6 +275,14 @@ constructor( } logger.logFullScreenIntentDecision(decision.entry, decision, decision.isWarning) logEvents(decision.entry, decision) } private fun logEvents(entry: NotificationEntry, loggable: Loggable) { loggable.uiEventId?.let { uiEventLogger.log(it, entry.sbn.uid, entry.sbn.packageName) } loggable.eventLogData?.let { eventLog.writeEvent(0x534e4554, it.number, entry.sbn.uid, it.description) } } private fun checkSuppressInterruptions(entry: NotificationEntry) = Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionSuppressor.kt +11 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.interruption import com.android.internal.logging.UiEventLogger.UiEventEnum import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.interruption.VisualInterruptionSuppressor.EventLogData /** * A reason why visual interruptions might be suppressed. Loading @@ -43,6 +44,9 @@ enum class VisualInterruptionType { * @see VisualInterruptionFilter */ sealed interface VisualInterruptionSuppressor { /** Data to be logged in the EventLog when an interruption is suppressed. */ data class EventLogData(val number: String, val description: String) /** The type(s) of interruption that this suppresses. */ val types: Set<VisualInterruptionType> Loading @@ -52,6 +56,9 @@ sealed interface VisualInterruptionSuppressor { /** An optional UiEvent ID to be recorded when this suppresses an interruption. */ val uiEventId: UiEventEnum? /** Optional data to be logged in the EventLog when this suppresses an interruption. */ val eventLogData: EventLogData? /** * Called after the suppressor is added to the [VisualInterruptionDecisionProvider] but before * any other methods are called on the suppressor. Loading @@ -63,7 +70,8 @@ sealed interface VisualInterruptionSuppressor { abstract class VisualInterruptionCondition( override val types: Set<VisualInterruptionType>, override val reason: String, override val uiEventId: UiEventEnum? = null override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : VisualInterruptionSuppressor { /** @return true if these interruptions should be suppressed right now. */ abstract fun shouldSuppress(): Boolean Loading @@ -73,7 +81,8 @@ abstract class VisualInterruptionCondition( abstract class VisualInterruptionFilter( override val types: Set<VisualInterruptionType>, override val reason: String, override val uiEventId: UiEventEnum? = null override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : VisualInterruptionSuppressor { /** * @param entry the notification to consider suppressing Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro ambientDisplayConfiguration, batteryController, deviceProvisionedController, eventLog, globalSettings, headsUpManager, keyguardNotificationVisibilityProvider, Loading @@ -42,6 +43,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro powerManager, statusBarStateController, systemClock, uiEventLogger, userTracker, ) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +6 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.StatusBarState.SHADE import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.MAX_HUN_WHEN_AGE_MS import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.HUN_SUPPRESSED_OLD_WHEN import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.BUBBLE import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PEEK import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PULSE Loading Loading @@ -141,7 +142,11 @@ class PeekDeviceNotInUseSuppressor( } class PeekOldWhenSuppressor(private val systemClock: SystemClock) : VisualInterruptionFilter(types = setOf(PEEK), reason = "has old `when`") { VisualInterruptionFilter( types = setOf(PEEK), reason = "has old `when`", uiEventId = HUN_SUPPRESSED_OLD_WHEN ) { private fun whenAge(entry: NotificationEntry) = systemClock.currentTimeMillis() - entry.sbn.notification.`when` Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/FullScreenIntentDecisionProvider.kt +27 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.interruption import android.app.NotificationManager.IMPORTANCE_HIGH import android.os.PowerManager import com.android.internal.logging.UiEventLogger.UiEventEnum import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.notification.collection.NotificationEntry Loading @@ -37,6 +38,10 @@ import com.android.systemui.statusbar.notification.interruption.FullScreenIntent import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_SUPPRESSED_ONLY_BY_DND import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_SUPPRESSIVE_BUBBLE_METADATA import com.android.systemui.statusbar.notification.interruption.FullScreenIntentDecisionProvider.DecisionImpl.NO_FSI_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_NO_HUN_OR_KEYGUARD import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_SUPPRESSIVE_BUBBLE_METADATA import com.android.systemui.statusbar.notification.interruption.NotificationInterruptStateProviderImpl.NotificationInterruptEvent.FSI_SUPPRESSED_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR import com.android.systemui.statusbar.notification.interruption.VisualInterruptionSuppressor.EventLogData import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.KeyguardStateController Loading @@ -52,6 +57,8 @@ class FullScreenIntentDecisionProvider( val logReason: String val shouldLog: Boolean val isWarning: Boolean val uiEventId: UiEventEnum? val eventLogData: EventLogData? } private enum class DecisionImpl( Loading @@ -60,7 +67,9 @@ class FullScreenIntentDecisionProvider( override val wouldFsiWithoutDnd: Boolean = shouldFsi, val supersedesDnd: Boolean = false, override val shouldLog: Boolean = true, override val isWarning: Boolean = false override val isWarning: Boolean = false, override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : Decision { NO_FSI_NO_FULL_SCREEN_INTENT( false, Loading @@ -73,9 +82,17 @@ class FullScreenIntentDecisionProvider( NO_FSI_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR( false, "suppressive group alert behavior", isWarning = true isWarning = true, uiEventId = FSI_SUPPRESSED_SUPPRESSIVE_GROUP_ALERT_BEHAVIOR, eventLogData = EventLogData("231322873", "groupAlertBehavior") ), NO_FSI_SUPPRESSIVE_BUBBLE_METADATA( false, "suppressive bubble metadata", isWarning = true, uiEventId = FSI_SUPPRESSED_SUPPRESSIVE_BUBBLE_METADATA, eventLogData = EventLogData("274759612", "bubbleMetadata") ), NO_FSI_SUPPRESSIVE_BUBBLE_METADATA(false, "suppressive bubble metadata", isWarning = true), NO_FSI_PACKAGE_SUSPENDED(false, "package suspended"), FSI_DEVICE_NOT_INTERACTIVE(true, "device is not interactive"), FSI_DEVICE_DREAMING(true, "device is dreaming"), Loading @@ -84,7 +101,13 @@ class FullScreenIntentDecisionProvider( FSI_KEYGUARD_OCCLUDED(true, "keyguard is occluded"), FSI_LOCKED_SHADE(true, "locked shade"), FSI_DEVICE_NOT_PROVISIONED(true, "device not provisioned"), NO_FSI_NO_HUN_OR_KEYGUARD(false, "no HUN or keyguard", isWarning = true), NO_FSI_NO_HUN_OR_KEYGUARD( false, "no HUN or keyguard", isWarning = true, uiEventId = FSI_SUPPRESSED_NO_HUN_OR_KEYGUARD, eventLogData = EventLogData("231322873", "no hun or keyguard") ), NO_FSI_SUPPRESSED_BY_DND(false, "suppressed by DND", wouldFsiWithoutDnd = false), NO_FSI_SUPPRESSED_ONLY_BY_DND(false, "suppressed only by DND", wouldFsiWithoutDnd = true) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImpl.kt +38 −5 Original line number Diff line number Diff line Loading @@ -20,12 +20,15 @@ import android.os.Handler import android.os.PowerManager import android.util.Log import com.android.internal.annotations.VisibleForTesting import com.android.internal.logging.UiEventLogger import com.android.internal.logging.UiEventLogger.UiEventEnum import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.settings.UserTracker import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.interruption.VisualInterruptionDecisionProvider.Decision import com.android.systemui.statusbar.notification.interruption.VisualInterruptionDecisionProvider.FullScreenIntentDecision import com.android.systemui.statusbar.notification.interruption.VisualInterruptionSuppressor.EventLogData import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.BUBBLE import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PEEK import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType.PULSE Loading @@ -33,6 +36,7 @@ import com.android.systemui.statusbar.policy.BatteryController import com.android.systemui.statusbar.policy.DeviceProvisionedController import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.EventLog import com.android.systemui.util.settings.GlobalSettings import com.android.systemui.util.time.SystemClock import javax.inject.Inject Loading @@ -43,6 +47,7 @@ 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, Loading @@ -52,14 +57,25 @@ constructor( private val powerManager: PowerManager, private val statusBarStateController: StatusBarStateController, private val systemClock: SystemClock, private val uiEventLogger: UiEventLogger, private val userTracker: UserTracker, ) : VisualInterruptionDecisionProvider { interface Loggable { val uiEventId: UiEventEnum? val eventLogData: EventLogData? } private class DecisionImpl( override val shouldInterrupt: Boolean, override val logReason: String ) : Decision private data class LoggableDecision private constructor(val decision: DecisionImpl) { private data class LoggableDecision private constructor( val decision: DecisionImpl, override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : Loggable { companion object { val unsuppressed = LoggableDecision(DecisionImpl(shouldInterrupt = true, logReason = "not suppressed")) Loading @@ -74,7 +90,9 @@ constructor( fun suppressed(suppressor: VisualInterruptionSuppressor) = LoggableDecision( DecisionImpl(shouldInterrupt = false, logReason = suppressor.reason) DecisionImpl(shouldInterrupt = false, logReason = suppressor.reason), uiEventId = suppressor.uiEventId, eventLogData = suppressor.eventLogData ) } } Loading @@ -82,7 +100,7 @@ constructor( private class FullScreenIntentDecisionImpl( val entry: NotificationEntry, private val fsiDecision: FullScreenIntentDecisionProvider.Decision ) : FullScreenIntentDecision { ) : FullScreenIntentDecision, Loggable { var hasBeenLogged = false override val shouldInterrupt Loading @@ -99,6 +117,12 @@ constructor( val isWarning get() = fsiDecision.isWarning override val uiEventId get() = fsiDecision.uiEventId override val eventLogData get() = fsiDecision.eventLogData } private val fullScreenIntentDecisionProvider = Loading Loading @@ -214,9 +238,10 @@ constructor( private fun logDecision( type: VisualInterruptionType, entry: NotificationEntry, loggable: LoggableDecision loggableDecision: LoggableDecision ) { logger.logDecision(type.name, entry, loggable.decision) logger.logDecision(type.name, entry, loggableDecision.decision) logEvents(entry, loggableDecision) } override fun makeUnloggedFullScreenIntentDecision( Loading Loading @@ -250,6 +275,14 @@ constructor( } logger.logFullScreenIntentDecision(decision.entry, decision, decision.isWarning) logEvents(decision.entry, decision) } private fun logEvents(entry: NotificationEntry, loggable: Loggable) { loggable.uiEventId?.let { uiEventLogger.log(it, entry.sbn.uid, entry.sbn.packageName) } loggable.eventLogData?.let { eventLog.writeEvent(0x534e4554, it.number, entry.sbn.uid, it.description) } } private fun checkSuppressInterruptions(entry: NotificationEntry) = Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionSuppressor.kt +11 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification.interruption import com.android.internal.logging.UiEventLogger.UiEventEnum import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.interruption.VisualInterruptionSuppressor.EventLogData /** * A reason why visual interruptions might be suppressed. Loading @@ -43,6 +44,9 @@ enum class VisualInterruptionType { * @see VisualInterruptionFilter */ sealed interface VisualInterruptionSuppressor { /** Data to be logged in the EventLog when an interruption is suppressed. */ data class EventLogData(val number: String, val description: String) /** The type(s) of interruption that this suppresses. */ val types: Set<VisualInterruptionType> Loading @@ -52,6 +56,9 @@ sealed interface VisualInterruptionSuppressor { /** An optional UiEvent ID to be recorded when this suppresses an interruption. */ val uiEventId: UiEventEnum? /** Optional data to be logged in the EventLog when this suppresses an interruption. */ val eventLogData: EventLogData? /** * Called after the suppressor is added to the [VisualInterruptionDecisionProvider] but before * any other methods are called on the suppressor. Loading @@ -63,7 +70,8 @@ sealed interface VisualInterruptionSuppressor { abstract class VisualInterruptionCondition( override val types: Set<VisualInterruptionType>, override val reason: String, override val uiEventId: UiEventEnum? = null override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : VisualInterruptionSuppressor { /** @return true if these interruptions should be suppressed right now. */ abstract fun shouldSuppress(): Boolean Loading @@ -73,7 +81,8 @@ abstract class VisualInterruptionCondition( abstract class VisualInterruptionFilter( override val types: Set<VisualInterruptionType>, override val reason: String, override val uiEventId: UiEventEnum? = null override val uiEventId: UiEventEnum? = null, override val eventLogData: EventLogData? = null ) : VisualInterruptionSuppressor { /** * @param entry the notification to consider suppressing Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/interruption/VisualInterruptionDecisionProviderImplTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro ambientDisplayConfiguration, batteryController, deviceProvisionedController, eventLog, globalSettings, headsUpManager, keyguardNotificationVisibilityProvider, Loading @@ -42,6 +43,7 @@ class VisualInterruptionDecisionProviderImplTest : VisualInterruptionDecisionPro powerManager, statusBarStateController, systemClock, uiEventLogger, userTracker, ) } Loading