History log of /frameworks/base/services/input/InputReader.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f583d0dcc6e5c1968c472c844f6c8fbbe036ad78 29-Oct-2013 Michael Wright <michaelwr@google.com> Always initialize local boolean variables when possible

It's currently possible to reference deviceModeChanged in InputReader
while it's in an unknown state. Change the style of initialization
here and a few other places to better prevent this type of error.

Bug: 11433748
Change-Id: Ib332406aefb7cdb16b6a21e00dceaeca34679853
/frameworks/base/services/input/InputReader.cpp
ac6c78b6eef49f5c1ab2a346d90ccb99ccec18f4 17-Jul-2013 Michael Wright <michaelwr@google.com> Add controller numbers for gamepads / joysticks

Change-Id: I30ac9add6a2473a5ebd83a022c571545e61d1136
/frameworks/base/services/input/InputReader.cpp
7caaeeb6a8a4c4d299b14617c643f96a5055f2f7 20-Jul-2013 Michael Wright <michaelwr@google.com> Merge "Add input device property for buttons under touchpads"
7ddd11035b25b0a2dbf09f9d9efd3fca701f0a79 21-May-2013 Michael Wright <michaelwr@google.com> Add input device property for buttons under touchpads

Bug: 8990644
Change-Id: I2cc10457595a861b707c0394bd435d60efa8405b
/frameworks/base/services/input/InputReader.cpp
398d309c616ee5e1661282d7fce38db4cfb24ee6 03-Jul-2013 Michael Wright <michaelwr@google.com> Properly set the tap down time when entering non-tap modes

This prevents us from erroneously generating tap gestures on things like quick
button presses.

Change-Id: I708e7df9341df589927fd2c0e15c202ccb30ba9b
/frameworks/base/services/input/InputReader.cpp
9d3b1a424c5c61e24e9659d15fb353026a00d925 02-Jul-2013 Jeff Brown <jeffbrown@google.com> Move input library code to frameworks/native.

No longer compile libandroidfw as a static library on the device
since it already exists as a shared library. Keeping the static
library would force us to provide a static library version of
libinput for the device as well which doesn't make sense.

Change-Id: I3517881b87b47dcc209d80dbd0ac6b5cf29a766f
/frameworks/base/services/input/InputReader.cpp
c8c82009dc8c146efadac6b51702922148f6003f 29-May-2013 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 7573e594 to stage-aosp-master

Change-Id: Ic19294c82ec023707e23b5848901426433b22e9f
5e025eb1dc151a158d2fd7b12bb3a1c891b25d81 16-May-2013 Michael Wright <michaelwr@google.com> Pipe through bounding box information (DO NOT MERGE)

Bug: 9110236
Change-Id: I7aefe6589fbaf92e5c71a0ba5425623578bafe95
/frameworks/base/services/input/InputReader.cpp
4361e1f46ef9e30c78679b5e2717b74d66191692 17-May-2013 Michael Wright <michaelwr@google.com> Remove assist swipe from TOUCH_NAVIGATION devices

Bug: 9019927
Change-Id: I0a67ee00038b6fba7818f64ba02515767e34fe06
(cherry picked from commit 681a3d710402b80a8375a05172b1fb6f720295be)
/frameworks/base/services/input/InputReader.cpp
2b08c611c88bcb17cfb0861fed67cec6d009e83b 25-Apr-2013 Michael Wright <michaelwr@google.com> Mirror LTRIGGER / RTRIGGER as BRAKE / GAS for compatibility

Bug: 8590913
Change-Id: If2918a67ecdd946ed850acc002ca021e150ec39d
/frameworks/base/services/input/InputReader.cpp
4dac901f011e7c15882e260441225633a6435e49 10-Apr-2013 Jeff Brown <jeffbrown@google.com> Rewrite touch navigation dpad synthesis.

The new implementation more accurately tracks the velocity
of flings and takes care to avoid obvious discontinuities.
The main goal is for a fling to appear to be a linear
extension of the movement already in progress. The minimum
fling velocity is set to ensure that flings appear to be
fairly smooth despite being discretized.

Use sequences of repeated key events instead of individual
down/up events to represent continuous motions in one
direction which can be helpful for stopping flings at boundaries
such as when flinging the cursor position within a text view.

Compute the movement thresholds based on the physical
size of the touch pad, if known. If not known, we assume a
nominal size.

Support stopping flings with a tap just like we do for
normal touch events elsewhere in the framework.

Moved the detection of ASSIST swipes into the InputReader
where it belongs. These swipes must be detected globally
to ensure consistent behavior across the all applications.

Added a custom protocol in EventHub to enable input device
drivers to override the timestamp of the following events
in a packet. This change enables input device drivers
that have a better idea of when an input event was actually
generated to pass this information to the input system.
Particularly useful with uinput.

Bug: 8583760
Change-Id: I8ef4e827804786d549cfaa00793a2b9dd0fda465
/frameworks/base/services/input/InputReader.cpp
c6091c64c90e9557ea58e0d7cf75915aea7c6c3e 02-Apr-2013 Michael Wright <michaelwr@google.com> Pipe through device resolution information

Bug: 8424494
Change-Id: Iafeeee0d5cd29342c1cdc86b9616222aaa5d1b94
/frameworks/base/services/input/InputReader.cpp
70bca4cc8a37c34ec5cdb0405b2e7e2c2779630d 01-Mar-2013 Jason Gerecke <killertofu@gmail.com> Properly rotate full [-pi, +pi] orientation range if available

The code currently in place assumes that orientation has a range
of [-pi/2, +pi/2] as may be found with a touch digitizer. However,
when used with a digitzer that can report the full [-pi, +pi] range
of orientations (e.g. a stylus) the calculations here are incorrect.

This patch checks if the post-rotation value is out of range for
the axis, and wraps it back around.

