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

Commit 27c41e49 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Let mWearGestureInterceptionDetector to intercept touch" into main

parents 169bd1f9 ae3d2a6d
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;