From 864d688ff36774c40a7882b972e166cdd1f729ba Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 13 Apr 2018 18:19:16 -0700 Subject: [PATCH] Do not send proxy touch events to children. Call onIntercept and ontouch direclty, so that the touch is only handled by touch handlers Bug: 77912191 Change-Id: I8b583da2394282c757348818470dbb4bee095b33 --- .../android/quickstep/TouchInteractionService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 4f0187c47f..57f46b87ac 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -39,13 +39,12 @@ import android.util.SparseArray; import android.view.Choreographer; import android.view.MotionEvent; import android.view.VelocityTracker; -import android.view.View; import android.view.ViewConfiguration; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.MainThreadExecutor; -import com.android.launcher3.R; import com.android.launcher3.util.TraceHelper; +import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; @@ -248,7 +247,7 @@ public class TouchInteractionService extends Service { private final ActivityControlHelper mActivityHelper; private final T mActivity; - private final View mTarget; + private final BaseDragLayer mTarget; private final int[] mLocationOnScreen = new int[2]; private final PointF mDownPos = new PointF(); private final int mTouchSlop; @@ -293,7 +292,6 @@ public class TouchInteractionService extends Service { case ACTION_MOVE: { float displacement = ev.getY() - mDownPos.y; if (Math.abs(displacement) >= mTouchSlop) { - mTrackingStarted = true; mTarget.getLocationOnScreen(mLocationOnScreen); // Send a down event only when mTouchSlop is crossed. @@ -301,6 +299,7 @@ public class TouchInteractionService extends Service { down.setAction(ACTION_DOWN); sendEvent(down); down.recycle(); + mTrackingStarted = true; } } } @@ -319,7 +318,10 @@ public class TouchInteractionService extends Service { int flags = ev.getEdgeFlags(); ev.setEdgeFlags(flags | EDGE_NAV_BAR); ev.offsetLocation(-mLocationOnScreen[0], -mLocationOnScreen[1]); - mTarget.dispatchTouchEvent(ev); + if (!mTrackingStarted) { + mTarget.onInterceptTouchEvent(ev); + } + mTarget.onTouchEvent(ev); ev.offsetLocation(mLocationOnScreen[0], mLocationOnScreen[1]); ev.setEdgeFlags(flags); }