Change-Id: I03a22f7bf9526a5d995df1a18430d6dd24c6d6ee
/frameworks/base/services/input/InputReader.cpp
e7a9ae8ba0fb7fc61960e3facd0c5534e9ffce1e 09-Mar-2013 Michael Wright <michaelwr@google.com> Add touch navigation input source

Bug: 8276741
Change-Id: I674b9804bf9ae76d694ae7073b54a7d43474a43c
/frameworks/base/services/input/InputReader.cpp
f33b2b2b2483fa824c650b281159ca62e1d0123a 06-Oct-2012 Jeff Brown <jeffbrown@google.com> Recover from bad input event timestamps from the kernel.

This can happen due to a race when the input device is
opened or if the kernel happens to be missing the required
Android patches to set the timestamp correctly.

Bug: 7291243
Change-Id: If4319440eaff2889147c86296abd39efc5664346
/frameworks/base/services/input/InputReader.cpp
bcc046af4ef171aa3aa3c6b64efb5cafc1e46cd3 28-Sep-2012 Jeff Brown <jeffbrown@google.com> Bundle correlated switch changes atomically.

This is a prerequisite for headset jack detection on Manta.

Bug: 6548391
Change-Id: I549a194344511c0cee578b00f6a9ab5fdbdfb99c
/frameworks/base/services/input/InputReader.cpp
83d616a9c7b9505153d258511eb5c16b552e268d 10-Sep-2012 Jeff Brown <jeffbrown@google.com> Make input system aware of multiple displays.

The input system needs to know about the window that has
focus, even if it is on a secondary display. So now we
send it the list of all windows and indicate which display
they are on. We filter the list of windows as necessary
when delivering touch events.

To keep things simple, monitor input channels and input
filters are not supported except on the main display.
We also do not pass the display id to applications; it is
only used inside the input system for now.

Properly scale touch coordinates based on the viewport.
This will be needed to ensure that touch works on external
display as well as when the internal display is being used
to simulate a different resolution.

Change-Id: I1815579a52fcc852c519b5391fc7ab8767c2dc59
/frameworks/base/services/input/InputReader.cpp
d728bf514f257670fcb9aa22c6eaf97626072c93 09-Sep-2012 Jeff Brown <jeffbrown@google.com> Make display manager tell input system about viewports.

The window manager is no longer responsible for telling the
input system about the display viewport.

Change-Id: I932882bae55decef55f25093bb2a7ebac1620bb1
/frameworks/base/services/input/InputReader.cpp
037f727f49ddf4f5575f6440799261bd1289eb6e 26-Jun-2012 Jeff Brown <jeffbrown@google.com> Improve handling of size and orientation.

Some touch device drivers report the range of
ABS_MT_ORIENTATION as [0,1]. The Linux multitouch protocol
spec says that the 0 value should always be considered vertical.

Add a new 'box' calibration mode for size to handle the case
where width and height are being provided. The 'diameter'
calibration mode is inadequate because it drops one of these
components.

Change-Id: I7bd744fdff95acd4044d295efe8bd7186dbe8061
/frameworks/base/services/input/InputReader.cpp
daa3753a04699724d2cfe824ac1f5a266d643a05 02-May-2012 Jeff Brown <jeffbrown@google.com> Improve handling of built-in keyboard.

The window manager policy made some incorrect assumptions about the
meaning of the Configuration.keyboard field. We need to be more
careful about distinguishing between built-in and external keyboards.

Most of this change is to move the determination of the parts of
the Configuration related to input devices into the WindowManagerService
leveraging new features of the InputManagerService to good effect.

Then we plumb through the flag that indicates whether a device
is internal or external so that we can be more particular about
how the lid switch effects changes to the Configuration.

Bug: 6424373
Change-Id: I36a1c22ade35e578955465a25940a33f227b9763
/frameworks/base/services/input/InputReader.cpp
c3742a18a6106f9c61eba16b00d15efa88f6f51a 25-Apr-2012 Dianne Hackborn <hackbod@android.com> am 7086cd5c: am 5600deb7: am d26a8b73: am cda8329e: Merge "Distance max set incorrectly"

* commit '7086cd5c75073b75cd4a7d61aaa9f0529450e4e5':
Distance max set incorrectly
8239940d0efb7e536d932473c535c1d9bb0ab658 21-Mar-2012 Andreas Sandblad <andreas.sandblad@sonymobile.com> Distance max set incorrectly

The distance max used in the MotionRange is calculated
incorrectly.

Looks like a copy-and-paste error.

Change-Id: I2b6daab088df0fb69e05682b67ca33524ff35987
/frameworks/base/services/input/InputReader.cpp
5bbd4b4f5fc19302fa017ad6afee6eb2d489d91a 21-Apr-2012 Jeff Brown <jeffbrown@google.com> Get alias for Bluetooth devices.

Bluetooth devices can be renamed by the user. Make the
input system aware of the user-specified name and transparently
pass it down to applications. This enables the keyboard
layout picker Settings UI to use device names that are
consistent with what the user set in the Bluetooth UI.

Bug: 6363157
Change-Id: I8eea26ce2c69c2a3f09c8de02e9e847610e0419c
/frameworks/base/services/input/InputReader.cpp
00710e906bdafd58386ee7f81fa84addd218122f 20-Apr-2012 Jeff Brown <jeffbrown@google.com> Make InputDevice.SOURCE_STYLUS meaningful.

Bug: 5424551
Change-Id: I415cb1842422e050cc41b17f5a1f13b4fab17a44
/frameworks/base/services/input/InputReader.cpp
61c08240585a6186b4bd879d87f238b3efc368f8 19-Apr-2012 Jeff Brown <jeffbrown@google.com> Don't load keyboard layout overlay for virtual keyboard.

