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

Skip to content
Commit eba157bc authored by Nathaniel R. Lewis's avatar Nathaniel R. Lewis Committed by Linzhao Ye
Browse files

Support "pointer" capture for touchpads

In N, pointer capture was added such that the input events from
devices such as mice could be captured directly without UI
interaction for applications such as games.

At present, pointer capture is only supported on cursor input
devices (mice, trackballs), but games and similar applications
could also easily want to use a touchpad in a similar fashion.

This patch adds support for "pointer" capture on touchpads.

Changes:

If pointer capture is enabled, disable pointer mode for pointer
devices, causing them to fall back on a raw, unscaled mode. Android
already reports events from such devices via onGenericMotionEvent().

Android assumes that all pointer devices have an associated display,
so a condition was added to viewport calculation to fall back on a
non display viewport (raw dimensions) if the device is operating in
unscaled mode.

Added pointer capture mode changes to reconfiguration condition
check.

Added InputReader test demonstrating the concept.

Test: Connect a touchpad.  Request pointer capture for a focused
      view in an app and the touchpad events should come out over
      onGenericMotionEvent(MotionEvent).

Test: atest inputflinger_tests:MultiTouchInputMapperTest#Process_TouchpadCapture
Test: atest inputflinger_tests:MultiTouchInputMapperTest#WhenCapturedAndNotCaptured_GetSources

Bug: 38511270
Change-Id: I387708aad2d8bbe1e921fcb177f687af948dd052
Merged-In: I387708aad2d8bbe1e921fcb177f687af948dd052
parent 65600040
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment