Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt +36 −16 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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, Loading @@ -81,8 +84,9 @@ constructor( ) { hasNotifications, isShowingOnLockscreen -> hasNotifications || !isShowingOnLockscreen } .flowOn(bgDispatcher) .distinctUntilChanged() .dumpWhileCollecting("isImportantForAccessibility") .flowOn(bgDispatcher) } } Loading @@ -105,8 +109,9 @@ constructor( else -> true } } .flowOn(bgDispatcher) .distinctUntilChanged() .dumpWhileCollecting("shouldShowEmptyShadeView") .flowOn(bgDispatcher) } } Loading @@ -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) } } Loading Loading @@ -173,7 +179,6 @@ constructor( else -> VisibilityChange.APPEAR_WITH_ANIMATION } } .flowOn(bgDispatcher) .distinctUntilChanged( // Equivalent unless visibility changes areEquivalent = { a: VisibilityChange, b: VisibilityChange -> Loading @@ -199,6 +204,8 @@ constructor( AnimatableEvent(visibilityChange.visible, shouldAnimate) } .toAnimatedValueFlow() .dumpWhileCollecting("shouldIncludeFooterView") .flowOn(bgDispatcher) } } Loading @@ -213,7 +220,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { zenModeInteractor.areNotificationsHiddenInShade zenModeInteractor.areNotificationsHiddenInShade.dumpWhileCollecting( "areNotificationsHiddenInShade" ) } } Loading @@ -222,7 +231,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { seenNotificationsInteractor.hasFilteredOutSeenNotifications seenNotificationsInteractor.hasFilteredOutSeenNotifications.dumpWhileCollecting( "hasFilteredOutSeenNotifications" ) } } Loading @@ -230,7 +241,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { activeNotificationsInteractor.hasClearableAlertingNotifications activeNotificationsInteractor.hasClearableAlertingNotifications.dumpWhileCollecting( "hasClearableAlertingNotifications" ) } } Loading @@ -238,7 +251,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { activeNotificationsInteractor.hasNonClearableSilentNotifications activeNotificationsInteractor.hasNonClearableSilentNotifications.dumpWhileCollecting( "hasNonClearableSilentNotifications" ) } } Loading @@ -246,7 +261,7 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(null) } else { headsUpNotificationInteractor.topHeadsUpRow headsUpNotificationInteractor.topHeadsUpRow.dumpWhileCollecting("topHeadsUpRow") } } Loading @@ -254,23 +269,28 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(emptySet()) } else { headsUpNotificationInteractor.pinnedHeadsUpRows headsUpNotificationInteractor.pinnedHeadsUpRows.dumpWhileCollecting("pinnedHeadsUpRows") } } val headsUpAnimationsEnabled: Flow<Boolean> by lazy { if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { combine(keyguardInteractor.isKeyguardShowing, shadeInteractor.isShadeFullyExpanded) { (isKeyguardShowing, isShadeFullyExpanded) -> // TODO(b/325936094) use isShadeFullyCollapsed instead !isKeyguardShowing && !isShadeFullyExpanded } .dumpWhileCollecting("headsUpAnimationsEnabled") } } val hasPinnedHeadsUpRow: Flow<Boolean> by lazy { if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { headsUpNotificationInteractor.hasPinnedRows headsUpNotificationInteractor.hasPinnedRows.dumpWhileCollecting("hasPinnedHeadsUpRow") } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/ui/viewbinder/HeadsUpNotificationViewBinder.kt +0 −8 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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) { Loading @@ -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 Loading packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -48,5 +49,6 @@ val Kosmos.notificationListViewModel by Fixture { userSetupInteractor, zenModeInteractor, testDispatcher, dumpManager, ) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModel.kt +36 −16 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading Loading @@ -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, Loading @@ -81,8 +84,9 @@ constructor( ) { hasNotifications, isShowingOnLockscreen -> hasNotifications || !isShowingOnLockscreen } .flowOn(bgDispatcher) .distinctUntilChanged() .dumpWhileCollecting("isImportantForAccessibility") .flowOn(bgDispatcher) } } Loading @@ -105,8 +109,9 @@ constructor( else -> true } } .flowOn(bgDispatcher) .distinctUntilChanged() .dumpWhileCollecting("shouldShowEmptyShadeView") .flowOn(bgDispatcher) } } Loading @@ -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) } } Loading Loading @@ -173,7 +179,6 @@ constructor( else -> VisibilityChange.APPEAR_WITH_ANIMATION } } .flowOn(bgDispatcher) .distinctUntilChanged( // Equivalent unless visibility changes areEquivalent = { a: VisibilityChange, b: VisibilityChange -> Loading @@ -199,6 +204,8 @@ constructor( AnimatableEvent(visibilityChange.visible, shouldAnimate) } .toAnimatedValueFlow() .dumpWhileCollecting("shouldIncludeFooterView") .flowOn(bgDispatcher) } } Loading @@ -213,7 +220,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { zenModeInteractor.areNotificationsHiddenInShade zenModeInteractor.areNotificationsHiddenInShade.dumpWhileCollecting( "areNotificationsHiddenInShade" ) } } Loading @@ -222,7 +231,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { seenNotificationsInteractor.hasFilteredOutSeenNotifications seenNotificationsInteractor.hasFilteredOutSeenNotifications.dumpWhileCollecting( "hasFilteredOutSeenNotifications" ) } } Loading @@ -230,7 +241,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { activeNotificationsInteractor.hasClearableAlertingNotifications activeNotificationsInteractor.hasClearableAlertingNotifications.dumpWhileCollecting( "hasClearableAlertingNotifications" ) } } Loading @@ -238,7 +251,9 @@ constructor( if (FooterViewRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { activeNotificationsInteractor.hasNonClearableSilentNotifications activeNotificationsInteractor.hasNonClearableSilentNotifications.dumpWhileCollecting( "hasNonClearableSilentNotifications" ) } } Loading @@ -246,7 +261,7 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(null) } else { headsUpNotificationInteractor.topHeadsUpRow headsUpNotificationInteractor.topHeadsUpRow.dumpWhileCollecting("topHeadsUpRow") } } Loading @@ -254,23 +269,28 @@ constructor( if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(emptySet()) } else { headsUpNotificationInteractor.pinnedHeadsUpRows headsUpNotificationInteractor.pinnedHeadsUpRows.dumpWhileCollecting("pinnedHeadsUpRows") } } val headsUpAnimationsEnabled: Flow<Boolean> by lazy { if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { combine(keyguardInteractor.isKeyguardShowing, shadeInteractor.isShadeFullyExpanded) { (isKeyguardShowing, isShadeFullyExpanded) -> // TODO(b/325936094) use isShadeFullyCollapsed instead !isKeyguardShowing && !isShadeFullyExpanded } .dumpWhileCollecting("headsUpAnimationsEnabled") } } val hasPinnedHeadsUpRow: Flow<Boolean> by lazy { if (NotificationsHeadsUpRefactor.isUnexpectedlyInLegacyMode()) { flowOf(false) } else { headsUpNotificationInteractor.hasPinnedRows headsUpNotificationInteractor.hasPinnedRows.dumpWhileCollecting("hasPinnedHeadsUpRow") } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/ui/viewbinder/HeadsUpNotificationViewBinder.kt +0 −8 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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) { Loading @@ -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 Loading
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationListViewModelKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -48,5 +49,6 @@ val Kosmos.notificationListViewModel by Fixture { userSetupInteractor, zenModeInteractor, testDispatcher, dumpManager, ) }