Bug: 6110399
Change-Id: I07c85cf991790ed8766b097acc39295a8065a5ea
/frameworks/base/services/input/InputReader.cpp
6ec6f79e1ac1714e3b837796e99f07ff88f66601 18-Apr-2012 Jeff Brown <jeffbrown@google.com> Support loading keyboard layout overlays from resources.

Added the concept of a keyboard layout overlay, which is
a key character map file that has "type OVERLAY".

Added support for loading keyboard layout overlays from
resources dynamically. The layouts are reloaded whenever they
are changed in the Settings application or an application
is installed. This is somewhat more aggressive than necessary
so we might want to optimize it later.

Before system-ready, the input system uses just the generic
keyboard layouts that are included on the device system image.
After system-ready, it considers the user's selected keyboard
layout overlay and attempts to load it as necessary. We need to
wait until system-ready before doing this because we need to
be in a state where it is safe to start applications or access
their resources.

Bug: 6110399
Change-Id: Iae0886d3356649b0d2440aa00910a888cedd8323
/frameworks/base/services/input/InputReader.cpp
a47425a13c19f95057df78b8bb65bb25657e8753 13-Apr-2012 Jeff Brown <jeffbrown@google.com> Add support for input devices that have vibrators.

Added a getVibrator() method to InputDevice which returns a Vibrator
associated with that input device. Its uses the same API as the
system vibrator which makes it easy for applications to be modified
to use one or the other.

Bug: 6334179
Change-Id: Ifc7f13dbcb778670f3f1c07ccc562334e6109d2e
/frameworks/base/services/input/InputReader.cpp
af9e8d38184c6ba4d2d3eb5bde7014a66dd8a78b 13-Apr-2012 Jeff Brown <jeffbrown@google.com> Notify applications when input devices change.

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
/frameworks/base/services/input/InputReader.cpp
49ccac530b5a798e3c4a79b66b51b8546a0deed1 12-Apr-2012 Jeff Brown <jeffbrown@google.com> Refactor key code mapping.

Added handling for EV_MSC / MSC_SCAN which typically reports
the HID usage associated with a key. This will enable key maps
to map keys with HID usages that Linux does not natively recognize.

Removed keyCode and flags fields from EventHub RawEvent since
they don't necessarily make sense in isolation now that we
pay attention to HID usage codes too.

Removed the fallback code for mapping keys and axes. In practice,
an input device should be self-sufficient. We should not ever
need to look at the built-in keyboard's key map. In fact, there
usually isn't a built-in keyboard anyhow. This code was originally
working around a problem where we weren't loading the key map
for touch screens with virtual keys, which has long since been fixed.

Change-Id: I0a319bdec44be9514f795526347397e94d53a127
/frameworks/base/services/input/InputReader.cpp
9f25b7fdf216c9ef0bd2322cd223eeaf0d60f77f 10-Apr-2012 Jeff Brown <jeffbrown@google.com> Request key maps from input manager service.

Instead of each application loading the KeyCharacterMap from
the file system, get them from the input manager service as
part of the InputDevice object.

Refactored InputManager to be a proper singleton instead of
having a bunch of static methods.

InputManager now maintains a cache of all InputDevice objects
that it has loaded. Currently we never invalidate the cache
which can cause InputDevice to return stale motion ranges if
the device is reconfigured. This will be fixed in a future change.

Added a fake InputDevice with ID -1 to represent the virtual keyboard.

Change-Id: If7a695839ad0972317a5aab89e9d1e42ace28eb7
/frameworks/base/services/input/InputReader.cpp
e38fdfae9196afd1bdc14c5ec6c12793af1e2550 06-Apr-2012 Jeff Brown <jeffbrown@google.com> Add a unique input device descriptor.

The purpose of the input device descriptor is to make it possible
to associate persistent settings for each input device, such as the
keyboard layout.

The descriptor is a hash of the information we have about the
device, such as its vendor id, product id, unique id, name,
or location.

Bug: 6110399
Change-Id: Idb80f946819b3f0dbf4e661bb0a753dbc2b60981
/frameworks/base/services/input/InputReader.cpp
b93a03f841d93498bfea6cc92a22faa34bce1337 18-Feb-2012 Mathias Agopian <mathias@google.com> frameworks/base refactoring.

First step. Move libui includes to their new home: androidfw.

Change-Id: Ic042b52fdba72f30edc3cc6339bf30b4c1b99662
/frameworks/base/services/input/InputReader.cpp
112b5f52c5a4b6743eeb7b26a8896c7636c74455 28-Jan-2012 Jeff Brown <jeffbrown@google.com> Improve watchdog monitor for InputReader and InputDispatcher.

Try harder to test for liveness. There are situations where
the lock might not be held but the input system is stuck in
a callback into the window manager policy that has hung.

Bug: 5094994
Change-Id: Iff88655512a5dc8bbb4615be65f4115e975c020b
/frameworks/base/services/input/InputReader.cpp
f68633da3ced654a9344b5c3b82f4d1c79b6bd09 09-Jan-2012 Steve Block <steveblock@google.com> Rename LOG_ASSERT to ALOG_ASSERT

Change-Id: Ie2c7ea6560656d65bad791a61996174c75677517
/frameworks/base/services/input/InputReader.cpp
a51f0e707f1f3142358aa919ea60ad2842803139 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF)

Change-Id: I8fbdfa7a7581f481968dbb65aa40f7042936d7cb
/frameworks/base/services/input/InputReader.cpp
933e85615059b85a87747da57288384541cc56da 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF)

Change-Id: I26f76452ac49e2890b14d133c065493d8df0fb4a
/frameworks/base/services/input/InputReader.cpp
1afd5bab4e0eaba8b5bc2ab5c7b556cd602cf2e7 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF)

