diff options
| author | 2024-04-17 09:42:32 +0000 | |
|---|---|---|
| committer | 2024-04-17 09:42:32 +0000 | |
| commit | 0c6504624311a2da58957a5d08ed6f8bec8b0a7a (patch) | |
| tree | c415e1799c9c263bac7322bfcdc23a683f8a394b | |
| parent | 2429135eea1880184e798dfba930044a9d440cbb (diff) | |
| parent | e6d98e633a5c8b82f9af003d2cbff4b118b9ea3e (diff) | |
Merge "Dump latest flow values from NotificationListVM" into main
3 files changed, 38 insertions, 24 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt index 5ab58576a89d..70aa2453187b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.stack.ui.viewmodel import com.android.systemui.dagger.qualifiers.Background +import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.domain.interactor.RemoteInputInteractor @@ -31,6 +32,7 @@ import com.android.systemui.statusbar.notification.shelf.ui.viewmodel.Notificati import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackInteractor import com.android.systemui.statusbar.policy.domain.interactor.UserSetupInteractor import com.android.systemui.statusbar.policy.domain.interactor.ZenModeInteractor +import com.android.systemui.util.kotlin.FlowDumperImpl import com.android.systemui.util.kotlin.sample import com.android.systemui.util.ui.AnimatableEvent import com.android.systemui.util.ui.AnimatedValue @@ -64,7 +66,8 @@ constructor( userSetupInteractor: UserSetupInteractor, zenModeInteractor: ZenModeInteractor, @Background bgDispatcher: CoroutineDispatcher, -) { + dumpManager: DumpManager, +) : FlowDumperImpl(dumpManager) { /** * We want the NSSL to be unimportant for accessibility when there are no notifications in it * while the device is on lock screen, to avoid an unlabelled NSSL view in TalkBack. Otherwise, @@ -81,8 +84,9 @@ constructor( ) { hasNotifications, isShowingOnLockscreen -> hasNotifications || !isShowingOnLockscreen } - .flowOn(bgDispatcher) .distinctUntilChanged() + .dumpWhileCollecting("isImportantForAccessibility") + .flowOn(bgDispatcher) } } @@ -105,8 +109,9 @@ constructor( else -> true } } - .flowOn(bgDispatcher) .distinctUntilChanged() + .dumpWhileCollecting("shouldShowEmptyShadeView") + .flowOn(bgDispatcher) } } @@ -125,8 +130,9 @@ constructor( // the footer to be counted as part of the shade for measurements. shadeInteractor.shadeExpansion .map { it == 0f } - .flowOn(bgDispatcher) .distinctUntilChanged() + .dumpWhileCollecting("shouldHideFooterView") + .flowOn(bgDispatcher) } } @@ -173,7 +179,6 @@ constructor( else -> VisibilityChange.APPEAR_WITH_ANIMATION } } - .flowOn(bgDispatcher) .distinctUntilChanged( // Equivalent unless visibility changes areEquivalent = { a: VisibilityChange, b: VisibilityChange -> @@ -199,6 +204,8 @@ constructor( AnimatableEvent(visibilityChange.visible, shouldAnimate) } .toAnimatedValueFlow() + .dumpWhileCollecting("shouldIncludeFooterView") + .flowOn(bgDispatcher) } } @@ -213,7 +220,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { - zenModeInteractor.areNotificationsHiddenInShade + zenModeInteractor.areNotificationsHiddenInShade.dumpWhileCollecting( + "areNotificationsHiddenInShade" + ) } } @@ -222,7 +231,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { - seenNotificationsInteractor.hasFilteredOutSeenNotifications + seenNotificationsInteractor.hasFilteredOutSeenNotifications.dumpWhileCollecting( + "hasFilteredOutSeenNotifications" + ) } } @@ -230,7 +241,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { - activeNotificationsInteractor.hasClearableAlertingNotifications + activeNotificationsInteractor.hasClearableAlertingNotifications.dumpWhileCollecting( + "hasClearableAlertingNotifications" + ) } } @@ -238,7 +251,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { - activeNotificationsInteractor.hasNonClearableSilentNotifications + activeNotificationsInteractor.hasNonClearableSilentNotifications.dumpWhileCollecting( + "hasNonClearableSilentNotifications" + ) } } @@ -246,7 +261,7 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(null) } else { - headsUpNotificationInteractor.topHeadsUpRow + headsUpNotificationInteractor.topHeadsUpRow.dumpWhileCollecting("topHeadsUpRow") } } @@ -254,15 +269,20 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(emptySet()) } else { - headsUpNotificationInteractor.pinnedHeadsUpRows + headsUpNotificationInteractor.pinnedHeadsUpRows.dumpWhileCollecting("pinnedHeadsUpRows") } } val headsUpAnimationsEnabled: Flow<Boolean> by lazy { - combine(keyguardInteractor.isKeyguardShowing, shadeInteractor.isShadeFullyExpanded) { - (isKeyguardShowing, isShadeFullyExpanded) -> - // TODO(b/325936094) use isShadeFullyCollapsed instead - !isKeyguardShowing && !isShadeFullyExpanded + if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { + flowOf(false) + } else { + combine(keyguardInteractor.isKeyguardShowing, shadeInteractor.isShadeFullyExpanded) { + (isKeyguardShowing, isShadeFullyExpanded) -> + // TODO(b/325936094) use isShadeFullyCollapsed instead + !isKeyguardShowing && !isShadeFullyExpanded + } + .dumpWhileCollecting("headsUpAnimationsEnabled") } } @@ -270,7 +290,7 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { - headsUpNotificationInteractor.hasPinnedRows + headsUpNotificationInteractor.hasPinnedRows.dumpWhileCollecting("hasPinnedHeadsUpRow") } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ui/viewbinder/HeadsUpNotificationViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ui/viewbinder/HeadsUpNotificationViewBinder.kt index cb360fed77bc..b3d8430b03af 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ui/viewbinder/HeadsUpNotificationViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ui/viewbinder/HeadsUpNotificationViewBinder.kt @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.notification.ui.viewbinder -import android.util.Log import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.shared.HeadsUpRowKey import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout @@ -26,9 +25,6 @@ import javax.inject.Inject import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch -private const val TAG = "HunBinder" -private val DEBUG = true // Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG) - class HeadsUpNotificationViewBinder @Inject constructor(private val viewModel: NotificationListViewModel) { @@ -39,10 +35,6 @@ constructor(private val viewModel: NotificationListViewModel) { viewModel.pinnedHeadsUpRows .sample(viewModel.headsUpAnimationsEnabled, ::Pair) .collect { (newKeys, animationsEnabled) -> - if (DEBUG) { - Log.d(TAG, "update:$newKeys") - } - val added = newKeys - previousKeys val removed = previousKeys - newKeys previousKeys = newKeys diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelKosmos.kt index c65d0a33cf67..94f6ecd36c7c 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelKosmos.kt @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.stack.ui.viewmodel +import com.android.systemui.dump.dumpManager import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture @@ -48,5 +49,6 @@ val Kosmos.notificationListViewModel by Fixture { userSetupInteractor, zenModeInteractor, testDispatcher, + dumpManager, ) } |