From 5f8167ce09d3c4a5d6a93c3b5fe6b7547b1340c7 Mon Sep 17 00:00:00 2001 From: AndrĂ¡s Kurucz Date: Thu, 6 Feb 2025 14:55:14 +0000 Subject: [flexiglass] Keep the snoozable HUN placeholder scrollable Previously we were only adding the scrollable modifier to the HeadsUpNotificationSpace placeholder when there was a pinned HUN displayed, or being animated away. When we are dragging down on a HUN to open the shade, we unpin it, to let it reach its final form in the shade. This unpinning removed the scrollable modifier, which broke dispatching the touch events from NestedDraggable to the DraggableHandler. This was leaving the HUN and the shade in a broken state. Keeping the snoozable placeholder scrollable allows us to keep dispatching the motion events continously, and open the shade. Fixes: 394800311 Test: atest PlatformScenarioTests:android.platform.test.scenario.sysui.notification.ExpandShadeFromHun#testExpandShadeFromHun Flag: com.android.systemui.scene_container Change-Id: I891adfad8da40e21852e125e59024c4302fda026 --- .../systemui/notifications/ui/composable/Notifications.kt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt index d7d4e1714aa6..09b8d178cc8e 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/notifications/ui/composable/Notifications.kt @@ -175,7 +175,7 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace( viewModel: NotificationsPlaceholderViewModel, ) { - val isHeadsUp by viewModel.isHeadsUpOrAnimatingAway.collectAsStateWithLifecycle(false) + val isSnoozable by viewModel.isHeadsUpOrAnimatingAway.collectAsStateWithLifecycle(false) var scrollOffset by remember { mutableFloatStateOf(0f) } val headsUpInset = with(LocalDensity.current) { headsUpTopInset().toPx() } @@ -192,7 +192,7 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace( ) } - val nestedScrollConnection = + val snoozeScrollConnection = object : NestedScrollConnection { override suspend fun onPreFling(available: Velocity): Velocity { if ( @@ -206,7 +206,7 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace( } } - LaunchedEffect(isHeadsUp) { scrollOffset = 0f } + LaunchedEffect(isSnoozable) { scrollOffset = 0f } LaunchedEffect(scrollableState.isScrollInProgress) { if (!scrollableState.isScrollInProgress && scrollOffset <= minScrollOffset) { @@ -230,10 +230,8 @@ fun ContentScope.SnoozeableHeadsUpNotificationSpace( ), ) } - .thenIf(isHeadsUp) { - Modifier.nestedScroll(nestedScrollConnection) - .scrollable(orientation = Orientation.Vertical, state = scrollableState) - }, + .thenIf(isSnoozable) { Modifier.nestedScroll(snoozeScrollConnection) } + .scrollable(orientation = Orientation.Vertical, state = scrollableState), ) } -- cgit v1.2.3-59-g8ed1b