|
25 | 25 | import android.os.Bundle; |
26 | 26 | import android.os.StrictMode; |
27 | 27 | import android.util.AttributeSet; |
| 28 | +import android.util.Log; |
28 | 29 | import android.view.FocusFinder; |
29 | 30 | import android.view.InputDevice; |
30 | 31 | import android.view.KeyEvent; |
@@ -69,6 +70,8 @@ public class ScrollView extends FrameLayout { |
69 | 70 |
|
70 | 71 | static final float MAX_SCROLL_FACTOR = 0.5f; |
71 | 72 |
|
| 73 | + private static final String TAG = "ScrollView"; |
| 74 | + |
72 | 75 | private long mLastScroll; |
73 | 76 |
|
74 | 77 | private final Rect mTempRect = new Rect(); |
@@ -478,6 +481,12 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { |
478 | 481 | } |
479 | 482 |
|
480 | 483 | final int pointerIndex = ev.findPointerIndex(activePointerId); |
| 484 | + if (pointerIndex == -1) { |
| 485 | + Log.e(TAG, "Invalid pointerId=" + activePointerId |
| 486 | + + " in onInterceptTouchEvent"); |
| 487 | + break; |
| 488 | + } |
| 489 | + |
481 | 490 | final int y = (int) ev.getY(pointerIndex); |
482 | 491 | final int yDiff = Math.abs(y - mLastMotionY); |
483 | 492 | if (yDiff > mTouchSlop) { |
@@ -585,6 +594,11 @@ public boolean onTouchEvent(MotionEvent ev) { |
585 | 594 | } |
586 | 595 | case MotionEvent.ACTION_MOVE: |
587 | 596 | final int activePointerIndex = ev.findPointerIndex(mActivePointerId); |
| 597 | + if (activePointerIndex == -1) { |
| 598 | + Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent"); |
| 599 | + break; |
| 600 | + } |
| 601 | + |
588 | 602 | final int y = (int) ev.getY(activePointerIndex); |
589 | 603 | int deltaY = mLastMotionY - y; |
590 | 604 | if (!mIsBeingDragged && Math.abs(deltaY) > mTouchSlop) { |
|
0 commit comments