Flexiglass: Fix stack vertical scroll gestures on lockscreen
Bug: 344921531
Test: manual: flexiglass on, then swipe the shade around in various ways
Flag: com.android.systemui.scene_container
Change-Id: Id8f5fda26acd56a4841682ba78a085d6f246cd06
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt
index c4506f2..ca4434d2 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationStackAppearanceIntegrationTest.kt
@@ -121,10 +121,13 @@
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 @@
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
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index b77321b..71a0b94 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -3721,7 +3721,7 @@
protected boolean isInsideQsHeader(MotionEvent ev) {
if (SceneContainerFlag.isEnabled()) {
- return ev.getY() < mScrollViewFields.getScrimClippingShape().getBounds().getTop();
+ return ev.getY() < mScrollViewFields.getStackTop();
}
mQsHeader.getBoundsOnScreen(mQsHeaderBound);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt
index cf5a562..85835d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/ui/viewmodel/NotificationScrollViewModel.kt
@@ -40,6 +40,7 @@
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 @@
/** 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 @@
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 {