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

Commit 85f562b7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow back navigation from window edge on certain motion events." into main

parents 262b3425 c02a1b90
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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
+7 −4
Original line number Diff line number Diff line
@@ -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<NavigationEdgeBack
        return mDesktopModeExcludeRegion.contains(x, y);
    }

    private boolean isWithinTouchRegion(int x, int y) {
    private boolean isWithinTouchRegion(MotionEvent ev) {
        // If the point is inside the PiP or Nav bar overlay excluded bounds, then ignore the back
        // gesture
        int x = (int) ev.getX();
        int y = (int) ev.getY();
        final boolean isInsidePip = mIsInPip && mPipExcludedBounds.contains(x, y);
        final boolean isInDesktopExcludeRegion = desktopExcludeRegionContains(x, y);
        final boolean isInDesktopExcludeRegion = desktopExcludeRegionContains(x, y)
                && isEdgeResizePermitted(ev);
        if (isInsidePip || isInDesktopExcludeRegion
                || mNavBarOverlayExcludedBounds.contains(x, y)) {
            return false;
@@ -1098,8 +1102,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
                        && isValidTrackpadBackGesture(true /* isTrackpadEvent */);
            } else {
                mAllowGesture = isBackAllowedCommon && !mUsingThreeButtonNav && isWithinInsets
                        && isWithinTouchRegion((int) ev.getX(), (int) ev.getY())
                        && !isButtonPressFromTrackpad(ev);
                        && isWithinTouchRegion(ev) && !isButtonPressFromTrackpad(ev);
            }
            if (mAllowGesture) {
                mEdgeBackPlugin.setIsLeftPanel(mIsOnLeftEdge);