Change-Id: I44f267700356967dc51e8f85ebf457dc85cfb229
/frameworks/base/services/input/InputReader.cpp
ec193dec4d9ca2cfc8295c4becfe950a906a15ed 09-Jan-2012 Steve Block <steveblock@google.com> Rename LOG_ASSERT to ALOG_ASSERT DO NOT MERGE

See https://android-git.corp.google.com/g/157519

Bug: 5449033
Change-Id: I8ceb2dba1b031a0fd68d15d146960d9ced62bbf3
/frameworks/base/services/input/InputReader.cpp
8564c8da817a845353d213acd8636b76f567b234 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/base/services/input/InputReader.cpp
6215d3ff4b5dfa52a5d8b9a42e343051f31066a5 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
/frameworks/base/services/input/InputReader.cpp
5baa3a62a97544669fba6d65a11c07f252e654dd 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
/frameworks/base/services/input/InputReader.cpp
221096fdd6963a0f7090b928cfb92b9267f32d7a 16-Nov-2011 Jeff Brown <jeffbrown@google.com> am 4c0e0dd2: am 3e7497b4: Merge "Eliminate hw.keyboards system properties." into ics-mr1

* commit '4c0e0dd29dcce33e7521b11d01d21d9431f3b264':
Eliminate hw.keyboards system properties.
1e08fe90df18930691b0c2ec22e5db25d7fcb4cf 16-Nov-2011 Jeff Brown <jeffbrown@google.com> Eliminate hw.keyboards system properties.

Stop using system properties to publish information about
the key character map path. Instead, we can retrieve it
on demand by asking the window manager.

It was possible to exhaust the supply of system properties
when repeatedly adding and removing input devices.

Bug: 5532806
Change-Id: Idd361a24ad7db2edc185c8546db7fb05f9c28669
/frameworks/base/services/input/InputReader.cpp
fbca596721ea19daa2972639095898ce62100490 14-Nov-2011 David Deephanphongs <dpanpong@google.com> Modify getState to prefer AKEY_STATE_DOWN and AKEY_STATE_UP over AKEY_STATE_UNKNOWN.

For the getState() routines that operate on multiple devices / mappers:
Return AKEY_STATE_DOWN (or AKEY_STATE_VIRTUAL) if any of the devices/mappers
have the key down.
Otherwise, return AKEY_STATE_UP if at least one device/mapper returns AKEY_STATE_UP.
Otherwise, return AKEY_STATE_UNKNOWN.

Change-Id: I1ef6251d73af916b51f408a41c5e4adf5bdc237a
/frameworks/base/services/input/InputReader.cpp
9ee285afe740ff13d176c9d8430979dfd9575a23 31-Aug-2011 Jeff Brown <jeffbrown@google.com> Support composite touch / joystick devices better.

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
/frameworks/base/services/input/InputReader.cpp
8d3feb6292ba7e87adeb4982e8cf27114a8ee2e4 29-Aug-2011 Jeff Brown <jeffbrown@google.com> Merge "Add a "show touches" option for demos and presentations. Bug: 4569045"
deffe07c225c15ce780fad4a500d082f2dbdabea 27-Aug-2011 Jeff Brown <jeffbrown@google.com> Prioritize INPUT_PROP_DIRECT first.

If the device tells us it's really direct, then it's direct.

Change-Id: I83875cf47e865ff6f0def149ad0c68db24d9dc4a
/frameworks/base/services/input/InputReader.cpp
daf4a127ba2af82a3fb477044b872719a0ab1827 27-Aug-2011 Jeff Brown <jeffbrown@google.com> Add a "show touches" option for demos and presentations.
Bug: 4569045

Change-Id: I8726ea292dd7def790a5e40d7d7e58968974f896
/frameworks/base/services/input/InputReader.cpp
c28306ad4ac9ce7a7d5f10c2e38d422ffc309a1f 24-Aug-2011 Jeff Brown <jeffbrown@google.com> Improve input device wake heuristics.
Bug: 5205674

Only wake the device on positive interactions from the user
such as button presses, movement, initial touch down events.
In particular, do not wake the device on up events since the
driver might synthesize them on power off, causing the device
to wake up again for no good reason.

Change-Id: I767f553ea36d110e6f3a10611b324487ba7d880d
/frameworks/base/services/input/InputReader.cpp
ea6892e02e10a57673a42f0922ad28694595dcaa 24-Aug-2011 Jeff Brown <jeffbrown@google.com> Support BTN_TOOL_*TAP as synonyms for BTN_TOOL_FINGER.
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
/frameworks/base/services/input/InputReader.cpp
a66cee134e2ad8a6d100e0e3eefa2c2a341ed7cc 20-Aug-2011 Jeff Brown <jeffbrown@google.com> Fix tap gesture on touch pads.

Change-Id: I92b23e5971d4b98b173aacd64fe03ce9f0755c88
/frameworks/base/services/input/InputReader.cpp
65fd251c3913fc921468a3dad190810db19eb9df 18-Aug-2011 Jeff Brown <jeffbrown@google.com> Input system bug fixes, particularly for stylus.
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
/frameworks/base/services/input/InputReader.cpp
8bcbbefa3b4e149099b2057547543ea95a7be400 12-Aug-2011 Jeff Brown <jeffbrown@google.com> Exorcise notification panel ghosts.
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
/frameworks/base/services/input/InputReader.cpp
a1f89ceec076392da409e9f389b33e62e1d92da6 11-Aug-2011 Jeff Brown <jeffbrown@google.com> Improve touch device configuration.
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
/frameworks/base/services/input/InputReader.cpp
89ef0720ee8e0ac6ae1758faa917e4d6c9606fb4 11-Aug-2011 Jeff Brown <jeffbrown@google.com> Add input system to Watchdog.
Bug: 5094994

