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

Commit ae3d2a6d authored by wilsonshih's avatar wilsonshih
Browse files

Let mWearGestureInterceptionDetector to intercept touch

Exclude from flag interceptMotionFromMoveToCancel section.

Flag: com.android.window.flags.intercept_motion_from_move_to_cancel
Test: atest OnBackInvokedCallbackGestureTest
Test: run atest SeekBarTest on wear device
Bug: 412279405
Change-Id: Ie16f6e0db5da5597250aba0e1a88329da50d51d4
parent 8fee1444
Loading
Loading
Loading
Loading
+13 −25
Original line number Diff line number Diff line
@@ -455,20 +455,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        }
        viewRootImpl.getOnBackInvokedDispatcher().onMotionEvent(ev);
        // Intercept touch if back gesture is in progress.
        boolean isBackGestureInProgress = viewRootImpl.getOnBackInvokedDispatcher()
                .isBackGestureInProgress();
        if (!isBackGestureInProgress && mWearGestureInterceptionDetector != null) {
            boolean wasIntercepting = mWearGestureInterceptionDetector.isIntercepting();
            boolean intercepting = mWearGestureInterceptionDetector.onInterceptTouchEvent(ev);
            if (wasIntercepting != intercepting) {
                viewRootImpl.updateDecorViewGestureInterception(intercepting);
            }
            if (intercepting) {
                isBackGestureInProgress = true;
            }
        }

        if (!isBackGestureInProgress) {
        if (!viewRootImpl.getOnBackInvokedDispatcher().isBackGestureInProgress()) {
            return false;
        }
        // Intercept touch if back gesture is in progress.
@@ -559,8 +546,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
            }
        }

        if (!interceptMotionFromMoveToCancel()) {
        ViewRootImpl viewRootImpl = getViewRootImpl();
        if (!interceptMotionFromMoveToCancel()) {
            if (viewRootImpl != null) {
                viewRootImpl.getOnBackInvokedDispatcher().onMotionEvent(event);
                // Intercept touch if back gesture is in progress.
@@ -568,6 +555,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                    return true;
                }
            }
        }

        if (viewRootImpl != null && mWearGestureInterceptionDetector != null) {
            boolean wasIntercepting = mWearGestureInterceptionDetector.isIntercepting();
            boolean intercepting = mWearGestureInterceptionDetector
@@ -579,7 +568,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                return true;
            }
        }
        }

        if (!SWEEP_OPEN_MENU) {
            return false;