Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -627,7 +627,7 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { hum.onEntryAdded(entryToPin); assertEquals(2, mUiEventLoggerFake.numLogs()); assertEquals(AvalancheController.ThrottleEvent.SHOWN.getId(), assertEquals(AvalancheController.ThrottleEvent.AVALANCHE_THROTTLING_HUN_SHOWN.getId(), mUiEventLoggerFake.eventId(0)); assertEquals(BaseHeadsUpManager.NotificationPeekEvent.NOTIFICATION_PEEK.getId(), mUiEventLoggerFake.eventId(1)); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt +23 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ 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.statusbar.notification.interruption.AvalancheSuppressor.AvalancheEvent import javax.inject.Inject // Class to track avalanche trigger event time. Loading @@ -39,25 +40,29 @@ constructor( val timeoutMs = 120000 var startTime: Long = 0L private val avalancheTriggerIntents = mutableSetOf( private val avalancheTriggerIntents = mutableSetOf( Intent.ACTION_AIRPLANE_MODE_CHANGED, Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MANAGED_PROFILE_AVAILABLE, Intent.ACTION_USER_SWITCHED ) private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (intent.action in avalancheTriggerIntents) { // Ignore when airplane mode turned on if (intent.action == Intent.ACTION_AIRPLANE_MODE_CHANGED && intent.getBooleanExtra(/* name= */ "state", /* defaultValue */ false)) { if ( intent.action == Intent.ACTION_AIRPLANE_MODE_CHANGED && intent.getBooleanExtra(/* name= */ "state", /* defaultValue */ false) ) { Log.d(TAG, "broadcastReceiver: ignore airplane mode on") return } Log.d(TAG, "broadcastReceiver received intent.action=" + intent.action) uiEventLogger.log(AvalancheSuppressor.AvalancheEvent.START); uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_RECEIVED_TRIGGERING_EVENT) startTime = System.currentTimeMillis() } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +26 −32 Original line number Diff line number Diff line Loading @@ -270,32 +270,26 @@ class AvalancheSuppressor( } 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 = "An avalanche event occurred, and a suppression period will start now.") AVALANCHE_SUPPRESSOR_RECEIVED_TRIGGERING_EVENT(1824), @UiEvent(doc = "HUN was suppressed in avalanche.") AVALANCHE_SUPPRESSOR_HUN_SUPPRESSED(1825), @UiEvent(doc = "HUN allowed during avalanche because conversation newer than the trigger.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_NEW_CONVERSATION(1826), @UiEvent(doc = "HUN allowed during avalanche because it is a priority conversation.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_PRIORITY_CONVERSATION(1827), @UiEvent(doc = "HUN allowed during avalanche because it is a CallStyle notification.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CALL_STYLE(1828), @UiEvent(doc = "HUN allowed during avalanche because it is a reminder notification.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_REMINDER(1829), @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), AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_EVENT(1830), @UiEvent(doc = "HUN allowed during avalanche because it has FSI.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_FSI_WITH_PERMISSION(1831), @UiEvent(doc = "HUN allowed during avalanche because it is colorized.") ALLOW_COLORIZED(1810), AVALANCHE_SUPPRESSOR_HUN_ALLOWED_COLORIZED(1832), @UiEvent(doc = "HUN allowed during avalanche because it is an emergency notification.") ALLOW_EMERGENCY(1811); AVALANCHE_SUPPRESSOR_HUN_ALLOWED_EMERGENCY(1833); override fun getId(): Int { return id Loading Loading @@ -323,46 +317,46 @@ class AvalancheSuppressor( entry.ranking.isConversation && entry.sbn.notification.getWhen() > avalancheProvider.startTime ) { uiEventLogger.log(AvalancheEvent.ALLOW_CONVERSATION_AFTER_AVALANCHE) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_NEW_CONVERSATION) return State.ALLOW_CONVERSATION_AFTER_AVALANCHE } if (entry.channel?.isImportantConversation == true) { uiEventLogger.log(AvalancheEvent.ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_PRIORITY_CONVERSATION) return State.ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME } if (entry.sbn.notification.isStyle(Notification.CallStyle::class.java)) { uiEventLogger.log(AvalancheEvent.ALLOW_CALLSTYLE) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CALL_STYLE) return State.ALLOW_CALLSTYLE } if (entry.sbn.notification.category == CATEGORY_REMINDER) { uiEventLogger.log(AvalancheEvent.ALLOW_CATEGORY_REMINDER) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_REMINDER) return State.ALLOW_CATEGORY_REMINDER } if (entry.sbn.notification.category == CATEGORY_EVENT) { uiEventLogger.log(AvalancheEvent.ALLOW_CATEGORY_EVENT) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_EVENT) return State.ALLOW_CATEGORY_EVENT } if (entry.sbn.notification.fullScreenIntent != null) { uiEventLogger.log(AvalancheEvent.ALLOW_FSI_WITH_PERMISSION_ON) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_FSI_WITH_PERMISSION) return State.ALLOW_FSI_WITH_PERMISSION_ON } if (entry.sbn.notification.isColorized) { uiEventLogger.log(AvalancheEvent.ALLOW_COLORIZED) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_COLORIZED) return State.ALLOW_COLORIZED } if ( packageManager.checkPermission(RECEIVE_EMERGENCY_BROADCAST, entry.sbn.packageName) == PERMISSION_GRANTED ) { uiEventLogger.log(AvalancheEvent.ALLOW_EMERGENCY) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_EMERGENCY) return State.ALLOW_EMERGENCY } uiEventLogger.log(AvalancheEvent.SUPPRESS) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_SUPPRESSED) return State.SUPPRESS } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/AvalancheController.kt +13 −18 Original line number Diff line number Diff line Loading @@ -35,10 +35,7 @@ import javax.inject.Inject @SysUISingleton class AvalancheController @Inject constructor( dumpManager: DumpManager, private val uiEventLogger: UiEventLogger ) : Dumpable { constructor(dumpManager: DumpManager, private val uiEventLogger: UiEventLogger) : Dumpable { private val tag = "AvalancheController" private val debug = Compile.IS_DEBUG && Log.isLoggable(tag, Log.DEBUG) Loading Loading @@ -69,14 +66,11 @@ constructor( @VisibleForTesting var debugDropSet: MutableSet<HeadsUpEntry> = HashSet() enum class ThrottleEvent(private val id: Int) : UiEventLogger.UiEventEnum { @UiEvent(doc = "HUN was shown.") SHOWN(1812), @UiEvent(doc = "HUN was shown.") AVALANCHE_THROTTLING_HUN_SHOWN(1821), @UiEvent(doc = "HUN was dropped to show higher priority HUNs.") DROPPED(1813), AVALANCHE_THROTTLING_HUN_DROPPED(1822), @UiEvent(doc = "HUN was removed while waiting to show.") REMOVED(1814); AVALANCHE_THROTTLING_HUN_REMOVED(1823); override fun getId(): Int { return id Loading Loading @@ -131,7 +125,8 @@ constructor( headsUpEntryShowing!!.updateEntry( /* updatePostTime= */ false, /* updateEarliestRemovalTime= */ false, /* reason= */ "avalanche duration update") /* reason= */ "avalanche duration update" ) } } logState("after $fn") Loading Loading @@ -163,7 +158,7 @@ constructor( log { "$fn => remove from next" } if (entry in nextMap) nextMap.remove(entry) if (entry in nextList) nextList.remove(entry) uiEventLogger.log(ThrottleEvent.REMOVED) uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_REMOVED) } else if (entry in debugDropSet) { log { "$fn => remove from dropset" } debugDropSet.remove(entry) Loading Loading @@ -287,7 +282,7 @@ constructor( private fun showNow(entry: HeadsUpEntry, runnableList: MutableList<Runnable>) { log { "SHOW: " + getKey(entry) } uiEventLogger.log(ThrottleEvent.SHOWN) uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_SHOWN) headsUpEntryShowing = entry runnableList.forEach { Loading Loading @@ -318,7 +313,7 @@ constructor( // Log dropped HUNs for (e in listToDrop) { uiEventLogger.log(ThrottleEvent.DROPPED) uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_DROPPED) } if (debug) { Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/policy/BaseHeadsUpManagerTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -627,7 +627,7 @@ public class BaseHeadsUpManagerTest extends SysuiTestCase { hum.onEntryAdded(entryToPin); assertEquals(2, mUiEventLoggerFake.numLogs()); assertEquals(AvalancheController.ThrottleEvent.SHOWN.getId(), assertEquals(AvalancheController.ThrottleEvent.AVALANCHE_THROTTLING_HUN_SHOWN.getId(), mUiEventLoggerFake.eventId(0)); assertEquals(BaseHeadsUpManager.NotificationPeekEvent.NOTIFICATION_PEEK.getId(), mUiEventLoggerFake.eventId(1)); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/AvalancheProvider.kt +23 −18 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ 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.statusbar.notification.interruption.AvalancheSuppressor.AvalancheEvent import javax.inject.Inject // Class to track avalanche trigger event time. Loading @@ -39,25 +40,29 @@ constructor( val timeoutMs = 120000 var startTime: Long = 0L private val avalancheTriggerIntents = mutableSetOf( private val avalancheTriggerIntents = mutableSetOf( Intent.ACTION_AIRPLANE_MODE_CHANGED, Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MANAGED_PROFILE_AVAILABLE, Intent.ACTION_USER_SWITCHED ) private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { private val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (intent.action in avalancheTriggerIntents) { // Ignore when airplane mode turned on if (intent.action == Intent.ACTION_AIRPLANE_MODE_CHANGED && intent.getBooleanExtra(/* name= */ "state", /* defaultValue */ false)) { if ( intent.action == Intent.ACTION_AIRPLANE_MODE_CHANGED && intent.getBooleanExtra(/* name= */ "state", /* defaultValue */ false) ) { Log.d(TAG, "broadcastReceiver: ignore airplane mode on") return } Log.d(TAG, "broadcastReceiver received intent.action=" + intent.action) uiEventLogger.log(AvalancheSuppressor.AvalancheEvent.START); uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_RECEIVED_TRIGGERING_EVENT) startTime = System.currentTimeMillis() } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/interruption/CommonVisualInterruptionSuppressors.kt +26 −32 Original line number Diff line number Diff line Loading @@ -270,32 +270,26 @@ class AvalancheSuppressor( } 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 = "An avalanche event occurred, and a suppression period will start now.") AVALANCHE_SUPPRESSOR_RECEIVED_TRIGGERING_EVENT(1824), @UiEvent(doc = "HUN was suppressed in avalanche.") AVALANCHE_SUPPRESSOR_HUN_SUPPRESSED(1825), @UiEvent(doc = "HUN allowed during avalanche because conversation newer than the trigger.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_NEW_CONVERSATION(1826), @UiEvent(doc = "HUN allowed during avalanche because it is a priority conversation.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_PRIORITY_CONVERSATION(1827), @UiEvent(doc = "HUN allowed during avalanche because it is a CallStyle notification.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CALL_STYLE(1828), @UiEvent(doc = "HUN allowed during avalanche because it is a reminder notification.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_REMINDER(1829), @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), AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_EVENT(1830), @UiEvent(doc = "HUN allowed during avalanche because it has FSI.") AVALANCHE_SUPPRESSOR_HUN_ALLOWED_FSI_WITH_PERMISSION(1831), @UiEvent(doc = "HUN allowed during avalanche because it is colorized.") ALLOW_COLORIZED(1810), AVALANCHE_SUPPRESSOR_HUN_ALLOWED_COLORIZED(1832), @UiEvent(doc = "HUN allowed during avalanche because it is an emergency notification.") ALLOW_EMERGENCY(1811); AVALANCHE_SUPPRESSOR_HUN_ALLOWED_EMERGENCY(1833); override fun getId(): Int { return id Loading Loading @@ -323,46 +317,46 @@ class AvalancheSuppressor( entry.ranking.isConversation && entry.sbn.notification.getWhen() > avalancheProvider.startTime ) { uiEventLogger.log(AvalancheEvent.ALLOW_CONVERSATION_AFTER_AVALANCHE) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_NEW_CONVERSATION) return State.ALLOW_CONVERSATION_AFTER_AVALANCHE } if (entry.channel?.isImportantConversation == true) { uiEventLogger.log(AvalancheEvent.ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_PRIORITY_CONVERSATION) return State.ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME } if (entry.sbn.notification.isStyle(Notification.CallStyle::class.java)) { uiEventLogger.log(AvalancheEvent.ALLOW_CALLSTYLE) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CALL_STYLE) return State.ALLOW_CALLSTYLE } if (entry.sbn.notification.category == CATEGORY_REMINDER) { uiEventLogger.log(AvalancheEvent.ALLOW_CATEGORY_REMINDER) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_REMINDER) return State.ALLOW_CATEGORY_REMINDER } if (entry.sbn.notification.category == CATEGORY_EVENT) { uiEventLogger.log(AvalancheEvent.ALLOW_CATEGORY_EVENT) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_CATEGORY_EVENT) return State.ALLOW_CATEGORY_EVENT } if (entry.sbn.notification.fullScreenIntent != null) { uiEventLogger.log(AvalancheEvent.ALLOW_FSI_WITH_PERMISSION_ON) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_FSI_WITH_PERMISSION) return State.ALLOW_FSI_WITH_PERMISSION_ON } if (entry.sbn.notification.isColorized) { uiEventLogger.log(AvalancheEvent.ALLOW_COLORIZED) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_COLORIZED) return State.ALLOW_COLORIZED } if ( packageManager.checkPermission(RECEIVE_EMERGENCY_BROADCAST, entry.sbn.packageName) == PERMISSION_GRANTED ) { uiEventLogger.log(AvalancheEvent.ALLOW_EMERGENCY) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_ALLOWED_EMERGENCY) return State.ALLOW_EMERGENCY } uiEventLogger.log(AvalancheEvent.SUPPRESS) uiEventLogger.log(AvalancheEvent.AVALANCHE_SUPPRESSOR_HUN_SUPPRESSED) return State.SUPPRESS } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/AvalancheController.kt +13 −18 Original line number Diff line number Diff line Loading @@ -35,10 +35,7 @@ import javax.inject.Inject @SysUISingleton class AvalancheController @Inject constructor( dumpManager: DumpManager, private val uiEventLogger: UiEventLogger ) : Dumpable { constructor(dumpManager: DumpManager, private val uiEventLogger: UiEventLogger) : Dumpable { private val tag = "AvalancheController" private val debug = Compile.IS_DEBUG && Log.isLoggable(tag, Log.DEBUG) Loading Loading @@ -69,14 +66,11 @@ constructor( @VisibleForTesting var debugDropSet: MutableSet<HeadsUpEntry> = HashSet() enum class ThrottleEvent(private val id: Int) : UiEventLogger.UiEventEnum { @UiEvent(doc = "HUN was shown.") SHOWN(1812), @UiEvent(doc = "HUN was shown.") AVALANCHE_THROTTLING_HUN_SHOWN(1821), @UiEvent(doc = "HUN was dropped to show higher priority HUNs.") DROPPED(1813), AVALANCHE_THROTTLING_HUN_DROPPED(1822), @UiEvent(doc = "HUN was removed while waiting to show.") REMOVED(1814); AVALANCHE_THROTTLING_HUN_REMOVED(1823); override fun getId(): Int { return id Loading Loading @@ -131,7 +125,8 @@ constructor( headsUpEntryShowing!!.updateEntry( /* updatePostTime= */ false, /* updateEarliestRemovalTime= */ false, /* reason= */ "avalanche duration update") /* reason= */ "avalanche duration update" ) } } logState("after $fn") Loading Loading @@ -163,7 +158,7 @@ constructor( log { "$fn => remove from next" } if (entry in nextMap) nextMap.remove(entry) if (entry in nextList) nextList.remove(entry) uiEventLogger.log(ThrottleEvent.REMOVED) uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_REMOVED) } else if (entry in debugDropSet) { log { "$fn => remove from dropset" } debugDropSet.remove(entry) Loading Loading @@ -287,7 +282,7 @@ constructor( private fun showNow(entry: HeadsUpEntry, runnableList: MutableList<Runnable>) { log { "SHOW: " + getKey(entry) } uiEventLogger.log(ThrottleEvent.SHOWN) uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_SHOWN) headsUpEntryShowing = entry runnableList.forEach { Loading Loading @@ -318,7 +313,7 @@ constructor( // Log dropped HUNs for (e in listToDrop) { uiEventLogger.log(ThrottleEvent.DROPPED) uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_DROPPED) } if (debug) { Loading