summaryrefslogtreecommitdiffstats
path: root/core/java/com/android/internal/widget/PointerLocationView.java
Commit message (Collapse)AuthorAgeFilesLines
* Make velocity tracker strategy configurable.Jeff Brown2012-06-031-2/+50
| | | | | | | | | | This change is very useful for testing purposes because it makes it easy to compare different implementations to see how they behave. There is no change to the current default strategy. Bug: 6413587 Change-Id: I4d8567aa4160571ba9fa397ce419882cd9366749
* More VelocityTracker refactoring.Jeff Brown2012-05-131-1/+1
| | | | | Bug: 6413587 Change-Id: Ida1152e7a34d5fe5caab5e6b5e1bc79f6c7a25e6
* Notify applications when input devices change.Jeff Brown2012-04-121-14/+54
| | | | | | | | | | | | | | | | | This change allows the InputManager to keep track of what input devices are registered with the system and when they change. It needs to do this so that it can properly clear its cache of input device properties (especially the key map!) when changes occur. Added new API so that applications can register listeners for input device changes. Fixed a minor bug in EventHub where it didn't handle EPOLLHUP properly so it would spam the log about unsupposed epoll events until inotify noticed that the device was gone and removed it. Change-Id: I937d8c601f7185d4299038bce6a2934fe4fdd2b3
* Ensure pointer location view is attached to the policy thread.Jeff Brown2012-03-291-245/+241
| | | | | | | | | | | | | | Previously we created the PointerLocationView on whatever thread happened to trigger the call to updateSettings(). There was also some messiness around having to add or remove the view while not holding mLock. Now, just post the work to the policy handler. This also makes it possible for us to use invalidate() instead of postInvalidate() in PointerLocationView, which is more efficient. Change-Id: I0646d7aeecffdc22f6ac56ae3ef951e7a12e2b93
* Velocity Tracker II: The Revenge of Velocity TrackerJeff Brown2011-09-141-2/+22
| | | | | | | | | | | | | | | | | | | | | Bug: 5265529 Rewrote the velocity tracker to fit a polynomial curve to pointer movements using least squares linear regression. The velocity is simply the first derivative of this polynomial. Clients can also obtain an Estimator that describes the complete terms of the estimating polynomial including the coefficient of determination which provides a measure of the quality of the fit (confidence). Enhanced PointerLocation to display the movement curve predicted by the estimator in addition to the velocity vector. By default, the algorithm computes a 2nd degree (quadratic) polynomial based on a 100ms recent history horizon. Change-Id: Id377bef44117fce68fee2c41f90134ce3224d3a1
* Input system bug fixes, particularly for stylus.Jeff Brown2011-08-191-21/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Input device protocol enhancements.Jeff Brown2011-05-241-0/+1
| | | | | | | | | | | | | 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-23/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 MotionEvent.HOVER_ENTER and HOVER_EXIT.Jeff Brown2011-03-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Make PointerLocationView also log generic motions and some keys.Jeff Brown2011-03-071-4/+53
| | | | Change-Id: Ia7ec0f1a98e9eaf1c59db90b8f77a3cd4cf69625
* Add support for mouse hover and scroll wheel.Jeff Brown2011-02-251-36/+87
| | | | | | | | | | | | | | | | | | | | | | | | | 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-12/+21
| | | | | | | | | | | | 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-1/+4
| | | | | | | | | | | | | | | | | | 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
* Add support for detecting finger orientation.Jeff Brown2011-01-141-0/+11
| | | | Change-Id: I901fc61f7705fcd7950190dc8782bad616032ee2
* Revert orientation change.Jeff Brown2010-09-291-1/+1
| | | | Change-Id: I1a6d13be118533171b9a75025dcf7985dd7e12b5
* PointerLocationView: Display orientation correctly.Jeff Brown2010-09-291-1/+1
| | | | | | | Canvas rotations are counterclockwise, orientation is clockwise, so we need to mind the sign of the rotation. Change-Id: I2a8b60599bd26e9dc3ced2e13942f846461333df
* Fix PointerLocationView when pointer ids are not zero-based.Jeff Brown2010-09-121-8/+21
| | | | | | | | Since we support using driver-provided pointer ids (ABS_MT_TRACKING_ID) there is no guarantee that pointer ids will necessarily start from 0 or be contiguous. Change-Id: I9609b7a3bb238d7edbcbd68cc839dd6d14baf9df
* Input device calibration and capabilities.Jeff Brown2010-08-301-109/+297
| | | | | | | | | | | | | Finished the input device capability API. Added a mechanism for calibrating touch devices to obtain more accurate information about the touch contact area. Improved pointer location to show new coordinates and capabilities. Optimized pointer location display and formatting to avoid allocating large numbers of temporary objects. The GC churn was causing the application to stutter very badly when more than a couple of fingers were down). Added more diagnostics. Change-Id: Ie25380278ed6f16c5b04cd9df848015850383498
* Enhanced VelocityTracker for > 5 pointers and fixed bugs.Jeff Brown2010-07-301-17/+19
| | | | | | | | | | | | | Improved PointerLocation tool to use VelocityTracker more efficiently and correctly when multiple pointers are down. Fixed a bug in TouchInputMapper where it was not correctly copying the id to index map in the last touch data. This could cause strange behavior on secondary pointer up events. Also added finished callback pooling in InputQueue. Change-Id: Ia85e52ac2fb7350960ea1d7edfbe81a1b3e8267b
* Fix issue #2512131: Trackball goes up when movingDianne Hackborn2010-03-191-0/+8
| | | | Change-Id: Ib403de88f24bc1b6e5417732e3b69f89a5160bbc
* Add missing license notices to filesKenny Root2010-03-121-0/+16
| | | | Change-Id: Ie46176940810bd5001f7650a381c1c3c90a3718b
* Move the pointer location thing out of common.Dianne Hackborn2010-03-011-0/+337