[flexiglass] NotificationsPlaceholderViewModel is dumpable again
Fix: 359244921
Test: build only
Flag: com.android.systemui.scene_container
Change-Id: Ib09309a8caab5cba505465cc3840afec3978cf9e
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt
index 53fab62..2fbb23e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModel.kt
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.notification.stack.ui.viewmodel
+import com.android.systemui.dump.DumpManager
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
import com.android.systemui.lifecycle.SysUiViewModel
@@ -25,6 +26,8 @@
import com.android.systemui.statusbar.notification.stack.domain.interactor.NotificationStackAppearanceInteractor
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimRounding
+import com.android.systemui.util.kotlin.ActivatableFlowDumper
+import com.android.systemui.util.kotlin.ActivatableFlowDumperImpl
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import kotlinx.coroutines.flow.Flow
@@ -40,7 +43,13 @@
shadeInteractor: ShadeInteractor,
private val headsUpNotificationInteractor: HeadsUpNotificationInteractor,
featureFlags: FeatureFlagsClassic,
-) : SysUiViewModel() {
+ dumpManager: DumpManager,
+) :
+ SysUiViewModel(),
+ ActivatableFlowDumper by ActivatableFlowDumperImpl(
+ dumpManager = dumpManager,
+ tag = "NotificationsPlaceholderViewModel",
+ ) {
/** DEBUG: whether the placeholder should be made slightly visible for positional debugging. */
val isVisualDebuggingEnabled: Boolean = featureFlags.isEnabled(Flags.NSSL_DEBUG_LINES)
@@ -48,6 +57,10 @@
/** DEBUG: whether the debug logging should be output. */
val isDebugLoggingEnabled: Boolean = SceneContainerFlag.isEnabled
+ override suspend fun onActivated(): Nothing {
+ activateFlowDumper()
+ }
+
/** Notifies that the bounds of the notification scrim have changed. */
fun onScrimBoundsChanged(bounds: ShadeScrimBounds?) {
interactor.setShadeScrimBounds(bounds)
@@ -68,37 +81,35 @@
headsUpNotificationInteractor.isHeadsUpOrAnimatingAway
/** Corner rounding of the stack */
- // TODO(b/359244921): add .dumpWhileCollecting("shadeScrimRounding")
- val shadeScrimRounding: Flow<ShadeScrimRounding> = interactor.shadeScrimRounding
+ val shadeScrimRounding: Flow<ShadeScrimRounding> =
+ interactor.shadeScrimRounding.dumpWhileCollecting("shadeScrimRounding")
/**
* The amount [0-1] that the shade or quick settings has been opened. At 0, the shade is closed;
* at 1, either the shade or quick settings is open.
*/
- // TODO(b/359244921): add .dumpValue("expandFraction")
- val expandFraction: Flow<Float> = shadeInteractor.anyExpansion
+ val expandFraction: Flow<Float> = shadeInteractor.anyExpansion.dumpValue("expandFraction")
/**
* The amount [0-1] that quick settings has been opened. At 0, the shade may be open or closed;
* at 1, the quick settings are open.
*/
- // TODO(b/359244921): add .dumpValue("shadeToQsFraction")
- val shadeToQsFraction: Flow<Float> = shadeInteractor.qsExpansion
+ val shadeToQsFraction: Flow<Float> = shadeInteractor.qsExpansion.dumpValue("shadeToQsFraction")
/**
* The amount in px that the notification stack should scroll due to internal expansion. This
* should only happen when a notification expansion hits the bottom of the screen, so it is
* necessary to scroll up to keep expanding the notification.
*/
- // TODO(b/359244921): add .dumpWhileCollecting("syntheticScroll")
- val syntheticScroll: Flow<Float> = interactor.syntheticScroll
+ val syntheticScroll: Flow<Float> =
+ interactor.syntheticScroll.dumpWhileCollecting("syntheticScroll")
/**
* Whether the current touch gesture is overscroll. If true, it means the NSSL has already
* consumed part of the gesture.
*/
- // TODO(b/359244921): add .dumpWhileCollecting("isCurrentGestureOverScroll")
- val isCurrentGestureOverscroll: Flow<Boolean> = interactor.isCurrentGestureOverscroll
+ val isCurrentGestureOverscroll: Flow<Boolean> =
+ interactor.isCurrentGestureOverscroll.dumpWhileCollecting("isCurrentGestureOverScroll")
/** Sets whether the notification stack is scrolled to the top. */
fun setScrolledToTop(scrolledToTop: Boolean) {
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt
index 1542bb34..3247525 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationsPlaceholderViewModelKosmos.kt
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.notification.stack.ui.viewmodel
+import com.android.systemui.dump.dumpManager
import com.android.systemui.flags.featureFlagsClassic
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
@@ -29,5 +30,6 @@
shadeInteractor = shadeInteractor,
headsUpNotificationInteractor = headsUpNotificationInteractor,
featureFlags = featureFlagsClassic,
+ dumpManager = dumpManager,
)
}