Allow ViewGroup to split MotionEvents to multiple targets during dispatch.
Use the layout xml attribute splitMotionEvents="true" or the ViewGroup
method setMotionEventSplittingEnabled(true) to enable motion event
splitting. Rules for splitting are as follows:
* Splitting is enabled per ViewGroup. When splitting is enabled any
MotionEvent dispatched to that ViewGroup can potentially be split
into several and dispatched to children independently.
* Each pointer is assigned a target child view when the ACTION_DOWN or
ACTION_POINTER_DOWN event is received. That will be the pointer's
target until it goes up, the target returns false from onTouchEvent,
or the MotionEvents are intercepted.
* Multiple pointers may be assigned to the same target. All pointer
data sent to a target are bundled into a single MotionEvent. Child
views do not need to be aware that splitting has occurred.
Change-Id: I993f838e2f6b455da9812f4742a016dfcd1c4cc9
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f31a248..c13bb8c 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -16,7 +16,6 @@
package android.view;
-import android.graphics.Camera;
import com.android.internal.R;
import com.android.internal.view.menu.MenuBuilder;
@@ -25,6 +24,7 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
+import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Interpolator;
import android.graphics.LinearGradient;
@@ -69,7 +69,6 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.ScrollBarDrawable;
-import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -5419,37 +5418,6 @@
}
/**
- * This method detects whether the given event is inside the view and, if so,
- * handles it via the dispatchEvent(MotionEvent) method.
- *
- * @param ev The event that is being dispatched.
- * @param parentX The x location of the event in the parent's coordinates.
- * @param parentY The y location of the event in the parent's coordinates.
- * @return true if the event was inside this view, false otherwise.
- */
- boolean dispatchTouchEvent(MotionEvent ev, float parentX, float parentY) {
- float localX = parentX - mLeft;
- float localY = parentY - mTop;
- if (!hasIdentityMatrix() && mAttachInfo != null) {
- // non-identity matrix: transform the point into the view's coordinates
- final float[] localXY = mAttachInfo.mTmpTransformLocation;
- localXY[0] = localX;
- localXY[1] = localY;
- getInverseMatrix().mapPoints(localXY);
- localX = localXY[0];
- localY = localXY[1];
- }
- if (localX >= 0 && localY >= 0 && localX < (mRight - mLeft) && localY < (mBottom - mTop)) {
- // It would be safer to clone the event here but we don't for performance.
- // There are many subtle interactions in touch event dispatch; change at your own risk.
- mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;
- ev.setLocation(localX, localY);
- return dispatchTouchEvent(ev);
- }
- return false;
- }
-
- /**
* Utility method to determine whether the given point, in local coordinates,
* is inside the view, where the area of the view is expanded by the slop factor.
* This method is called while processing touch-move events to determine if the event