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

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

Merge "Flexiglass: Fix stack vertical scroll gestures on lockscreen" into main

parents 5ebe1ec4 3f2c500b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -121,10 +121,13 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() {
            sceneInteractor.setTransitionState(transitionState)
            val expandFraction by collectLastValue(scrollViewModel.expandFraction)
            assertThat(expandFraction).isEqualTo(0f)

            fakeSceneDataSource.changeScene(toScene = Scenes.Gone)
            val isScrollable by collectLastValue(scrollViewModel.isScrollable)
            assertThat(isScrollable).isFalse()

            fakeSceneDataSource.pause()

            sceneInteractor.changeScene(Scenes.Shade, "reason")
            val transitionProgress = MutableStateFlow(0f)
            transitionState.value =
@@ -159,8 +162,10 @@ class NotificationStackAppearanceIntegrationTest : SysuiTestCase() {
            sceneInteractor.setTransitionState(transitionState)
            val expandFraction by collectLastValue(scrollViewModel.expandFraction)
            assertThat(expandFraction).isEqualTo(1f)

            fakeSceneDataSource.changeScene(toScene = Scenes.Lockscreen)
            val isScrollable by collectLastValue(scrollViewModel.isScrollable)
            assertThat(isScrollable).isFalse()
            assertThat(isScrollable).isTrue()
        }

    @Test
+1 −1
Original line number Diff line number Diff line
@@ -3721,7 +3721,7 @@ public class NotificationStackScrollLayout

    protected boolean isInsideQsHeader(MotionEvent ev) {
        if (SceneContainerFlag.isEnabled()) {
            return ev.getY() < mScrollViewFields.getScrimClippingShape().getBounds().getTop();
            return ev.getY() < mScrollViewFields.getStackTop();
        }

        mQsHeader.getBoundsOnScreen(mQsHeaderBound);
+5 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map

/** ViewModel which represents the state of the NSSL/Controller in the world of flexiglass */
@SysUISingleton
@@ -146,6 +147,7 @@ constructor(

    /** Receives the amount (px) that the stack should scroll due to internal expansion. */
    val syntheticScrollConsumer: (Float) -> Unit = stackAppearanceInteractor::setSyntheticScroll

    /**
     * Receives whether the current touch gesture is overscroll as it has already been consumed by
     * the stack.
@@ -154,10 +156,9 @@ constructor(
        stackAppearanceInteractor::setCurrentGestureOverscroll

    /** Whether the notification stack is scrollable or not. */
    val isScrollable: Flow<Boolean> =
        sceneInteractor
            .isCurrentSceneInFamily(SceneFamilies.NotifShade)
            .dumpWhileCollecting("isScrollable")
    val isScrollable: Flow<Boolean> = sceneInteractor.currentScene.map {
        sceneInteractor.isSceneInFamily(it, SceneFamilies.NotifShade) || it == Scenes.Lockscreen
    }.dumpWhileCollecting("isScrollable")

    /** Whether the notification stack is displayed in doze mode. */
    val isDozing: Flow<Boolean> by lazy {