Change-Id: I153866958efc64ac19bda8b997c1c9f6ad425ec4
/frameworks/base/services/input/InputReader.cpp
d87c6d5fd5e620ecb1a7a401d2b31c6cf2e1a851 10-Aug-2011 Jeff Brown <jeffbrown@google.com> Use BTN_TOUCH or BTN_TOOL_* to determine if touch active.
Bug: 5064702

Should not include stylus buttons in the condition.

Change-Id: If4d78a875b77da8bd59672d6fdbf5353004d0023
/frameworks/base/services/input/InputReader.cpp
be1aa8250cee7819c49741e819e81659d1d03823 28-Jul-2011 Jeff Brown <jeffbrown@google.com> Refactor input reader to add stylus support.
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
/frameworks/base/services/input/InputReader.cpp
bc68a59c024bdb745dac8e2ec7408a9f30595f1a 25-Jul-2011 Jeff Brown <jeffbrown@google.com> Report the external display size to the input reader.

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
/frameworks/base/services/input/InputReader.cpp
49754db5a304d995c1cc108ff6f19e4ba4265572 02-Jul-2011 Jeff Brown <jeffbrown@google.com> Handle stylus buttons and tool types.

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
/frameworks/base/services/input/InputReader.cpp
44e504e089b7483448c386741c5ee31d2c325400 22-Jul-2011 Jeff Brown <jeffbrown@google.com> Drop hack for drivers that emit zero ABS_MT_TOUCH_MAJOR.
Bug: 5064702

When using Linux MT Protocol A, drivers are supposed to omit
fingers that go up and to send an empty sync with no fingers
(can be just an SYN_MT_REPORT / SYN_REPORT) when no fingers
remain.

This makes Android more compliant with the protocol standard.

Change-Id: I5775feb14ab7db015824a32b1e2c015da239385d
/frameworks/base/services/input/InputReader.cpp
612891e07bf578a6c4e1b08200f21d8d861ab5ec 16-Jul-2011 Jeff Brown <jeffbrown@google.com> Add support for orientationAware touch pads.
Bug: 5038388

Change-Id: I9c571b1542299334d2d64c5b33e456ec20ebc0ae
/frameworks/base/services/input/InputReader.cpp
6069139356ceb4d257f749954a2220b1f4fbf9cb 16-Jul-2011 Jeff Brown <jeffbrown@google.com> Remove more edge flag cruft.

Change-Id: I4f9f4f4cc7c771a918aee82a941a3e86ecfe48fe
/frameworks/base/services/input/InputReader.cpp
a6111377e1edbc5d63fc2a7205d58b2d9c21d978 15-Jul-2011 Jeff Brown <jeffbrown@google.com> Remove edge slop support.

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
/frameworks/base/services/input/InputReader.cpp
a4d1bc517207d7ca8d56f0004cd04f0f1dd4567d 02-Jul-2011 Jeff Brown <jeffbrown@google.com> Drop obsolete touch screen hacks.

Change-Id: I47354c37ee2cc2b36340eb709bb5043b3ba78ed9
/frameworks/base/services/input/InputReader.cpp
6894a2947eb1f9d499fd7f1a1ec4e7098e07d25d 02-Jul-2011 Jeff Brown <jeffbrown@google.com> Workaround apps that make assumptions about pointer ids.

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
/frameworks/base/services/input/InputReader.cpp
2717eff2ac04bed60e5fd577bcb8ec1ea7c2ccde 01-Jul-2011 Jeff Brown <jeffbrown@google.com> Query input device for initial slot index.

This fixes a problem where touches can get stuck because the
driver and the framework have different ideas of what the
initial slot index is. The framework assumed it was slot 0
but it could in principle be any slot, such as slot 1. When
that happened, the framework would start tracking the first
touch as slot 0, but it might never receive an "up" for that slot.

Change-Id: Idaffc4534b275d66b9d4360987b28dc2d0f63218
/frameworks/base/services/input/InputReader.cpp
2e45fb6f951d0e0c68d4211fe68108d2230814bc 30-Jun-2011 Jeff Brown <jeffbrown@google.com> Fix joystick and trackpad regression.

Change-Id: I33b6756f95a6b0725ffa210f341da3c98426491b
/frameworks/base/services/input/InputReader.cpp
aba321aa6f1be57beac70bd540812eea1c8262c5 29-Jun-2011 Jeff Brown <jeffbrown@google.com> Add some logging code to track down touch issues.

Change-Id: I9bd7af6b93f82a83c6863986d21e7a222d97e4ae
/frameworks/base/services/input/InputReader.cpp
8134681b25dfff814ffeaad8ff70e84316c1869f 29-Jun-2011 Jeff Brown <jeffbrown@google.com> Improve input event consistency invariants.

Fixed some issues where inconsistent streams of events could
be generated by the dispatcher, particularly when switching from
hovering with one device to hovering with another.

Fixed a bug where the touch pad would fail to generate a new
HOVER_MOVE following a tap event. As a result, the hover event
stream would not resume until the user touched the touch pad
again.

Change-Id: I444dce84641fb12e56a0af84c931520771d6c493
/frameworks/base/services/input/InputReader.cpp
53ca3f13e70fda98aa9f39bb0c15afaf435e3904 28-Jun-2011 Jeff Brown <jeffbrown@google.com> Hover and stylus API cleanup.

Added missing setOnHoverListener method.
Removed BUTTON_STATE_ERASER.

Change-Id: I5d820d0a8e47fe5fd2d88e9fd9fc3fc6ce0dea0d
/frameworks/base/services/input/InputReader.cpp
474dcb5c3ddff737c4ac9fc44a1f7be569605e5f 15-Jun-2011 Jeff Brown <jeffbrown@google.com> Add support for disabling pointer gestures.

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
/frameworks/base/services/input/InputReader.cpp
93fa9b30b91f75ee161d0791ff17f98d1a603812 15-Jun-2011 Jeff Brown <jeffbrown@google.com> EventHub code cleanup.

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
/frameworks/base/services/input/InputReader.cpp
b3a2d1330716812784aee91b6d6275764b5e4210 13-Jun-2011 Jeff Brown <jeffbrown@google.com> Take advantage of updated linux/input.h kernel headers.

