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

Commit 8465cc9d authored by Huahui Wu's avatar Huahui Wu
Browse files

b/3340946 Fix NPE caused by null gesture detector.

Gmail use WebView without instantiating the gesture detector. The Gmail team replied that they don't need the pinch to zoom feature so we can safely skip multi-touch events for them.

Change-Id: Id60a4d4583979ef5b420fff04c4ca097c0594024
parent acd944cc
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -5520,8 +5520,9 @@ public class WebView extends AbsoluteLayout
                            + "mPreventDefault = " + mPreventDefault
                            + " mDeferTouchProcess = " + mDeferTouchProcess
                            + " mTouchMode = " + mTouchMode);
                }
                } else {
                    mVelocityTracker.addMovement(ev);
                }
                if (mSelectingText && mSelectionStarted) {
                    if (DebugFlags.WEB_VIEW) {
                        Log.v(LOGTAG, "extend=" + contentX + "," + contentY);
@@ -5760,8 +5761,9 @@ public class WebView extends AbsoluteLayout
                                        + mPreventDefault
                                        + " mDeferTouchProcess = "
                                        + mDeferTouchProcess);
                            }
                            } else {
                                mVelocityTracker.addMovement(ev);
                            }
                            // set to MOTIONLESS_IGNORE so that it won't keep
                            // removing and sending message in
                            // drawCoreAndCursorRing()
@@ -5836,6 +5838,11 @@ public class WebView extends AbsoluteLayout

        final ScaleGestureDetector detector =
            mZoomManager.getMultiTouchGestureDetector();

        // A few apps use WebView but don't instantiate gesture detector.
        // We don't need to support multi touch for them.
        if (detector == null) return false;

        int action = ev.getAction();
        float x = ev.getX();
        float y = ev.getY();