From c02a1b90cf68b8acc18bb78cc28e32fba1d0a697 Mon Sep 17 00:00:00 2001 From: Vania Desmonda Date: Thu, 12 Dec 2024 13:46:44 +0000 Subject: Allow back navigation from window edge on certain motion events. If edge resize is permitted (e.g. using stylus, mouse) then exclude touch regions so that window can be resized from edge. If not, (e.g. using finger), then don't exclude touch region so users can go back from the edge of the window. Test: manual, position window near right edge, going back using finger works, and using stylus resizes the window as expected. Fixes: 362598831 Flag: com.android.window.flags.enable_windowing_edge_drag_resize Change-Id: I2ca41383f79ce37441c630a119e2e233391514e4 --- .../wm/shell/windowdecor/DragResizeWindowGeometry.java | 5 ++++- .../navigationbar/gestural/EdgeBackGestureHandler.java | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeWindowGeometry.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeWindowGeometry.java index c8aff78cbb36..5b027f3c039e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeWindowGeometry.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeWindowGeometry.java @@ -168,7 +168,10 @@ public final class DragResizeWindowGeometry { return (e.getSource() & SOURCE_TOUCHSCREEN) == SOURCE_TOUCHSCREEN; } - static boolean isEdgeResizePermitted(@NonNull MotionEvent e) { + /** + * Whether resizing a window from the edge is permitted based on the motion event. + */ + public static boolean isEdgeResizePermitted(@NonNull MotionEvent e) { if (ENABLE_WINDOWING_EDGE_DRAG_RESIZE.isTrue()) { return e.getToolType(0) == MotionEvent.TOOL_TYPE_STYLUS || e.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java index b1719107fae1..037a1b2a97f1 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java @@ -26,6 +26,7 @@ import static com.android.systemui.classifier.Classifier.BACK_GESTURE; import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadScroll; import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadThreeFingerSwipe; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_TOUCHPAD_GESTURES_DISABLED; +import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.isEdgeResizePermitted; import static java.util.stream.Collectors.joining; @@ -965,11 +966,14 @@ public class EdgeBackGestureHandler implements PluginListener