diff options
| author | George Mount <mount@google.com> | 2012-05-02 16:35:01 -0700 |
|---|---|---|
| committer | George Mount <mount@google.com> | 2012-05-03 09:02:14 -0700 |
| commit | 7a33acf123ad27aad21bd517fca68a64eb8fe434 (patch) | |
| tree | 6ee86400a4c2636b889003d29a30b0a8e78ef6ac /core/java/android/webkit/WebViewInputDispatcher.java | |
| parent | a2c37665d9947d00c64427b35489d3794c7b6214 (diff) | |
Add intercept path for UI touch handling.
Bug 6410164
Change-Id: Ia3907a9a57321d0f25763c88fd0c0a7617d5da48
Diffstat (limited to 'core/java/android/webkit/WebViewInputDispatcher.java')
| -rw-r--r-- | core/java/android/webkit/WebViewInputDispatcher.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/core/java/android/webkit/WebViewInputDispatcher.java b/core/java/android/webkit/WebViewInputDispatcher.java index b612a3b4fb54..ef23a11a911e 100644 --- a/core/java/android/webkit/WebViewInputDispatcher.java +++ b/core/java/android/webkit/WebViewInputDispatcher.java @@ -22,7 +22,6 @@ import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.util.Log; -import android.view.InputDevice; import android.view.MotionEvent; import android.view.ViewConfiguration; @@ -314,11 +313,13 @@ final class WebViewInputDispatcher { return false; } - if (mPostSendTouchEventsToWebKit - && mPostDoNotSendTouchEventsToWebKitUntilNextGesture - && action == MotionEvent.ACTION_DOWN) { - // Recover from a previous web kit timeout. - mPostDoNotSendTouchEventsToWebKitUntilNextGesture = false; + if (action == MotionEvent.ACTION_DOWN && mPostSendTouchEventsToWebKit) { + if (mUiCallbacks.shouldInterceptTouchEvent(eventToEnqueue)) { + mPostDoNotSendTouchEventsToWebKitUntilNextGesture = true; + } else if (mPostDoNotSendTouchEventsToWebKitUntilNextGesture) { + // Recover from a previous web kit timeout. + mPostDoNotSendTouchEventsToWebKitUntilNextGesture = false; + } } } @@ -949,6 +950,15 @@ final class WebViewInputDispatcher { * @param flags The event's dispatch flags. */ public void dispatchUiEvent(MotionEvent event, int eventType, int flags); + + /** + * Asks the UI thread whether this touch event stream should be + * intercepted based on the touch down event. + * @param event The touch down event. + * @return true if the UI stream wants the touch stream without going + * through webkit or false otherwise. + */ + public boolean shouldInterceptTouchEvent(MotionEvent event); } /* Implemented by {@link WebViewCore} to perform operations on the web kit thread. */ |
