From 99441dfe3e96529756a8deec55ef4825b2f78d51 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Fri, 20 Nov 2020 13:21:11 -0800 Subject: [PATCH] Include touchpad capture in View#requestPointerCapture docs Include information about how events from a touchpad are treated when pointer capture is enabled. Bug: 173741165 Test: None Change-Id: Ia7ca0fca60e72d13ea57a35029f0fe3183cd1bda --- core/java/android/view/View.java | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a88ad9f24c104..dff83ddde06c9 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -27933,10 +27933,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Requests pointer capture mode. *

* When the window has pointer capture, the mouse pointer icon will disappear and will not - * change its position. Further mouse will be dispatched with the source - * {@link InputDevice#SOURCE_MOUSE_RELATIVE}, and relative position changes will be available - * through {@link MotionEvent#getX} and {@link MotionEvent#getY}. Non-mouse events - * (touchscreens, or stylus) will not be affected. + * change its position. Enabling pointer capture will change the behavior of input devices in + * the following ways: + *

+ *

+ * Events captured through pointer capture will be dispatched to + * {@link OnCapturedPointerListener#onCapturedPointer(View, MotionEvent)} if an + * {@link OnCapturedPointerListener} is set, and otherwise to + * {@link #onCapturedPointerEvent(MotionEvent)}. *

* If the window already has pointer capture, this call does nothing. *

@@ -27945,6 +27961,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @see #releasePointerCapture() * @see #hasPointerCapture() + * @see #onPointerCaptureChange(boolean) */ public void requestPointerCapture() { final ViewRootImpl viewRootImpl = getViewRootImpl(); @@ -27960,6 +27977,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * If the window does not have pointer capture, this call will do nothing. * @see #requestPointerCapture() * @see #hasPointerCapture() + * @see #onPointerCaptureChange(boolean) */ public void releasePointerCapture() { final ViewRootImpl viewRootImpl = getViewRootImpl();