summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Burns <pixel@google.com>2020-04-02 17:22:40 -0400
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-04-05 15:25:30 +0000
commit9fcf95e8153716eb00727aa76f286d1a357f1322 (patch)
tree645decbe9b3f8408da7df3e7caacfd5a25481c40
parent3dfbd9581d57c328549f05067989bb9e1ce52d9a (diff)
downloadbase-9fcf95e8153716eb00727aa76f286d1a357f1322.tar.gz
Don't crash if NSSL gets incomplete gesture
In *theory*, a View should always receive an ACTION_DOWN before receiving any other touch events, but this isn't always the case in practice. Whenever we see one of these "partial" gestures, we should ignore it until a real one starts. Test: manual Bug: 146323887 Merged-In: I22182d90b0057df67fbd6d20785da23d6c17dcf3 Change-Id: I22182d90b0057df67fbd6d20785da23d6c17dcf3 (cherry picked from commit c8048daed2e1b15fca1e281499d426920fc245c0) (cherry picked from commit c0e4c56696b88d3c87db25d0323cecfa40f362bd)
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 7c49c3f961c9..073e474fed19 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -3773,9 +3773,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
- final int action = ev.getAction();
+ final int action = ev.getActionMasked();
+ if (ev.findPointerIndex(mActivePointerId) == -1 && action != MotionEvent.ACTION_DOWN) {
+ // Incomplete gesture, possibly due to window swap mid-gesture. Ignore until a new
+ // one starts.
+ Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent "
+ + MotionEvent.actionToString(ev.getActionMasked()));
+ return true;
+ }
- switch (action & MotionEvent.ACTION_MASK) {
+ switch (action) {
case MotionEvent.ACTION_DOWN: {
if (getChildCount() == 0 || !isInContentBounds(ev)) {
return false;