summaryrefslogtreecommitdiffstats
path: root/services/input/InputReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Hover and stylus API cleanup.Jeff Brown2011-06-271-4/+4
| | | | | | | Added missing setOnHoverListener method. Removed BUTTON_STATE_ERASER. Change-Id: I5d820d0a8e47fe5fd2d88e9fd9fc3fc6ce0dea0d
* Add support for disabling pointer gestures.Jeff Brown2011-06-141-201/+254
| | | | | | | | | | | | Made it possible for individual windows to disable pointer gestures while the window has focus using a private API. Cleaned up the InputReader configuration code to enable in-place reconfiguration of input devices without having to reopen them all. This change makes changing the pointer speed somewhat nicer since the pointer doesn't jump back to the origin after each change. Change-Id: I9727419c2f4cb39e16acb4b15fd7fd84526b1239
* EventHub code cleanup.Jeff Brown2011-06-141-1/+3
| | | | | | | | | Use epoll_wait() instead of poll(). Dropped all support for non-Linux platforms. Added a wake-up protocol so that the InputReader can wake up the event loop immediately as needed. Change-Id: Ibf84337bcceb3c2df068c5c637de42a319786d66
* Take advantage of updated linux/input.h kernel headers.Jeff Brown2011-06-131-4/+5
| | | | Change-Id: I72d2ef82de5c504d46b0cdb57aa43bbd0d769174
* am 92110af2: am 5f0b1721: am 25bd8abc: Merge "Fix swipe gesture cosine ↵Jeff Brown2011-06-091-1/+5
|\ | | | | | | | | | | | | calculation. Bug: 4124987" into honeycomb-mr2 * commit '92110af24a9a93b73264560b57f55f45ec65dab5': Fix swipe gesture cosine calculation. Bug: 4124987
| * Fix swipe gesture cosine calculation.Jeff Brown2011-06-071-1/+5
| | | | | | | | | | | | | | | | | | | | Bug: 4124987 Recent changes introduced a multiplication factor into the distance calculation which ended up being absent from the dot product calculation. Change-Id: Ia367912b9ac09b6285d5a498a0c271563c9e9e39
* | am 55cc25c1: am 797dc698: am b92dcf9c: Merge "Simplify spot tracking logic. ↵Jeff Brown2011-06-071-140/+12
|\ \ | |/ | | | | | | | | | | Bug: 4124987" into honeycomb-mr2 * commit '55cc25c12c45e8ffb65d2275cc0b6941b68db9df': Simplify spot tracking logic. Bug: 4124987
| * Simplify spot tracking logic.Jeff Brown2011-06-061-140/+12
| | | | | | | | | | | | | | | | | | Bug: 4124987 Since spots are now one-to-one with the touch gesture points, we can eliminate a lot of redundant logic that assumed they weren't. Change-Id: Ic60d8d0898c285317f480bc8fb17fb9797770e69
* | resolved conflicts for merge of 8b2c0014 to masterJeff Brown2011-06-071-155/+173
|\ \ | |/ | | | | Change-Id: I33a5a2949dc6c2d09e8196ba8c7128caa7ac2361
| * Touch pad improvements.Jeff Brown2011-06-061-155/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 4124987 Only show one spot per touch point instead of one spot per finger for multitouch gestures. Tweaked the pointer acceleration curves. Dissociated the hover/tap timeouts from the "tap" timeout since they mean very different things. Change-Id: I7c2cbd30feeb65ebc12f6c7e33a67dc9a9f59d4c
* | Use pointer mode instead of spots for SEMI_MT touch pads.Jeff Brown2011-06-031-3/+5
| | | | | | | | | | | | | | | | | | | | The spot-based presentation relies on being able to accurately locate and distinguish two or more fingers on the touch pad. We can still do gesture recognition without distinct multitouch but it doesn't make sense to show spots because we can't be sure that the spots will appear in the right places. Change-Id: Ia282d77000bf3b50d395273a1f0ac0bbe55b3c6f
* | resolved conflicts for merge of ca2b552d to masterJeff Brown2011-06-031-7/+19
|\ \ | |/ | | | | Change-Id: I2f3693a59042ac5aa2d7bcdc3a504c78dc99a18b
| * Add a preference panel for mouse speed.Jeff Brown2011-06-021-7/+19
| | | | | | | | | | Bug: 4124987 Change-Id: I3ce175d268a1d043cf5878481261b1049a15a149
* | am 56503b8d: am 8186a5f0: am 10c3f367: Merge "Implement pointer ↵Jeff Brown2011-06-031-66/+110
|\ \ | |/ | | | | | | | | | | acceleration." into honeycomb-mr2 * commit '56503b8ddfe5c82407da32e18061e725f668432d': Implement pointer acceleration.
| * Implement pointer acceleration.Jeff Brown2011-06-021-66/+110
| | | | | | | | | | Bug: 4124987 Change-Id: I1f31a28f1594c55302ccabe13fe3ca6d2ff71d50
* | resolved conflicts for merge of 7e193916 to masterDianne Hackborn2011-06-031-93/+80
|\ \ | |/ | | | | Change-Id: If06892419319c3a2d4ab6b03dd3ceb99b83803b5
| * Use ViewConfiguration to seed input system configuration.Jeff Brown2011-05-311-95/+80
| | | | | | | | | | | | | | | | | | Fix bug where the pointer presentation would be updated on any input reader timeout rather than only when a pointer gesture is in progress. Bug: 4124987 Change-Id: Ie9bba4a0b3228d55e45e65fa2ede5cd6ba887a08
| * Button state should reflect actual buttons. (DO NOT MERGE)Jeff Brown2011-05-311-18/+2
| | | | | | | | | | Bug: 4124987 Change-Id: If0585bd1432c8c61ed0c9a6a4f6de4a62e3f6e53
* | Merge "Fix ABS_MT_SLOT handling."Jeff Brown2011-06-021-4/+8
|\ \
| * | Fix ABS_MT_SLOT handling.Jeff Brown2011-06-021-4/+8
| | | | | | | | | | | | | | | | | | Shouldn't reset the current slot index to 0 after each SYN_REPORT. Change-Id: I370e4770f8ae0ce598369ecbaf64772c13e02d46
* | | am 3f5b95b0: am a4e74744: am fa574c0e: Merge "Touch pad UX improvements." ↵Jeff Brown2011-05-311-25/+98
|\ \ \ | |/ / |/| / | |/ | | | | | | into honeycomb-mr2 * commit '3f5b95b05efcf7ab2e8f193649b841dc1786f2ef': Touch pad UX improvements.
| * Touch pad UX improvements.Jeff Brown2011-05-251-25/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | Fade the pointer spot when swiping or performing a freeform gesture. Support configuring the gesture mode in the device IDC file. Added workaround for devices that report individual finger movements one at a time instead of all at once. Bug: 4124987 Change-Id: I44628b00382ad59306e4ec5c4717d69cc6fbebb8
| * Fix bug reporting presence of orientation axis. (DO NOT MERGE)Jeff Brown2011-05-251-0/+2
| | | | | | | | Change-Id: I20aecca392d2843601e6e0ec4ac913c8ccdbbf89
| * Add tap/drag touchpad gesture. (DO NOT MERGE)Jeff Brown2011-05-251-59/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mapper sends a DOWN when the finger is released then starts a short timer. If the finger is not pressed again before the timer elapses, then the mapper sends an UP to complete the tap. If the finger is pressed again then the mapper starts sending MOVEs as part of a drag. Double/triple taps work as intended because we also start watching for a new tap when the finger is pressed again. If a new tap occurs the old tap is also finished. So each individual finger short press/release cycle constitutes a distinct tap. Change-Id: Id0a6ee10dd27e723f6cb04e56b43939abe9e940c
| * Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)Jeff Brown2011-05-251-262/+502
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new PointerIcon API (hidden for now) for loading pointer icons. Fixed a starvation problem in the native Looper's sendMessage implementation which caused new messages to be posted ahead of old messages sent with sendMessageDelayed. Redesigned the touch pad gestures to be defined in terms of more fluid finger / spot movements. The objective is to reinforce the natural mapping between fingers and spots which means there must not be any discontinuities in spot motion relative to the fingers. Removed the SpotController stub and folded its responsibilities into PointerController. Change-Id: Ib647dbd7a57a7f30dd9c6e2c260df51d7bbdd18e
| * Optimize EventHub to process events in big chunks. (DO NOT MERGE)Jeff Brown2011-05-241-34/+61
| | | | | | | | | | | | | | When 10 fingers are down, reduces the CPU time spent by the InputReader thread from ~30% to ~5% on Stingray. Change-Id: I42ee5c67b8521af715cbab43e763a4af4eb1f914
| * Refactor how timeouts are calculated. (DO NOT MERGE)Jeff Brown2011-05-231-9/+64
| | | | | | | | | | | | | | | | Added a timeout mechanism to EventHub and InputReader so that InputMappers can request timeouts to perform delayed processing of input when needed. Change-Id: I89c1171c9326c6e413042e3ee13aa9f7f1fc0454
| * Use touch pad gestures to manipulate the pointer. (DO NOT MERGE)Jeff Brown2011-05-231-251/+1189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Single finger tap performs a click. 2. Single finger movement moves the pointer (hovers). 3. Button press plus movement performs click or drag. While dragging, the pointer follows the finger that is moving fastest. This is important if there are additional fingers down on the touch pad for the purpose of applying force to an integrated button underneath. 4. Two fingers near each other moving in the same direction are coalesced as a swipe gesture under the pointer. 5. Two or more fingers moving in arbitrary directions are transformed into touches in the vicinity of the pointer. This makes scale/zoom and rotate gestures possible. Added a native VelocityTracker implementation to enable intelligent switching of the active pointer during drags. Change-Id: I7b7ddacc724fb1306e1590dbaebb740d3130d7cd
* | Disable pointer debug logging.Jeff Brown2011-05-241-1/+1
| | | | | | | | Change-Id: I00628fa369cb1b179a1907f9cb19de8ca4c755ab
* | Input device protocol enhancements.Jeff Brown2011-05-241-89/+269
| | | | | | | | | | | | | | | | | | | | | | | | | | Added support for Linux multitouch protocol B (slots). Added support for using the device's input properties as a hint to determine the intended usage of a touch device. Added support for the ABS_MT_DISTANCE axis. Fixed a bug reporting the presence of the orientation axis. Change-Id: Icf7b5a5a0f1a9cdf6ad2b35be8ea0c1a35815d48
* | Add initial API for stylus and mouse buttons.Jeff Brown2011-05-131-69/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added the concept of pointer properties in a MotionEvent. This is currently used to track the pointer tool type to enable applications to distinguish finger touches from a stylus. Button states are also reported to application as part of touch events. There are no new actions for detecting changes in button states. The application should instead query the button state from the MotionEvent and take appropriate action as needed. A good time to check the button state is on ACTION_DOWN. As a side-effect, applications that do not support multiple buttons will treat primary, secondary and tertiary buttons identically for all touch events. The back button on the mouse is mapped to KEYCODE_BACK and the forward button is mapped to KEYCODE_FORWARD. Added basic plumbing for the secondary mouse button to invoke the context menu, particularly in lists. Added clamp and split methods on MotionEvent to take care of common filtering operations so we don't have them scattered in multiple places across the framework. Bug: 4260011 Change-Id: Ie992b4d4e00c8f2e76b961da0a902145b27f6d83
* | Add tap/drag touchpad gesture.Jeff Brown2011-04-191-58/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mapper sends a DOWN when the finger is released then starts a short timer. If the finger is not pressed again before the timer elapses, then the mapper sends an UP to complete the tap. If the finger is pressed again then the mapper starts sending MOVEs as part of a drag. Double/triple taps work as intended because we also start watching for a new tap when the finger is pressed again. If a new tap occurs the old tap is also finished. So each individual finger short press/release cycle constitutes a distinct tap. Change-Id: Iaa51182edee4378162a66adfd746088e93af2a30
* | Initial checkin of spot presentation for touchpad gestures.Jeff Brown2011-04-191-261/+501
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new PointerIcon API (hidden for now) for loading pointer icons. Fixed a starvation problem in the native Looper's sendMessage implementation which caused new messages to be posted ahead of old messages sent with sendMessageDelayed. Redesigned the touch pad gestures to be defined in terms of more fluid finger / spot movements. The objective is to reinforce the natural mapping between fingers and spots which means there must not be any discontinuities in spot motion relative to the fingers. Removed the SpotController stub and folded its responsibilities into PointerController. Change-Id: I5126b1e69d95252fda7f2a684c9287e239a57163
* | Fix dispatcher crash when input monitoring enabled.Jeff Brown2011-04-011-18/+18
| | | | | | | | | | | | | | Also ensure that we actually log assertion failures. Bug: 4203092 Change-Id: I5c14bc41b2255f876858121f5572e2de75cabcc3
* | Add MotionEvent.HOVER_ENTER and HOVER_EXIT.Jeff Brown2011-03-241-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The input dispatcher sends a HOVER_ENTER to a window before dispatching it any HOVER_MOVE events. For compatibility reasons, the window will *also* receive the HOVER_MOVE. When the pointer moves into a different window or the pointer goes down or when events are canceled for some reason, the input dispatcher sends a HOVER_EXIT to the previously hovered window. The view hierarchy behavior is similar. All views under the pointer receive onHoverEvent with HOVER_ENTER followed by any number of HOVER_MOVE events. When the pointer leaves a view, the view receives HOVER_EXIT. Similarly, if a parent view decides to capture hover by returning true from onHoverEvent, the hovered descendants will receive HOVER_EXIT. The default behavior of onHoverEvent is to update the view's hovered state by calling setHovered(true/false). Views can query their current hovered state using isHovered(). For testing purposes, the hovered state is mapped to the pressed drawable state. This will change in a subsequent commit with the introduction of a new hovered drawable state. Change-Id: Ib76a7a90236c8f2c7336e55773acade6346cacbe
* | Optimize EventHub to process events in big chunks.Jeff Brown2011-03-181-34/+61
| | | | | | | | | | | | | | When 10 fingers are down, reduces the CPU time spent by the InputReader thread from ~30% to ~5% on Stingray. Change-Id: Icdf7c91cd5d9039ac3beb38ba9021a05e7fabc80
* | Refactor how timeouts are calculated.Jeff Brown2011-03-171-9/+64
| | | | | | | | | | | | | | | | Added a timeout mechanism to EventHub and InputReader so that InputMappers can request timeouts to perform delayed processing of input when needed. Change-Id: Iec2045baaf4e67690b15eef3c09a58d5cac76897
* | Use touch pad gestures to manipulate the pointer.Jeff Brown2011-03-141-251/+1189
|/ | | | | | | | | | | | | | | | | | | | 1. Single finger tap performs a click. 2. Single finger movement moves the pointer (hovers). 3. Button press plus movement performs click or drag. While dragging, the pointer follows the finger that is moving fastest. This is important if there are additional fingers down on the touch pad for the purpose of applying force to an integrated button underneath. 4. Two fingers near each other moving in the same direction are coalesced as a swipe gesture under the pointer. 5. Two or more fingers moving in arbitrary directions are transformed into touches in the vicinity of the pointer. This makes scale/zoom and rotate gestures possible. Added a native VelocityTracker implementation to enable intelligent switching of the active pointer during drags. Change-Id: I5ada57e7f2bdb9b0a791843eb354a8c706b365dc
* Input improvements and bug fixes.Jeff Brown2011-03-091-118/+199
| | | | | | | | | | | | | | | | | | | | | Associate each motion axis with the source from which it comes. It is possible for multiple sources of the same device to define the same axis. This fixes new API that was introduced in MR1. (Bug: 4066146) Fixed a bug that might cause a segfault when using a trackball. Only fade out the mouse pointer when touching the touch screen, ignore other touch pads. Changed the plural "sources" to "source" in several places in the InputReader where we intend to refer to a particular source rather than to a combination of sources. Improved the batching code to support batching events from different sources of the same device in parallel. (Bug: 3391564) Change-Id: I0189e18e464338f126f7bf94370b928e1b1695f2
* Recognize 3D joysticks. (DO NOT MERGE)Jeff Brown2011-03-091-0/+1
| | | | Change-Id: Idf7799ea90fa07677850d40ee1aec39220ded372
* Fix off by one errors in touch motion ranges. (DO NOT MERGE)Jeff Brown2011-03-091-130/+138
| | | | | | | | | | | | | | | | | | | Report inclusive minimum and maximum ranges for all axes including X and Y. Set mouse pointer bounds to 0..width-1, 0..height-1. Rotate touch and mouse positions more carefully, paying attention to the maximum bounds when calculating the complement of an axis. Simplified the InputReader somewhat and removed support for a couple of poorly defined input device configuration parameters. We now assume that the touch device provides useful absolute axis ranges for the X and Y axes since the alternative does not actually make sense. Bug: 3413541 Change-Id: I121d28a125c4f9618cb283dc460d33ff1a907023
* Support POLICY_FLAG_ALT et. al. (DO NOT MERGE)Jeff Brown2011-03-091-3/+0
| | | | Change-Id: Ida3b8300764623662052f80095973186cb9d4616
* Joystick tweaks. (DO NOT MERGE)Jeff Brown2011-03-041-36/+131
| | | | | | | | | | | | | | | | | | Ensure that the joystick can always reach -1.0, 0.0 and 1.0 positions even when noise filtering is applied. (Bug: 3514510) Add support for a few more standard axes. Add additional mapping modes for axes. Some axes are inverted from standard interpretation or are actually intended to be split into two distict axes such as left/right trigger controls or accelerator/brake. Add key layout file for a G25 racing wheel and XBox 360 controller to tweak behavior. They work fine without them but the axis mappings are not ideal. Change-Id: I0fddd90309af4dc14d35f34fe99ed6e521c0b7c7
* Wake screen from external HID peripherals.Jeff Brown2011-03-021-7/+45
| | | | | | | | | | | | | | | | | | Added some plumbing to enable the policy to intercept motion events when the screen is off to handle wakeup if needed. Added a basic concept of an external device to limit the scope of the wakeup policy to external devices only. The wakeup policy for internal devices should be based on explicit rules such as policy flags in key layout files. Moved isTouchEvent to native. Ensure the dispatcher sends the right event type to userActivity for non-touch pointer events like HOVER_MOVE and SCROLL. Bug: 3193114 Change-Id: I15dbd48a16810dfaf226ff7ad117d46908ca4f86
* Fade out the mouse pointer after inactivity or other events.Jeff Brown2011-03-021-3/+41
| | | | | | | | | | | | | | Fades out the mouse pointer: - after 15 seconds of inactivity normally - after 3 seconds of inactivity in lights out mode - after a non-modifier key down - after a touch down Extended the native Looper to support enqueuing time delayed messages. This is used by the PointerController to control pointer fade timing. Change-Id: I87792fea7dbe2d9376c78cf354fe3189a484d9da
* Add support for mouse hover and scroll wheel.Jeff Brown2011-02-251-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Dispatch ACTION_HOVER_MOVE and ACTION_SCROLL through the View hierarchy as onGenericTouchEvent. Pointer events dispatched this way are delivered to the view under the pointer. Non-pointer events continue to be delivered to the focused view. Added scroll wheel support to AbsListView, ScrollView, HorizontalScrollView and WebView. Shift+VSCROLL is translated to HSCROLL as appropriate. Added logging of new pointer events in PointerLocationView. Fixed a problem in EventHub when a USB device is removed that resulted in a long stream of ENODEV errors being logged until INotify noticed the device was gone. Note that the new events are not supported by wallpapers at this time because the wallpaper engine only delivers touch events. Make all mouse buttons behave identically. (Effectively we only support one button.) Change-Id: I9ab445ffb63c813fcb07db6693987b02475f3756
* Add new hover move action and scroll wheel plumbing.Jeff Brown2011-02-191-20/+23
| | | | | | | | | | | | Added support for tracking the mouse position even when the mouse button is not pressed. To avoid confusing existing applications, mouse movements are reported using the new ACTION_HOVER_MOVE action when the mouse button is not pressed. Added some more plumbing for the scroll wheel axes. The values are reported to Views but they are not yet handled by the framework. Change-Id: I1706be850d25cf34e5adf880bbed5cc3265cf4b1
* Add new axes for joysticks and mouse wheels.Jeff Brown2011-02-191-143/+216
| | | | | | | | | | | | | | | | | | Added API on InputDevice to query the set of axes available. Added API on KeyEvent and MotionEvent to convert keycodes and axes to symbolic name strings for diagnostic purposes. Added API on KeyEvent to query if a given key code is a gamepad button. Added a new "axis" element to key layout files to specify the mapping between raw absolute axis values and motion axis ids. Expanded the axis bitfield to 64bits to allow for future growth. Modified the Makefile for keyboard prebuilts to run the keymap validation tool during the build. Added layouts for two game controllers. Added default actions for game pad button keys. Added more tests. Fixed a bunch of bugs. Change-Id: I73f9166c3b3c5bcf4970845b58088ad467525525
* Fix a regression with MotionEvent parceling.Jeff Brown2011-02-171-18/+18
| | | | | | Also added some more unit tests. Change-Id: I413654294d1a998eec056884e6df5eaa50f3daf4
* Add support for arbitrary axes in MotionEvents.Jeff Brown2011-02-151-32/+29
| | | | | | | | | | | This change makes it possible to extend the set of axes that are reported in MotionEvents by defining new axis constants. The MotionEvent object is now backed by its C++ counterpart to avoid having to maintain multiple representations of the same data. Change-Id: Ibe93c90d4b390d43c176cce48d558d20869ee608