summaryrefslogtreecommitdiff
path: root/core/java/android/view/ViewGroup.java
diff options
context:
space:
mode:
authorGarfield Tan <xutan@google.com>2019-10-04 12:21:58 -0700
committerGarfield Tan <xutan@google.com>2019-10-04 15:20:16 -0700
commitf90c2775d640735e89c3da5e213cb70cfc44a82d (patch)
tree1dc9dcc1fde855e1f079e62610d1dea4a5e7f069 /core/java/android/view/ViewGroup.java
parent239720107c4de19cf4fe6ca0af3ddb19c8113e3c (diff)
Stop splitting for mouse events.
Events from multi-touch touchpads have mouse source and can have multiple pointers. This is a whole gesture and shouldn't be split into multiple views. Bug: 140312476 Test: Attached a touchpad to crosshatch (in my case I used the touch pad on DualShock 4). Moved the cursor around the edge of two scrollable views and perform 2-finger scroll. Only one of the view responds to the scroll. Note it may not be the view under the cursor that responds to it, which is another bug that needs to be fixed. Test: Multi-finger touches on touchscreen can still be split. Change-Id: I1c1250291fa8a88b33f84ca3f80c8b7ac3a61e48
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
-rw-r--r--core/java/android/view/ViewGroup.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 82a5fa979fd2..9095dbe0165a 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2615,7 +2615,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|| actionMasked == MotionEvent.ACTION_CANCEL;
// Update list of touch targets for pointer down, if needed.
- final boolean split = (mGroupFlags & FLAG_SPLIT_MOTION_EVENTS) != 0;
+ final boolean isMouseEvent = ev.getSource() == InputDevice.SOURCE_MOUSE;
+ final boolean split = (mGroupFlags & FLAG_SPLIT_MOTION_EVENTS) != 0
+ && !isMouseEvent;
TouchTarget newTouchTarget = null;
boolean alreadyDispatchedToNewTouchTarget = false;
if (!canceled && !intercepted) {