summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lyn Han <lynhan@google.com> 2025-02-04 16:42:44 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-04 16:42:44 -0800
commit73a3e6edcc5a1afe80c599e122e43f49bc810a4f (patch)
treef32a8fa01ceab395635399a4356a5302568cb7bf
parent5c397719cfac94cc735566f25a9f914b232a468a (diff)
parent979f5db7ef3d98c9f43c8b09e5f7c6408b925db5 (diff)
Merge "Log and forget dropped HUNs instead of storing them" into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/AvalancheControllerTest.kt26
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/AvalancheController.kt28
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerLogger.kt4
3 files changed, 12 insertions, 46 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/AvalancheControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/AvalancheControllerTest.kt
index 31a2bd0371aa..dc27859df421 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/AvalancheControllerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/AvalancheControllerTest.kt
@@ -234,32 +234,6 @@ class AvalancheControllerTest : SysuiTestCase() {
}
@Test
- fun testDelete_wasDropped_removedFromDropSet() {
- // Entry was dropped
- val headsUpEntry = createHeadsUpEntry(id = 0)
- mAvalancheController.debugDropSet.add(headsUpEntry)
-
- // Delete
- mAvalancheController.delete(headsUpEntry, runnableMock!!, "testLabel")
-
- // Entry was removed from dropSet
- assertThat(mAvalancheController.debugDropSet.contains(headsUpEntry)).isFalse()
- }
-
- @Test
- fun testDelete_wasDropped_runnableNotRun() {
- // Entry was dropped
- val headsUpEntry = createHeadsUpEntry(id = 0)
- mAvalancheController.debugDropSet.add(headsUpEntry)
-
- // Delete
- mAvalancheController.delete(headsUpEntry, runnableMock!!, "testLabel")
-
- // Runnable was not run
- Mockito.verify(runnableMock, Mockito.times(0)).run()
- }
-
- @Test
fun testDelete_isShowing_runnableRun() {
// Entry is showing
val headsUpEntry = createHeadsUpEntry(id = 0)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/AvalancheController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/AvalancheController.kt
index 1092633c24e4..ccc2dffcfd7b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/AvalancheController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/AvalancheController.kt
@@ -88,10 +88,6 @@ constructor(
// Map of Runnable to label for debugging only
private val debugRunnableLabelMap: MutableMap<Runnable, String> = HashMap()
- // HeadsUpEntry we did not show at all because they are not the top priority hun in their batch
- // For debugging only
- @VisibleForTesting var debugDropSet: MutableSet<HeadsUpEntry> = HashSet()
-
enum class ThrottleEvent(private val id: Int) : UiEventLogger.UiEventEnum {
@UiEvent(doc = "HUN was shown.") AVALANCHE_THROTTLING_HUN_SHOWN(1821),
@UiEvent(doc = "HUN was dropped to show higher priority HUNs.")
@@ -235,9 +231,6 @@ constructor(
if (entry in nextList) nextList.remove(entry)
uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_REMOVED)
outcome = "remove from next. ${getStateStr()}"
- } else if (entry in debugDropSet) {
- debugDropSet.remove(entry)
- outcome = "remove from dropset. ${getStateStr()}"
} else if (isShowing(entry)) {
previousHunKey = getKey(headsUpEntryShowing)
// Show the next HUN before removing this one, so that we don't tell listeners
@@ -249,7 +242,8 @@ constructor(
outcome = "remove showing. ${getStateStr()}"
} else {
runnable.run()
- outcome = "run runnable for untracked shown HUN. ${getStateStr()}"
+ outcome = "run runnable for untracked HUN " +
+ "(was dropped or shown when AC was disabled). ${getStateStr()}"
}
headsUpManagerLogger.logAvalancheDelete(caller, isEnabled(), getKey(entry), outcome)
}
@@ -401,9 +395,13 @@ constructor(
debugRunnableLabelMap.remove(r)
}
}
- debugDropSet.addAll(listToDrop)
+ val queue = ArrayList<String>()
+ for (entry in listToDrop) {
+ queue.add("[${getKey(entry)}]")
+ }
+ val dropList = java.lang.String.join("\n", queue)
+ headsUpManagerLogger.logDroppedHuns(dropList)
}
-
clearNext()
showNow(headsUpEntryShowing!!, headsUpEntryShowingRunnableList)
}
@@ -438,20 +436,10 @@ constructor(
"\n\tprevious: [$previousHunKey]" +
"\n\tnext list: $nextListStr" +
"\n\tnext map: $nextMapStr" +
- "\n\tdropped: $dropSetStr" +
"\nBHUM.mHeadsUpEntryMap: " +
baseEntryMapStr()
}
- private val dropSetStr: String
- get() {
- val queue = ArrayList<String>()
- for (entry in debugDropSet) {
- queue.add("[${getKey(entry)}]")
- }
- return java.lang.String.join("\n", queue)
- }
-
private val nextListStr: String
get() {
val queue = ArrayList<String>()
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerLogger.kt
index e3ca7c81582f..65fb9ca558d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerLogger.kt
@@ -323,6 +323,10 @@ constructor(@NotificationHeadsUpLog private val buffer: LogBuffer) {
fun logRemoveEntryAfterExpand(entry: NotificationEntry) {
buffer.log(TAG, VERBOSE, { str1 = entry.logKey }, { "remove entry after expand: $str1" })
}
+
+ fun logDroppedHuns(entryList: String) {
+ buffer.log(TAG, VERBOSE, { str1 = entryList }, { "[AC] Drop HUNs: $str1" })
+ }
}
private const val TAG = "HeadsUpManager"