summaryrefslogtreecommitdiffstats
path: root/services/input
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Get rid of the "pid" parameter from createSurface"Mathias Agopian2011-04-211-1/+1
|\
| * Get rid of the "pid" parameter from createSurfaceMathias Agopian2011-04-201-1/+1
| | | | | | | | Change-Id: I28635e3f803e6abe965d79998e305f54a202465d
* | Add tap/drag touchpad gesture.Jeff Brown2011-04-193-67/+161
|/ | | | | | | | | | | | | | | 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-1910-613/+1189
| | | | | | | | | | | | | | | | | | | | 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-119-213/+876
| | | | | | | | | | | | | | | | | | 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
* Coalesce input events that arrive faster than 333Hz.Jeff Brown2011-04-073-21/+101
| | | | | | | | | | | | | | | | | | | | | | Some drivers report individual finger updates one at a time instead of all at once. When 10 fingers are down, this can cause the framework to have to handle 10 times as many events each with 10 times as much data. Applications like PointerLocation would get significantly bogged down by all of the redundant samples. This change coalesces samples that are closely spaced in time, before they are dispatched, as part of the motion event batching protocol. Increased the size of the InputChannel shared memory buffer so that applications can catch up faster if they accumulate a backlog of samples. Added logging code to help measure input dispatch and drawing latency issues in the view hierarchy. See ViewDebug.DEBUG_LATENCY. Change-Id: Ia5898f781f19901d2225c529a910c32bdf4f504f
* Allow batching samples onto the pending motion event.Jeff Brown2011-04-061-0/+28
| | | | | | | | This enlarges the window of opportunity for batching to encompass time spent for the window to become ready (while it is busy processing the last event). Change-Id: I3fb5a394ab1b85d6591192678168ca6e35dd9d53
* Fix dispatcher crash when input monitoring enabled.Jeff Brown2011-04-013-39/+40
| | | | | | | Also ensure that we actually log assertion failures. Bug: 4203092 Change-Id: I5c14bc41b2255f876858121f5572e2de75cabcc3
* Add input filter mechanism for accessibility.Jeff Brown2011-03-304-27/+112
| | | | | | | | | | | | | | | | | | | This patch adds a mechanism for capturing, filtering, transforming and injecting input events at a very low level before the input dispatcher attempts to deliver them to applications. At this time, the mechanism is only intended to be used by the accessibility system to implement built-in system-level accessibility affordances. The accessibility input filter is currently just a stub. It logs the input events receives and reinjects them unchanged, except that it transforms KEYCODE_Q into KEYCODE_Z. Currently, the accessibility input filter is installed whenever accessibility is enabled. We'll probably want to change that so it only enables the input filter when a screen reader is installed and we want touch exploration. Change-Id: I35764fdf75522b69d09ebd78c9766eb7593c1afe
* Merge "Support chorded fallback keys."Jeff Brown2011-03-292-99/+221
|\
| * Support chorded fallback keys.Jeff Brown2011-03-292-99/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also be more careful about canceling fallback keys during focus transitions, when the application handles the key, or when the policy decides to do something different. Fixed a crash due to JNI CallObjectMethod returning an undefined value (not null) when an exception is thrown. Fixed a crash due to the policy trying to create a Dialog for recent apps on the dispatcher thread. It should happen on the policy's Looper instead. Bug: 4187302 Change-Id: I659a3fd1bd2325ed36d965f9beb75dacb89790c9
* | merge libsurfaceflinger_client into libguiMathias Agopian2011-03-252-2/+1
|/ | | | | | | | | | | | this is the first step in unifying surfacetexture and surface. for this reason the header files were not moved, as most of them will eventually go away. NOTE: currently we keep libsurfaceflinger_client.so as an empty library to workaround prebuilt binaries wrongly linking against it. Change-Id: I130f0de2428e8579033dc41394d093f4e1431a00
* Fix focused application handle.Jeff Brown2011-03-251-4/+4
| | | | | | | | | | Fix a bug where we were always setting the focused application handle to NULL. This broke ANR processing while starting applications and caused input events to be dropped while starting applications. Bug: 4174573 Change-Id: Icd7b8c4c49ed73c41978f3ff076c2e5cd839a802
* Add MotionEvent.HOVER_ENTER and HOVER_EXIT.Jeff Brown2011-03-243-82/+302
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Optimize EventHub to process events in big chunks."Jeff Brown2011-03-185-138/+183
|\
| * Optimize EventHub to process events in big chunks.Jeff Brown2011-03-185-138/+183
| | | | | | | | | | | | | | When 10 fingers are down, reduces the CPU time spent by the InputReader thread from ~30% to ~5% on Stingray. Change-Id: Icdf7c91cd5d9039ac3beb38ba9021a05e7fabc80
* | Merge "Refactor how timeouts are calculated."Jeff Brown2011-03-176-24/+94
|\ \ | |/
| * Refactor how timeouts are calculated.Jeff Brown2011-03-176-24/+94
| | | | | | | | | | | | | | | | 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
* | am 14438b81: am 970bad67: am be368de7: Merge "Fix missing AOSP copyright ↵James Dong2011-03-172-6/+30
|\ \ | | | | | | | | | | | | | | | | | | headers for more files" into honeycomb-mr1 * commit '14438b81a1fe4d7ebdf8977f3d80a1dd1867c5ad': Fix missing AOSP copyright headers for more files
| * | Fix missing AOSP copyright headers for more filesJames Dong2011-03-172-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Update the copyright date on InputDispatcher_test.cpp and InputReader_test.cpp because these two files were moved from other places to the current location, and were actually created in 2010. bug - 4119349 Change-Id: Ic93b81ddafb58e9e72a2e9e02ca3d9f173d6dca7
* | | am e5feed7e: am 244eb34a: am d98f8aff: Merge "Fix dangling pointer when ↵Jeff Brown2011-03-171-2/+28
|\ \ \ | |/ / | | / | |/ |/| | | | | device closed just after opening." into honeycomb-mr1 * commit 'e5feed7e5ded92b8af4b5548144b6b8a45491a61': Fix dangling pointer when device closed just after opening.
| * Fix dangling pointer when device closed just after opening.Jeff Brown2011-03-171-2/+28
| | | | | | | | | | Bug: 4088239 Change-Id: I210b918370357560a5ace8ea8dd7601255487e88
* | Use touch pad gestures to manipulate the pointer.Jeff Brown2011-03-144-262/+1384
|/ | | | | | | | | | | | | | | | | | | | 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-095-171/+280
| | | | | | | | | | | | | | | | | | | | | 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-092-15/+24
| | | | Change-Id: Idf7799ea90fa07677850d40ee1aec39220ded372
* Fix off by one errors in touch motion ranges. (DO NOT MERGE)Jeff Brown2011-03-095-194/+193
| | | | | | | | | | | | | | | | | | | 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-092-3/+15
| | | | Change-Id: Ida3b8300764623662052f80095973186cb9d4616
* Joystick tweaks. (DO NOT MERGE)Jeff Brown2011-03-045-54/+164
| | | | | | | | | | | | | | | | | | 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
* Set last event time to previous event batch delivery time to appsmakarand.karvekar2011-03-031-2/+1
| | | | | | | | | | | | | Determination of the last event time. Currently, uses the time that the first event in the previous batch that was sent from hardware. This produces inconsistent timing intervals for event delivery to apps. Now, use the time that the previous batch was delivered to the application. Original Author: Stephen Moore <steve.moore@motorola.com> Signed-off-by: makarand.karvekar <makarand.karvekar@motorola.com> Change-Id: I2a3701915702d622dc04fbf4bbd4918a9ebe8856
* Only set KeyEvent long press flag when repeat count equals 1.Jeff Brown2011-03-021-4/+6
| | | | | | | This fixes a Gingerbread regression. Bug: 3507021 Change-Id: I8c2acb35be718fea7e996175c1407e84315d17ef
* Wake screen from external HID peripherals.Jeff Brown2011-03-028-14/+84
| | | | | | | | | | | | | | | | | | 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-025-9/+214
| | | | | | | | | | | | | | 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-254-41/+89
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Be more precise about tracking fallback keys.Jeff Brown2011-02-222-6/+53
| | | | | | | | | Only initiate fallback key handling if the first key down was not handled and there is no other fallback key already in progress. This prevents spurious fallbacks from being generated when applications handle the initial down but not repeated downs or the up. Change-Id: I8a513896cf96b16dc502cd72291926d5532aa2ab
* Add new hover move action and scroll wheel plumbing.Jeff Brown2011-02-196-144/+139
| | | | | | | | | | | | 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-195-337/+373
| | | | | | | | | | | | | | | | | | 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-173-59/+59
| | | | | | Also added some more unit tests. Change-Id: I413654294d1a998eec056884e6df5eaa50f3daf4
* Add support for arbitrary axes in MotionEvents.Jeff Brown2011-02-153-66/+75
| | | | | | | | | | | 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
* Scale major axis when finger is oriented.Jeff Brown2011-02-151-3/+5
| | | | Change-Id: I281ec25478b4ceffa6ed5a41cb44a7e81d18d8dc
* Fix read from uninitialized memory.Jeff Brown2011-02-071-1/+2
| | | | Change-Id: I75ce29d5971b386ff9dd52824a8953ce69a3ec15
* Fix build.Jeff Brown2011-01-251-1/+1
| | | | Change-Id: Id08f3ccced1281f1c6840cc67713bcedcf9a53c0
* am 12b2dc90: am b1e0a870: Merge "Fix crashes caused by some input devices." ↵Jeff Brown2011-01-256-35/+99
|\ | | | | | | | | | | | | into honeycomb * commit '12b2dc90883ef4f930a17907acdef3677b0598a5': Fix crashes caused by some input devices.
| * Fix crashes caused by some input devices.Jeff Brown2011-01-256-35/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The touch screen sometimes reports more than 10 pointers even though that's all we asked for. When this happens, we start dropping events with more than 10 pointers. This confuses applications and causes them to crash. Raised the limit to 16 pointers. Bug: 3331247 The default behavior was to identify all touch devices as touch screens. External devices that are plugged in are more likely to be touch pads not attached to a screen. Changed the default to be a touch pad and renamed some internal constants to avoid confusion. A certain mouse happens to also behave like a touch pad. That caused problems because we would see multiple concurrent traces of motion events coming from the same input device so we would batch them up. Added code to ensure that we don't batch events unless they come from the same *source* in addition to coming from the same *device*. Due to batching or misbehaving drivers, it's possible for the set of pointer ids to be different from what we expect when it comes time to split motion events across windows. As a result, we can generate motion events with 0 pointers. When we try to deliver those events, we cause an error in the InputTransport so we tear down the InputChannel and kill the application. Added code to check out assumption about pointer ids and drop the event gracefully instead. Patched up the tests to take into account the change in default behavior for identifying touch screens and touch pads. Change-Id: Ic364bd4cb4cc6335d4a1213a26d6bdadc7e33505
* | am 5f668c6e: am 8b9df978: Merge "Fix getSwitchState." into honeycombJeff Brown2011-01-192-2/+2
|\ \ | |/ | | | | | | * commit '5f668c6e6bb2515325632691a804a7c8f24ebb09': Fix getSwitchState.
| * Fix getSwitchState.Jeff Brown2011-01-192-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | InputReader::getSwitchState always returns AKEY_STATE_UNKNOWN because SwitchInputMapper::getSources() returns 0 which cannot match any source mask including AINPUT_SOURCE_ANY. As a result initial lid switch detection is broken. This change adds a new source constant AINPUT_SOURCE_SWITCH that indicates that the source has switches. Change-Id: I5321ecf0ce84f1c2b4535f6c163d3f4dcf9b7a9b
* | am 761a6b7f: am f4368c95: Merge "Filter virtual keys after touches." into ↵Jeff Brown2011-01-183-1/+81
|\ \ | |/ | | | | | | | | | | honeycomb * commit '761a6b7fdbe2bcc6db4306af9705dcb22b036068': Filter virtual keys after touches.
| * Merge "Filter virtual keys after touches." into honeycombJeff Brown2011-01-183-1/+81
| |\
| | * Filter virtual keys after touches.Jeff Brown2011-01-183-1/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new virtualKeyQuietTimeMillis configuration resource that sets the duration for which virtual keys will be dropped after recent touches on screen. The default value is 0; it is intended to be overridden per device using a resource overlay. This change is designed to help in two cases: 1. Swipes from touchscreen into virtual key area. 2. Accidental taps in virtual key area while using on-screen keyboard. Bug: 3089163 Change-Id: Ib912d4f8a4df9966a39cd537d3ec7c24afab7225
* | | am 6a88cea1: am f2bc4ee9: Merge "Mouse pointer tweaks." into honeycombJeff Brown2011-01-171-2/+10
|\ \ \ | |/ / | | | | | | | | | * commit '6a88cea122077c6b472d52136ac928c9ad690a0a': Mouse pointer tweaks.
| * | Mouse pointer tweaks.Jeff Brown2011-01-171-2/+10
| |/ | | | | | | | | | | | | | | Make pointer arrow brighter. Deep copy the pointer icon bitmap since it turns out that the original shared pixels can be deleted by other code. Change-Id: I77fbf61d1dace723f3c8c9808941e9e31d8db352