Change-Id: I72d2ef82de5c504d46b0cdb57aa43bbd0d769174
/frameworks/base/services/input/InputReader.cpp
9429e6ebe427e1bde01391d53f323ec33d540a14 09-Jun-2011 Jeff Brown <jeffbrown@android.com> am 92110af2: am 5f0b1721: am 25bd8abc: Merge "Fix swipe gesture cosine calculation. Bug: 4124987" into honeycomb-mr2

* commit '92110af24a9a93b73264560b57f55f45ec65dab5':
Fix swipe gesture cosine calculation. Bug: 4124987
051e8f2bfa3ada8ee64d8a4f4d69ad9286209516 08-Jun-2011 Jeff Brown <jeffbrown@android.com> am 55cc25c1: am 797dc698: am b92dcf9c: Merge "Simplify spot tracking logic. Bug: 4124987" into honeycomb-mr2

* commit '55cc25c12c45e8ffb65d2275cc0b6941b68db9df':
Simplify spot tracking logic. Bug: 4124987
774ed9d9537c15482e8baca2f2890c5d2f4ffe75 08-Jun-2011 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of 8b2c0014 to master

Change-Id: I33a5a2949dc6c2d09e8196ba8c7128caa7ac2361
6674d9bf0a53387df0cf8482458cf5f9ab274ec0 08-Jun-2011 Jeff Brown <jeffbrown@android.com> Fix swipe gesture cosine calculation.
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
/frameworks/base/services/input/InputReader.cpp
cb5ffcf0e41d2597401208221c61589547a00f3d 07-Jun-2011 Jeff Brown <jeffbrown@android.com> Simplify spot tracking logic.
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
/frameworks/base/services/input/InputReader.cpp
bb3fcba0caf697f1d238a2cbefdf1efe06eded99 07-Jun-2011 Jeff Brown <jeffbrown@android.com> Touch pad improvements.
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
/frameworks/base/services/input/InputReader.cpp
b12682270aebc110c9518bddae7a8aecc070cad7 04-Jun-2011 Jeff Brown <jeffbrown@google.com> Use pointer mode instead of spots for SEMI_MT touch pads.

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
/frameworks/base/services/input/InputReader.cpp
7218d830e27d81141588cd6e37f206d141a18f62 04-Jun-2011 Jeff Brown <jeffbrown@google.com> resolved conflicts for merge of ca2b552d to master

Change-Id: I2f3693a59042ac5aa2d7bcdc3a504c78dc99a18b
a742f854901b8306d3696c9e9b7881c207130a01 04-Jun-2011 Jeff Brown <jeffbrown@android.com> am 56503b8d: am 8186a5f0: am 10c3f367: Merge "Implement pointer acceleration." into honeycomb-mr2

* commit '56503b8ddfe5c82407da32e18061e725f668432d':
Implement pointer acceleration.
f3b57def9345d6d3cac3604d6a970f6d48f345ec 03-Jun-2011 Dianne Hackborn <hackbod@google.com> resolved conflicts for merge of 7e193916 to master

Change-Id: If06892419319c3a2d4ab6b03dd3ceb99b83803b5
60a126a4c8f3bd1a36feb567ddd02a01ab298d54 03-Jun-2011 Jeff Brown <jeffbrown@google.com> Merge "Fix ABS_MT_SLOT handling."
441a9c28f5831974905a3aee238d741461138ed5 03-Jun-2011 Jeff Brown <jeffbrown@google.com> Fix ABS_MT_SLOT handling.

Shouldn't reset the current slot index to 0 after each SYN_REPORT.

Change-Id: I370e4770f8ae0ce598369ecbaf64772c13e02d46
/frameworks/base/services/input/InputReader.cpp
1a84fd1fb7a51f3fe4f8865e1cdd09f3490f696c 02-Jun-2011 Jeff Brown <jeffbrown@android.com> Add a preference panel for mouse speed.

Bug: 4124987
Change-Id: I3ce175d268a1d043cf5878481261b1049a15a149
/frameworks/base/services/input/InputReader.cpp
19c97d46fb57f87ff45d9e6ea7122b4eb21ede8c 01-Jun-2011 Jeff Brown <jeffbrown@android.com> Implement pointer acceleration.

Bug: 4124987
Change-Id: I1f31a28f1594c55302ccabe13fe3ca6d2ff71d50
/frameworks/base/services/input/InputReader.cpp
b530abcff5ae8e5ebb75ec6aa42b7c7c190e98a5 01-Jun-2011 Jeff Brown <jeffbrown@android.com> am 3f5b95b0: am a4e74744: am fa574c0e: Merge "Touch pad UX improvements." into honeycomb-mr2

* commit '3f5b95b05efcf7ab2e8f193649b841dc1786f2ef':
Touch pad UX improvements.
214eaf48878bba00cbd5831871bcbd82632b6e34 27-May-2011 Jeff Brown <jeffbrown@android.com> Use ViewConfiguration to seed input system configuration.

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
/frameworks/base/services/input/InputReader.cpp
4e3f7206eb0af14d3da4c03bdf9918161774e726 01-Jun-2011 Jeff Brown <jeffbrown@android.com> Button state should reflect actual buttons. (DO NOT MERGE)

Bug: 4124987
Change-Id: If0585bd1432c8c61ed0c9a6a4f6de4a62e3f6e53
/frameworks/base/services/input/InputReader.cpp
538881e18323a0c983bd8809f8c3b1cdeeeab8a6 26-May-2011 Jeff Brown <jeffbrown@android.com> Touch pad UX improvements.

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
/frameworks/base/services/input/InputReader.cpp
b416e241db85b678cdfcdee1c74a7f356a5554ef 25-May-2011 Jeff Brown <jeffbrown@android.com> Fix bug reporting presence of orientation axis. (DO NOT MERGE)

