Prevent double touch inputs in the BaseDragLayer
If you hold a long press and while pressing you start another
long press again with another finger, then a new onLongPress event
will trigger and in some cases we are not processing that case.
By ignoring the evetns with the flag ACTION_OUTSIDE we can prevent
such cases.
Fix: 247477725
Test: ReorderWidgets
Change-Id: I31833bc54db2771809562bd1f92c8523eb2f05ab
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 800b1f6..1e154a2 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -273,6 +273,12 @@
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (ev.getActionIndex() > 0) {
+ // This means there is multiple touch inputs, ignore it, we could also cancel the
+ // previous touch but the user might cancel the drag by accident.
+ return true;
+ }
+
switch (ev.getAction()) {
case ACTION_DOWN: {
if ((mTouchDispatchState & TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS) != 0) {