summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Josh Tsuji <tsuji@google.com> 2020-07-01 01:42:37 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-07-01 01:42:37 +0000
commit20871998285b4a6fa0c37f908b7b530ea0b78ecc (patch)
tree3e6339e4c1609e875f4f7c7ea686d6e71bc04f2c
parentc10b144bc20b32bd2bb8a53709d744a87f457fcb (diff)
parentfe71adaa65737de658bcd250840a03a4ab1bd8fe (diff)
Merge "Ignore additional pointers in dispatchTouchEvent." into rvc-dev am: fe71adaa65
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12049282 Change-Id: I557a0d06c0a3a95353c107ba1b8b6dba997de5f5
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index cd27fdf9c947..749b537ea364 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -290,6 +290,12 @@ public class BubbleStackView extends FrameLayout
/** Whether we're in the middle of dragging the stack around by touch. */
private boolean mIsDraggingStack = false;
+ /**
+ * The pointer index of the ACTION_DOWN event we received prior to an ACTION_UP. We'll ignore
+ * touches from other pointer indices.
+ */
+ private int mPointerIndexDown = -1;
+
/** Description of current animation controller state. */
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println("Stack view state:");
@@ -2220,6 +2226,18 @@ public class BubbleStackView extends FrameLayout
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (ev.getAction() != MotionEvent.ACTION_DOWN && ev.getActionIndex() != mPointerIndexDown) {
+ // Ignore touches from additional pointer indices.
+ return false;
+ }
+
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ mPointerIndexDown = ev.getActionIndex();
+ } else if (ev.getAction() == MotionEvent.ACTION_UP
+ || ev.getAction() == MotionEvent.ACTION_CANCEL) {
+ mPointerIndexDown = -1;
+ }
+
boolean dispatched = super.dispatchTouchEvent(ev);
// If a new bubble arrives while the collapsed stack is being dragged, it will be positioned