summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-11-11 23:17:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-11 23:17:02 +0000
commit988a4329a558ecd45c99da16fdbf02b2690e835d (patch)
treed1a50e027ef986c7d74920451935e3b2d0a82ab3
parent34bfbee9bbb5e618fa5e7c6f4fcbc7da58c6f279 (diff)
parent050e2a8d5aef356b7b7b35ab5242669dd7a79dfd (diff)
am 050e2a8d: Merge "Fix IOOB exception in ViewDragHelper" into lmp-mr1-dev
* commit '050e2a8d5aef356b7b7b35ab5242669dd7a79dfd': Fix IOOB exception in ViewDragHelper
-rw-r--r--src/com/android/dialer/widget/ViewDragHelper.java8
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]);