Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b938dc9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] NotificationsPlaceholderViewModel is dumpable again" into main

parents 0428999b 7b597d0e
Loading
Loading
Loading
Loading
+22 −11
Original line number Diff line number Diff line
@@ -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.domain.interactor.HeadsUpNoti
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 @@ constructor(
    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 @@ constructor(
    /** 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 @@ constructor(
        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) {
+2 −0
Original line number Diff line number Diff line
@@ -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 @@ val Kosmos.notificationsPlaceholderViewModel by Fixture {
        shadeInteractor = shadeInteractor,
        headsUpNotificationInteractor = headsUpNotificationInteractor,
        featureFlags = featureFlagsClassic,
        dumpManager = dumpManager,
    )
}