Exclude back gesture on selected tiles to allow for resizing
Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Bug: 350984160
Test: manually
Change-Id: I3d4ea91cd508838afd2c394fb221e395e6035a1f
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt
index 7c62e59..e0f0b6a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/selection/Selection.kt
@@ -20,14 +20,18 @@
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.systemGestureExclusion
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.toSize
import com.android.systemui.qs.panels.ui.compose.selection.SelectionDefaults.ResizingDotSize
/**
@@ -52,14 +56,18 @@
// not receive the touch input accidentally.
val minTouchTargetSize = LocalMinimumInteractiveComponentSize.current
Box(
- Modifier.size(minTouchTargetSize).pointerInput(Unit) {
- detectHorizontalDragGestures(
- onHorizontalDrag = { _, offset -> selectionState.onResizingDrag(offset) },
- onDragStart = { tileWidths()?.let { selectionState.onResizingDragStart(it) } },
- onDragEnd = selectionState::onResizingDragEnd,
- onDragCancel = selectionState::onResizingDragEnd,
- )
- }
+ Modifier.size(minTouchTargetSize)
+ .systemGestureExclusion { Rect(Offset.Zero, it.size.toSize()) }
+ .pointerInput(Unit) {
+ detectHorizontalDragGestures(
+ onHorizontalDrag = { _, offset -> selectionState.onResizingDrag(offset) },
+ onDragStart = {
+ tileWidths()?.let { selectionState.onResizingDragStart(it) }
+ },
+ onDragEnd = selectionState::onResizingDragEnd,
+ onDragCancel = selectionState::onResizingDragEnd,
+ )
+ }
) {
ResizingDot(transition = transition, modifier = Modifier.align(Alignment.Center))
}