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

Commit 982cb983 authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 4533120 - rough handling of invalid event streams in

ScaleGestureDetector

Make ScaleGestureDetector a bit more tolerant of bogus event streams.

Change-Id: I28a8b1ea494b7f1ca9d4c4623b95aee38f213369
parent 8de47a2f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -329,6 +329,15 @@ public class ScaleGestureDetector {
                        // Set focus point to the remaining finger
                        final int index = event.findPointerIndex(actionId == mActiveId0 ?
                                mActiveId1 : mActiveId0);
                        if (index < 0) {
                            mInvalidGesture = true;
                            Log.e(TAG, "Invalid MotionEvent stream detected.", new Throwable());
                            if (mGestureInProgress) {
                                mListener.onScaleEnd(this);
                            }
                            return false;
                        }

                        mActiveId0 = event.getPointerId(index);

                        mActive0MostRecent = true;