diff options
author | Yorke Lee <yorkelee@google.com> | 2014-11-12 03:43:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-12 03:43:38 +0000 |
commit | 2c1e0384f742c154c0e19f6fcd7fa71834cb9896 (patch) | |
tree | 97b8753b5575d981c7172f7b62bfc688c195fa33 | |
parent | 8c30124c3337d14fbc31c2987f4c30621c4db6be (diff) | |
parent | 835ac9216232a00cca5040a554e0f7075159554c (diff) |
am 835ac921: am 988a4329: am 050e2a8d: Merge "Fix IOOB exception in ViewDragHelper" into lmp-mr1-dev
* commit '835ac9216232a00cca5040a554e0f7075159554c':
Fix IOOB exception in ViewDragHelper
-rw-r--r-- | src/com/android/dialer/widget/ViewDragHelper.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/dialer/widget/ViewDragHelper.java b/src/com/android/dialer/widget/ViewDragHelper.java index c0bc2ce29..fe3ab8230 100644 --- a/src/com/android/dialer/widget/ViewDragHelper.java +++ b/src/com/android/dialer/widget/ViewDragHelper.java @@ -21,6 +21,7 @@ import android.content.Context; import android.support.v4.view.MotionEventCompat; import android.support.v4.view.VelocityTrackerCompat; import android.support.v4.view.ViewCompat; +import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -1176,7 +1177,12 @@ public class ViewDragHelper { case MotionEvent.ACTION_MOVE: { if (mDragState == STATE_DRAGGING) { - final int index = MotionEventCompat.findPointerIndex(ev, mActivePointerId); + int index = MotionEventCompat.findPointerIndex(ev, mActivePointerId); + if (index < 0) { + Log.e(TAG, "Pointer index for id " + mActivePointerId + " not found." + + " Skipping MotionEvent"); + return; + } final float x = MotionEventCompat.getX(ev, index); final float y = MotionEventCompat.getY(ev, index); final int idx = (int) (x - mLastMotionX[mActivePointerId]); |