diff options
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" |