Change-Id: I20aecca392d2843601e6e0ec4ac913c8ccdbbf89
/frameworks/base/services/input/InputReader.cpp
325bd07b311f8ba68079000e9fe8afbcc076d7b6 20-Apr-2011 Jeff Brown <jeffbrown@google.com> Add tap/drag touchpad gesture. (DO NOT MERGE)

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
/frameworks/base/services/input/InputReader.cpp
86ea1f5f521981d075aef56f11693e4f3bc32fdb 13-Apr-2011 Jeff Brown <jeffbrown@google.com> Initial checkin of spot presentation for touchpad gestures. (DO NOT MERGE)

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
/frameworks/base/services/input/InputReader.cpp
dbf8d27f4c32e20e132e90ad713c6ebaf71d7756 19-Mar-2011 Jeff Brown <jeffbrown@google.com> Optimize EventHub to process events in big chunks. (DO NOT MERGE)

When 10 fingers are down, reduces the CPU time spent by the InputReader
thread from ~30% to ~5% on Stingray.

Change-Id: I42ee5c67b8521af715cbab43e763a4af4eb1f914
/frameworks/base/services/input/InputReader.cpp
9f2106f2bcbb82cd2d8a80f24ab0cdafeb6b5d8f 24-May-2011 Jeff Brown <jeffbrown@google.com> Disable pointer debug logging.

Change-Id: I00628fa369cb1b179a1907f9cb19de8ca4c755ab
/frameworks/base/services/input/InputReader.cpp
80fd47ce75253dcdc2cfa85d7a3f42634b923a47 24-May-2011 Jeff Brown <jeffbrown@google.com> Input device protocol enhancements.

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
/frameworks/base/services/input/InputReader.cpp
68d6075b4ad2205c10064c78cde552e3210cca91 17-Mar-2011 Jeff Brown <jeffbrown@google.com> Refactor how timeouts are calculated. (DO NOT MERGE)

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
/frameworks/base/services/input/InputReader.cpp
96ad3979f328a1aa098917ca1c35575e85345526 10-Mar-2011 Jeff Brown <jeffbrown@google.com> Use touch pad gestures to manipulate the pointer. (DO NOT MERGE)

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
/frameworks/base/services/input/InputReader.cpp
fe9f8ab03a63b1037f07dd85799fbea80ec6adaa 07-May-2011 Jeff Brown <jeffbrown@google.com> Add initial API for stylus and mouse buttons.

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
/frameworks/base/services/input/InputReader.cpp
79ac969d7a84b7198f9ed814cc0b2f0b7e11a662 20-Apr-2011 Jeff Brown <jeffbrown@google.com> Add tap/drag touchpad gesture.

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
/frameworks/base/services/input/InputReader.cpp
2352b978a3c94cd88f41d0d908f961333fdac1e9 13-Apr-2011 Jeff Brown <jeffbrown@google.com> Initial checkin of spot presentation for touchpad gestures.

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
/frameworks/base/services/input/InputReader.cpp
b6110c2de0cd7950360aeb2c248a44e4ea5f33f5 02-Apr-2011 Jeff Brown <jeffbrown@google.com> Fix dispatcher crash when input monitoring enabled.
Also ensure that we actually log assertion failures.

Bug: 4203092
Change-Id: I5c14bc41b2255f876858121f5572e2de75cabcc3
/frameworks/base/services/input/InputReader.cpp
a032cc008618b83ecbbede537517d1e7998e3264 08-Mar-2011 Jeff Brown <jeffbrown@google.com> Add MotionEvent.HOVER_ENTER and HOVER_EXIT.

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
/frameworks/base/services/input/InputReader.cpp
b7198743ab3976b30d4655c1e065ca33e372b6af 19-Mar-2011 Jeff Brown <jeffbrown@google.com> Optimize EventHub to process events in big chunks.

When 10 fingers are down, reduces the CPU time spent by the InputReader
thread from ~30% to ~5% on Stingray.

Change-Id: Icdf7c91cd5d9039ac3beb38ba9021a05e7fabc80
/frameworks/base/services/input/InputReader.cpp
aa3855d5836d2a2d83baafdf6e40caf90d3dad1c 17-Mar-2011 Jeff Brown <jeffbrown@google.com> Refactor how timeouts are calculated.

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
/frameworks/base/services/input/InputReader.cpp
ace13b17866dc9136aeecf6dfaf7077f37434469 10-Mar-2011 Jeff Brown <jeffbrown@google.com> Use touch pad gestures to manipulate the pointer.

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
/frameworks/base/services/input/InputReader.cpp
efd3266b719eed5f1b217021c0a9e76e4b274b06 09-Mar-2011 Jeff Brown <jeffbrown@google.com> Input improvements and bug fixes.

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
/frameworks/base/services/input/InputReader.cpp
9e8e40cb5f8aeb0702002eee60d1ce394bf699ee 03-Mar-2011 Jeff Brown <jeffbrown@google.com> Recognize 3D joysticks. (DO NOT MERGE)

Change-Id: Idf7799ea90fa07677850d40ee1aec39220ded372
/frameworks/base/services/input/InputReader.cpp
9626b14a283ef82d16636cf5fb5ba8bb4d30381e 03-Mar-2011 Jeff Brown <jeffbrown@google.com> Fix off by one errors in touch motion ranges. (DO NOT MERGE)

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
/frameworks/base/services/input/InputReader.cpp
924c4d47774fa7d8a5ce659d12291ef7df82ee05 08-Mar-2011 Jeff Brown <jeffbrown@google.com> Support POLICY_FLAG_ALT et. al. (DO NOT MERGE)

