summaryrefslogtreecommitdiffstats
path: root/services/input/InputReader.h
Commit message (Collapse)AuthorAgeFilesLines
* Disable touch while using the stylus (Galaxy Note)Volker Braun2012-07-051-1/+11
| | | | | | | | | | | | | | | | | | Android 4.0 cannot form multitouch events from multiple input devices. So it is not possible to report one touchpoint from the stylus position and, at the same time, another touchpoint from a finger touch. Instead, when a new input device starts up the currently active input is cancelled. This is highly undesirable while writing with the pen. The easiest solution is to ignore non-stylus touch events while the stylus is within range (hovering) of the touchscreen. For example, N-trig digitizers implement this in hardware. But wacom digitizers do report pen data simultaneously with touch data. This patch disables (non-stylus) touch input within 50ms of stylus data. On my Galaxy Note this is necessary to make stylus input usable. Change-Id: I9f458d85d8bf83d6cf03b467d46ce066fd55b7e0
* input: Add option to toggle pointer icon when using stylusSteve Kondik2012-06-031-1/+10
| | | | | | | | * The visible pointer icon when hovering or drawing with the stylus is quite annoying when trying to actually draw with it. Turn it off by default and add an option to turn it on. Change-Id: I98b6e1ea929019ef12dbd4b2991c6c96c52cef5c
* InputManager: Add system setting to define keyboard localesAlexander Hofbauer2012-05-181-0/+6
| | | | | | | | | KEYLAYOUT_OVERRIDES expects a string of "devicename,layoutfile" to set keyboard layout and character map to files in /system/usr/keylayout and /system/user/keychars. This overrides the default behaviour of opening files that match the device's input name if there's no configuration file.
* This reverts two wrong patch sets fix attempts.Alexander Hofbauer2012-05-181-6/+0
| | | | | | | | | | | | | | | | | | | Trying to fix my stupid mistakes. Reverted commits: *) 5e2284869bc6b53d6de786d6b5846e9b79383f04: Fix InputReader test *) 8f2303e5b3b2c1e40c52bfb4028a663e503d132e: add missing file for "Iec99d52f: Load a device specific key handler" *) 2ee7ed47a844f168db074c95e4fc93e9745618c0: InputManager: Add system setting to define keyboard locales *) cf02764d48eadacdb9114225e043835143c4ed07: Load a device specific key handler Change-Id: Ibdaa8d52054c830a4e3659bf356cc2df71342eb3
* InputManager: Add system setting to define keyboard localesAlexander Hofbauer2012-05-151-0/+6
| | | | | | | | | | | KEYLAYOUT_OVERRIDES expects a string of "devicename,layoutfile" to set keyboard layout and character map to files in /system/usr/keylayout and /system/user/keychars. This overrides the default behaviour of opening files that match the device's input name if it is unconfigured. Change-Id: I35d07c6986db5a8b0744ff4c8649c2a34cc2fd14
* Support composite touch / joystick devices better.Jeff Brown2011-08-311-2/+4
| | | | | | | | This change enables the joystick input mapper to handle any axes that are not claimed by the touch input mapper, which makes auxiliary controls such as wheels / knobs accessible. Change-Id: I01ee7f342ac91acfcb4ccb6676fd52b3d5bf31a0
* Add a "show touches" option for demos and presentations.Jeff Brown2011-08-261-1/+8
| | | | | | Bug: 4569045 Change-Id: I8726ea292dd7def790a5e40d7d7e58968974f896
* Support BTN_TOOL_*TAP as synonyms for BTN_TOOL_FINGER.Jeff Brown2011-08-231-0/+3
| | | | | | | | | | | | Bug: 5205301 Some drivers report one finger as BTN_TOOL_FINGER, two as BTN_TOOL_DOUBLETAP, three as BTN_TOOL_TRIPLETAP and four as BTN_TOOL_QUADTAP. Since we care about the tool type, we need to handle _DOUBLE/_TRIPLE/_QUAD tap in the same way we handle _FINGER. Change-Id: I8eb83d2a2bada9ac32d07619c7eea84e924316b8
* Input system bug fixes, particularly for stylus.Jeff Brown2011-08-191-75/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 5049148 Finished stylus support, including support for indirect stylus and mouse tools. Added TILT axis. When stylus tilt X/Y is available, it is transformed into an orientation and tilt inclination which is a more convenient representation and a simpler extension to the exiting API. Touch devices now only report touch data using a single input source. Previously touch devices in pointer mode would report both absolute touch pad data and cooked pointer gestures. Now we just pick one. The touch device switches modes as needed when the focused application enables/disables pointer gestures. This change greatly simplifies the code and reduces the load on the input dispatcher. Fixed an incorrect assumption that the value of ABS_(MT_)DISTANCE would be zero whenever the stylus was in direct contact. It appears that the correct way to determine whether the stylus is in direct contact (rather than hovering) is by checking for a non-zero reported pressure. Added code to read the initial state of tool buttons and axis values when the input devices are initialized or reset. This fixes problems where the input mapper state might have the wrong initial state. Moved responsibility for cancelling pending inputs (keys down, touches, etc.) to the InputDispatcher by sending it a device reset notification. This frees the InputReader from having to synthesize events during reset, which was cumbersome and somewhat brittle to begin with. Consolidated more of the common accumulator logic from SingleTouchInputMapper and MultiTouchInputMapper into TouchInputMapper. Improved the PointerLocation output. Change-Id: I595d3647f7fd7cb1e3eff8b3c76b85043b5fe2f0
* Exorcise notification panel ghosts.Jeff Brown2011-08-111-1/+0
| | | | | | | | | | | | | | | | Bug: 5105599 Don't clear slot data when slot is no longer in use. The kernel will not resend absolute slot values if they are unchanged, even if the slot was previously marked unused. Because the protocol is stateful, this could cause problems if evdev drops events (marked by SYN_DROPPED) since we cannot query the initial values of the slots, but there's nothing we can do. Change-Id: Ie13e68097fb8ed2542c2f60338b499082cf9e77f
* Improve touch device configuration.Jeff Brown2011-08-111-47/+23
| | | | | | | | | | | | Bug: 5064702 This change improves compatibility with standard touch device drivers. All existing touch device IDC files will need to be updated because the input system now assumes that the touch device drivers implement the multitouch input protocol correctly and use the appropriate axes. Change-Id: I93aad0e011efea74fbc7fa3da31f7967aff8136c
* Add input system to Watchdog.Jeff Brown2011-08-101-0/+4
| | | | | | Bug: 5094994 Change-Id: I153866958efc64ac19bda8b997c1c9f6ad425ec4
* Use BTN_TOUCH or BTN_TOOL_* to determine if touch active.Jeff Brown2011-08-101-1/+1
| | | | | | | | Bug: 5064702 Should not include stylus buttons in the condition. Change-Id: If4d78a875b77da8bd59672d6fdbf5353004d0023
* Refactor input reader to add stylus support.Jeff Brown2011-07-311-273/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 5064702 Introduced the concept of an InputListener to further decouple the InputReader from the InputDispatcher. The InputListener exposes just the minimum interface that the InputReader needs to communicate with the outside world. The InputReader passes arguments to the InputListener by reference, which makes it easy to queue them up. Consolidated all of the InputReader locks into one simple global Mutex. The reason this wasn't done before was due to potential re-entrance in outbound calls to the InputDispatcher. To fix this, the InputReader now queues up all of the events it wants to send using a QueuedInputListener, then flushes them outside of the critical section after all of the event processing is finished. Removing all of the InputMapper locks greatly simplifies the implementation. Added tests for new stylus features such as buttons, tool types, and hovering. Added some helpers to BitSet32 to handle common code patterns like finding the first marked bit and clearing it. Fixed a bug in VelocityTracker where the wrong pointer trace could get cleared when handling ACTION_POINTER_DOWN. Oops. Changed PointerCoords so it no longer stores useless zero axis values. Removed editAxisValue because it is not very useful when all zero value axes are absent and therefore cannot be edited in place. Added dispatch of stylus hover events. Added support for distance and tool types. Change-Id: I4cf14d134fcb1db7d10be5f2af7b37deef8f8468
* Report the external display size to the input reader.Jeff Brown2011-07-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The input reader needs this information so that it knows how to interpolate touches on an external touch screen. Changed Display so that it asks the WindowManager what the real display size is (as opposed to the raw display size). This means it now takes into the forced display size set by adb shell am display-size. Replaced all calls to getRealWidth() / getRealHeight() / getRealMetrics() in the WindowManager and replaced them with direct usages of the mCurDisplayWidth / mCurDisplayHeight so that the WM doesn't end up making a reentrant Binder call into itself. Fixed the table status bar HeightReceiver so that it updates the height on all configuration changes since it is possible that the display size changed independently of an external HDMI display being plugged / unplugged. Improved the Display class documentation to make the distinctions betweeen the various sizes clearer. Change-Id: I3f75de559d3ebffed532ab46c4ae52c5e7f1da2b
* Handle stylus buttons and tool types.Jeff Brown2011-07-251-142/+180
| | | | | | | | | | | | | | | | Added TOOL_TYPE_ERASER. Refactored the InputReader to share more code between the various input mappers that handle button states and to simplify the accumulator implementations by having each one only handle a single type of input. Removed the concept of direct/indirect tool types from the API. If we add it back, it should be done in a manner that is orthogonal to the tool type itself, perhaps as a flags field on the pointer. The device source may well provide sufficient information anyhow. Change-Id: I811c22d95e8304269b6ee4f6d11a6b04f3cfc1b2
* Remove edge slop support.Jeff Brown2011-07-141-1/+1
| | | | | | | | | The edge slop feature was added a long time ago for a specific device that had severe non-linear touch response issues near the edges of its touch screen. The feature is not useful on modern hardware that is property calibrated. Change-Id: I26716cbc7411c31883ddb4bb4ddd981027790d0f
* Drop obsolete touch screen hacks.Jeff Brown2011-07-011-49/+0
| | | | Change-Id: I47354c37ee2cc2b36340eb709bb5043b3ba78ed9
* Workaround apps that make assumptions about pointer ids.Jeff Brown2011-07-011-0/+4
| | | | | | | | | | Modified the touch input mapper to assign pointer ids sequentially starting from 0 instead of using the tracking id or slot index supplied by the driver. Applications should not depend on this ordering but some do. (sigh) Bug: 4980884 Change-Id: I0dfeb3ac27c57a7102a13c960c760e2a02eb7669
* Add support for disabling pointer gestures.Jeff Brown2011-06-141-15/+30
| | | | | | | | | | | | 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
* am 92110af2: am 5f0b1721: am 25bd8abc: Merge "Fix swipe gesture cosine ↵Jeff Brown2011-06-091-1/+1
|\ | | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | | | | | | | | 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-8/+0
|\ \ | |/ | | | | | | | | | | Bug: 4124987" into honeycomb-mr2 * commit '55cc25c12c45e8ffb65d2275cc0b6941b68db9df': Simplify spot tracking logic. Bug: 4124987
| * Simplify spot tracking logic.Jeff Brown2011-06-061-8/+0
| | | | | | | | | | | | | | | | | | 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-7/+6
|\ \ | |/ | | | | Change-Id: I33a5a2949dc6c2d09e8196ba8c7128caa7ac2361
| * Touch pad improvements.Jeff Brown2011-06-061-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | resolved conflicts for merge of ca2b552d to masterJeff Brown2011-06-031-5/+12
|\ \ | |/ | | | | Change-Id: I2f3693a59042ac5aa2d7bcdc3a504c78dc99a18b
| * Add a preference panel for mouse speed.Jeff Brown2011-06-021-5/+12
| | | | | | | | | | Bug: 4124987 Change-Id: I3ce175d268a1d043cf5878481261b1049a15a149
* | am 56503b8d: am 8186a5f0: am 10c3f367: Merge "Implement pointer ↵Jeff Brown2011-06-031-1/+19
|\ \ | |/ | | | | | | | | | | acceleration." into honeycomb-mr2 * commit '56503b8ddfe5c82407da32e18061e725f668432d': Implement pointer acceleration.
| * Implement pointer acceleration.Jeff Brown2011-06-021-1/+19
| | | | | | | | | | Bug: 4124987 Change-Id: I1f31a28f1594c55302ccabe13fe3ca6d2ff71d50
* | resolved conflicts for merge of 7e193916 to masterDianne Hackborn2011-06-031-19/+117
|\ \ | |/ | | | | Change-Id: If06892419319c3a2d4ab6b03dd3ceb99b83803b5
| * Use ViewConfiguration to seed input system configuration.Jeff Brown2011-05-311-19/+117
| | | | | | | | | | | | | | | | | | 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
* | Merge "Fix ABS_MT_SLOT handling."Jeff Brown2011-06-021-3/+5
|\ \
| * | Fix ABS_MT_SLOT handling.Jeff Brown2011-06-021-3/+5
| | | | | | | | | | | | | | | | | | 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-0/+8
|\ \ \ | |/ / |/| / | |/ | | | | | | into honeycomb-mr2 * commit '3f5b95b05efcf7ab2e8f193649b841dc1786f2ef': Touch pad UX improvements.
| * Touch pad UX improvements.Jeff Brown2011-05-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add tap/drag touchpad gesture. (DO NOT MERGE)Jeff Brown2011-05-251-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-35/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add a sprite controller. (DO NOT MERGE)Jeff Brown2011-05-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored PointerController to extract the surface management code to a new component called a SpriteController so that it can be used to move finger tracking spots around the screen as well. The SpriteController is designed to fully decouple the client from any latency introduced by surface transactions and drawing. All sprite updates are performed asynchronously on the Looper using a copy of the sprite state. Added a stub SpotController implementation for touch pad UX. It will be implemented in a subsequent patch. Fixed a little bug in pointer orientation changes when entering DISPLAY_ORIENTATION_90 the x offset was clobbered. Change-Id: I6d59d80df9af61e93af50290e7776337d10c9d5a
| * Optimize EventHub to process events in big chunks. (DO NOT MERGE)Jeff Brown2011-05-241-7/+10
| | | | | | | | | | | | | | 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-0/+8
| | | | | | | | | | | | | | | | 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-3/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Input device protocol enhancements.Jeff Brown2011-05-241-19/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-35/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add a sprite controller.Jeff Brown2011-04-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored PointerController to extract the surface management code to a new component called a SpriteController so that it can be used to move finger tracking spots around the screen as well. The SpriteController is designed to fully decouple the client from any latency introduced by surface transactions and drawing. All sprite updates are performed asynchronously on the Looper using a copy of the sprite state. Added a stub SpotController implementation for touch pad UX. It will be implemented in a subsequent patch. Fixed a little bug in pointer orientation changes when entering DISPLAY_ORIENTATION_90 the x offset was clobbered. Change-Id: Ib25d162d577c9b354cb74d5d761c3c9f9f438d42
* | Optimize EventHub to process events in big chunks.Jeff Brown2011-03-181-7/+10
| | | | | | | | | | | | | | 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-0/+8
| | | | | | | | | | | | | | | | 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-3/+177
|/ | | | | | | | | | | | | | | | | | | | 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