diff options
| author | 2024-12-30 19:29:24 +0000 | |
|---|---|---|
| committer | 2024-12-30 19:34:37 +0000 | |
| commit | 96167e1300563bede50d53751ebdfe7cd2a7429d (patch) | |
| tree | ed3b712cdbb9741c85bda5b1c700bb5088aa646c | |
| parent | c71e4c0e4f8d74436dfd4193db01235d6d672b4a (diff) | |
[SB][Notif] Reduce log spam by adding `distinctUntilChanged`.
Fixes: 386355190
Bug: 364653005
Flag: com.android.systemui.status_bar_notification_chips
Test: Get multiple non-promoted notifs, then `adb shell dumpsys activity
service com.android.systemui/.SystemUIService StatusBarChips` -> verify
no extra log lines
Change-Id: I5733dc7b334b807b5ab5074fde45acde6149ca6d
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt index bcd8cfaa5c5a..2f6431b05c8b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt @@ -33,6 +33,7 @@ import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.launch /** A view model for status bar chips for promoted ongoing notifications. */ @@ -50,11 +51,12 @@ constructor( */ val chips: Flow<List<OngoingActivityChipModel.Shown>> = combine( - notifChipsInteractor.notificationChips, - headsUpNotificationInteractor.statusBarHeadsUpState, - ) { notifications, headsUpState -> - notifications.map { it.toActivityChipModel(headsUpState) } - } + notifChipsInteractor.notificationChips, + headsUpNotificationInteractor.statusBarHeadsUpState, + ) { notifications, headsUpState -> + notifications.map { it.toActivityChipModel(headsUpState) } + } + .distinctUntilChanged() /** Converts the notification to the [OngoingActivityChipModel] object. */ private fun NotificationChipModel.toActivityChipModel( |