Change-Id: Ida3b8300764623662052f80095973186cb9d4616
/frameworks/base/services/input/InputReader.cpp
8529745b27877d98a0c76692295a3fcac238b1e6 04-Mar-2011 Jeff Brown <jeffbrown@google.com> Joystick tweaks. (DO NOT MERGE)

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
/frameworks/base/services/input/InputReader.cpp
56194ebec6212e229f4ccdaa4b187166d20013ef 03-Mar-2011 Jeff Brown <jeffbrown@google.com> Wake screen from external HID peripherals.

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
/frameworks/base/services/input/InputReader.cpp
05dc66ada6b61a6bdf806ffaa62617ac5394695d 02-Mar-2011 Jeff Brown <jeffbrown@google.com> Fade out the mouse pointer after inactivity or other events.

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
/frameworks/base/services/input/InputReader.cpp
33bbfd2232ea9eaae9a9d87a05a95a430f09bd83 25-Feb-2011 Jeff Brown <jeffbrown@google.com> Add support for mouse hover and scroll wheel.

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
/frameworks/base/services/input/InputReader.cpp
cc0c159e9b3dd4e0f48da0ce3e33d2c68a651413 19-Feb-2011 Jeff Brown <jeffbrown@google.com> Add new hover move action and scroll wheel plumbing.

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
/frameworks/base/services/input/InputReader.cpp
6f2fba428ca5e77a26d991ad728e346cc47609ee 19-Feb-2011 Jeff Brown <jeffbrown@google.com> Add new axes for joysticks and mouse wheels.

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
/frameworks/base/services/input/InputReader.cpp
ebbd5d14ad3b1e762d9fcfa026e19413cc857e05 17-Feb-2011 Jeff Brown <jeffbrown@google.com> Fix a regression with MotionEvent parceling.

Also added some more unit tests.

Change-Id: I413654294d1a998eec056884e6df5eaa50f3daf4
/frameworks/base/services/input/InputReader.cpp
91c69ab01539f7ba28708f41ec1835cc2920d0a0 15-Feb-2011 Jeff Brown <jeffbrown@google.com> Add support for arbitrary axes in MotionEvents.

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
/frameworks/base/services/input/InputReader.cpp
c3451d4a4479b6244bd6d1dadf289a8d44bdcca2 16-Feb-2011 Jeff Brown <jeffbrown@google.com> Scale major axis when finger is oriented.

Change-Id: I281ec25478b4ceffa6ed5a41cb44a7e81d18d8dc
/frameworks/base/services/input/InputReader.cpp
ab2f09603079534b53499864a403d0ba16aad13b 26-Jan-2011 Jeff Brown <jeffbrown@google.com> am 12b2dc90: am b1e0a870: Merge "Fix crashes caused by some input devices." into honeycomb

* commit '12b2dc90883ef4f930a17907acdef3677b0598a5':
Fix crashes caused by some input devices.
58a2da843f2f22f406df8df1f011738eb8b7fcb1 26-Jan-2011 Jeff Brown <jeffbrown@google.com> Fix crashes caused by some input devices.

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
/frameworks/base/services/input/InputReader.cpp
e155bd0fcb57fa96c4a7b5cc70205d53acf41291 20-Jan-2011 Jeff Brown <jeffbrown@google.com> am 5f668c6e: am 8b9df978: Merge "Fix getSwitchState." into honeycomb

* commit '5f668c6e6bb2515325632691a804a7c8f24ebb09':
Fix getSwitchState.
89de57a8d252a25ef2412a11a66089a9ff6ffe29 20-Jan-2011 Jeff Brown <jeffbrown@google.com> Fix getSwitchState.

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
/frameworks/base/services/input/InputReader.cpp
7cca7e0b28679cf09ce6b56687c3a9679a6c7296 19-Jan-2011 Jeff Brown <jeffbrown@google.com> am 761a6b7f: am f4368c95: Merge "Filter virtual keys after touches." into honeycomb

* commit '761a6b7fdbe2bcc6db4306af9705dcb22b036068':
Filter virtual keys after touches.
fe50892af3b365806a767298dfd8e86447682581 19-Jan-2011 Jeff Brown <jeffbrown@google.com> Filter virtual keys after touches.

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
/frameworks/base/services/input/InputReader.cpp
cb1404e45639d20439d7700b06d57ca1a1aad1fa 16-Jan-2011 Jeff Brown <jeffbrown@google.com> Add joystick support to framework.

Change-Id: I95374436708752e1a9cff3f85c5b9bc3e0987961
/frameworks/base/services/input/InputReader.cpp
517bb4c859a2bb8d30316204f39bf5b6c89c3e4d 15-Jan-2011 Jeff Brown <jeffbrown@google.com> Add support for detecting finger orientation.

Change-Id: I901fc61f7705fcd7950190dc8782bad616032ee2
/frameworks/base/services/input/InputReader.cpp
1c9d06e0470c41e2720c65be076b6080bf8595c0 15-Jan-2011 Jeff Brown <jeffbrown@google.com> Fix bug with mice that send multiple BTN_MOUSE values.

Some mice send different values for BTN_MOUSE key events
when the button is held down (2 for repeat, instead of 1 for down).

Change-Id: I803db1f1584f50f8f5e1d37b6a715e2e1b3943a6
/frameworks/base/services/input/InputReader.cpp
b4ff35df5c04aec71fce7e90a6d6f9ef7180c2ad 03-Jan-2011 Jeff Brown <jeffbrown@google.com> Mouse pointer integration.

Added support for loading the pointer icon from a resource.

Moved the system server related bits of the input manager out
of libui and into libinput since they do not need to be linked into
applications.

Change-Id: Iec11e0725b3add2b905c51f8ea2c3b4b0d1a2d67
/frameworks/base/services/input/InputReader.cpp