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

Commit 06e7b89b authored by Yining Liu's avatar Yining Liu
Browse files

Avoid NSS under QuickSettingsScene to have NestedScrolling

This change explicitly declares the QuickSettingsScene to not init
scrimNestedScrollConnection to avoid two nested scrolling:
the NSS for single shade and the NSS for QuickSettingsScene to conflict.

Fix: 433941739
Fix: 439802567
Test: manual, single shade, go from Shade -> QS, then QS -> gone, then
expand Shade and start collapsing gesture from a notification
Flag: com.android.systemui.scene_container

Change-Id: Icce717f0484a839ffb4dc4f1204b3be48293224e
parent 8091259f
Loading
Loading
Loading
Loading
+33 −20
Original line number Diff line number Diff line
@@ -499,12 +499,20 @@ fun ContentScope.NotificationScrollingStack(
    }

    val scrimNestedScrollConnection =
        shadeSession.rememberSession(key = "ScrimConnection", scrimOffset, minScrimTop, density) {
        if (supportNestedScrolling) {
            shadeSession.rememberSession(
                key = "ScrimConnection",
                scrimOffset,
                minScrimTop,
                density,
            ) {
                val flingSpec: DecayAnimationSpec<Float> = splineBasedDecay(density)
                val flingBehavior = NotificationScrimFlingBehavior(flingSpec)
                NotificationScrimNestedScrollConnection(
                    scrimOffset = { scrimOffset.value },
                snapScrimOffset = { value -> coroutineScope.launch { scrimOffset.snapTo(value) } },
                    snapScrimOffset = { value ->
                        coroutineScope.launch { scrimOffset.snapTo(value) }
                    },
                    animateScrimOffset = { value ->
                        coroutineScope.launch { scrimOffset.animateTo(value) }
                    },
@@ -515,6 +523,9 @@ fun ContentScope.NotificationScrollingStack(
                    flingBehavior = flingBehavior,
                )
            }
        } else {
            null
        }

    val swipeToExpandNotificationScrollConnection =
        shadeSession.rememberSession(
@@ -683,8 +694,8 @@ fun ContentScope.NotificationScrollingStack(
                modifier =
                    Modifier.disableSwipesWhenScrolling()
                        .nestedScroll(swipeToExpandNotificationScrollConnection)
                        .thenIf(supportNestedScrolling) {
                            Modifier.nestedScroll(scrimNestedScrollConnection)
                        .thenIf(supportNestedScrolling && scrimNestedScrollConnection != null) {
                            Modifier.nestedScroll(scrimNestedScrollConnection!!)
                        }
                        .verticalScroll(scrollState, overscrollEffect = overScrollEffect)
                        .fillMaxWidth()
@@ -836,13 +847,15 @@ private suspend fun scrollNotificationStack(
private fun TransitionState.isOnLockscreen(): Boolean {
    return currentScene == Scenes.Lockscreen && currentOverlays.isEmpty()
}

private fun shouldUseLockscreenStackBounds(state: TransitionState): Boolean {
    return when (state) {
        is TransitionState.Idle -> state.isOnLockscreen()
        is TransitionState.Transition ->
            // Keep using the lockscreen stack bounds when there is no placeholder on the next content
            state.fromContent == Scenes.Lockscreen && state.toContent != Scenes.Shade
                || state.isTransitioningBetween(content = Scenes.Lockscreen, other = Overlays.Bouncer)
            // Keep using the lockscreen stack bounds when there is no placeholder on the next
            // content
            state.fromContent == Scenes.Lockscreen && state.toContent != Scenes.Shade ||
                state.isTransitioningBetween(content = Scenes.Lockscreen, other = Overlays.Bouncer)
    }
}

+2 −1
Original line number Diff line number Diff line
@@ -387,6 +387,7 @@ private fun ContentScope.QuickSettingsContent(
                    .padding(horizontal = shadeHorizontalPadding),
        )

        // TODO(b/436646848): remove NotificationScrollingStack from QuickSettings
        // The minimum possible value for the top of the notification stack. In other words: how
        // high is the notification stack allowed to get when the scene is at rest. It may still be
        // translated farther upwards by a transition animation but, at rest, the top edge of its
@@ -406,7 +407,7 @@ private fun ContentScope.QuickSettingsContent(
            stackTopPadding = notificationStackPadding,
            stackBottomPadding = navBarBottomHeight,
            shouldIncludeHeadsUpSpace = false,
            supportNestedScrolling = true,
            supportNestedScrolling = false,
            modifier =
                Modifier.fillMaxWidth()
                    // Match the screen height with the scrim, so it covers the whole screen,