Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2585e9bd authored by Justin Koh's avatar Justin Koh Committed by Jeff Brown
Browse files

Frameworks: fixes possible invalid pointer index call.

Fixes possible invalid pointer index call in AbsListView.

Bug: 4982383
Change-Id: I9b88ab6a055c7678ef81fbe3187473edf8d12f6a
parent 7564d62a
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -2888,7 +2888,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        }

        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);
            deltaY = y - mMotionY;
            switch (mTouchMode) {
@@ -3464,7 +3468,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        case MotionEvent.ACTION_MOVE: {
            switch (mTouchMode) {
            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);
                if (startScrollIfNeeded(y - mMotionY)) {
                    return true;