Frameworks: fixes possible invalid pointer index call.
Fixes possible invalid pointer index call in AbsListView. Bug: 4982383 Change-Id: I9b88ab6a055c7678ef81fbe3187473edf8d12f6a
This commit is contained in:
@ -2888,7 +2888,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MotionEvent.ACTION_MOVE: {
|
case MotionEvent.ACTION_MOVE: {
|
||||||
final int pointerIndex = ev.findPointerIndex(mActivePointerId);
|
int pointerIndex = ev.findPointerIndex(mActivePointerId);
|
||||||
|
if (pointerIndex == -1) {
|
||||||
|
pointerIndex = 0;
|
||||||
|
mActivePointerId = ev.getPointerId(pointerIndex);
|
||||||
|
}
|
||||||
final int y = (int) ev.getY(pointerIndex);
|
final int y = (int) ev.getY(pointerIndex);
|
||||||
deltaY = y - mMotionY;
|
deltaY = y - mMotionY;
|
||||||
switch (mTouchMode) {
|
switch (mTouchMode) {
|
||||||
@ -3464,7 +3468,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
|||||||
case MotionEvent.ACTION_MOVE: {
|
case MotionEvent.ACTION_MOVE: {
|
||||||
switch (mTouchMode) {
|
switch (mTouchMode) {
|
||||||
case TOUCH_MODE_DOWN:
|
case TOUCH_MODE_DOWN:
|
||||||
final int pointerIndex = ev.findPointerIndex(mActivePointerId);
|
int pointerIndex = ev.findPointerIndex(mActivePointerId);
|
||||||
|
if (pointerIndex == -1) {
|
||||||
|
pointerIndex = 0;
|
||||||
|
mActivePointerId = ev.getPointerId(pointerIndex);
|
||||||
|
}
|
||||||
final int y = (int) ev.getY(pointerIndex);
|
final int y = (int) ev.getY(pointerIndex);
|
||||||
if (startScrollIfNeeded(y - mMotionY)) {
|
if (startScrollIfNeeded(y - mMotionY)) {
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user