diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2012-08-24 07:30:06 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-08-24 07:30:06 -0700 |
| commit | 58dc9b6bfa55d22ce145591ceab6bccd0f2b441f (patch) | |
| tree | 9b176c9a15f5fd7d7325e380382da91d3b94173d /core/java/android/widget/ScrollView.java | |
| parent | 058f00350766a19b06bfdc72850985c3eca71c5f (diff) | |
| parent | 790d34039df650d983c7c87a2a2e888e18edc2be (diff) | |
am 790d3403: am d86bebb4: am 322b0a16: Merge "Protecting more views from (bad) MotionEvents"
* commit '790d34039df650d983c7c87a2a2e888e18edc2be':
Protecting more views from (bad) MotionEvents
Diffstat (limited to 'core/java/android/widget/ScrollView.java')
| -rw-r--r-- | core/java/android/widget/ScrollView.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 1711154e5cb9..bc41931c366a 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -25,6 +25,7 @@ import android.graphics.Rect; import android.os.Bundle; import android.os.StrictMode; import android.util.AttributeSet; +import android.util.Log; import android.view.FocusFinder; import android.view.InputDevice; import android.view.KeyEvent; @@ -69,6 +70,8 @@ public class ScrollView extends FrameLayout { static final float MAX_SCROLL_FACTOR = 0.5f; + private static final String TAG = "ScrollView"; + private long mLastScroll; private final Rect mTempRect = new Rect(); @@ -485,6 +488,12 @@ public class ScrollView extends FrameLayout { } final int pointerIndex = ev.findPointerIndex(activePointerId); + if (pointerIndex == -1) { + Log.e(TAG, "Invalid pointerId=" + activePointerId + + " in onInterceptTouchEvent"); + break; + } + final int y = (int) ev.getY(pointerIndex); final int yDiff = Math.abs(y - mLastMotionY); if (yDiff > mTouchSlop) { @@ -592,6 +601,11 @@ public class ScrollView extends FrameLayout { } case MotionEvent.ACTION_MOVE: final int activePointerIndex = ev.findPointerIndex(mActivePointerId); + if (activePointerIndex == -1) { + Log.e(TAG, "Invalid pointerId=" + mActivePointerId + " in onTouchEvent"); + break; + } + final int y = (int) ev.getY(activePointerIndex); int deltaY = mLastMotionY - y; if (!mIsBeingDragged && Math.abs(deltaY) > mTouchSlop) { |
