58 Commits

Author SHA1 Message Date
Jeff Brown
905805ad7c Improve screenshot chord debouncing.
Bug: 5011907

Introduce a 150ms delay in handling volume down keys
while waiting to see if a power key will follow.

Don't trigger the screenshot chord if both volume up and
volume down are pressed together.

Don't trigger the long-press power menu if volume keys are
also pressed.

Require the user to press both keys in the chord within
the debounce time and continue long-pressing them in order
to trigger the screenshot action.

Change-Id: I248968d37b73c09d6d08e7f62667c443eba32da0
2011-10-12 14:34:23 -07:00
Jeff Brown
cc4f7db698 Fix input channel leak.
Bug: 5156144

Input channels could leak or simply live longer than they should
in some cases.

1. Monitor channels (used by the pointer location overlay) are never
   unregistered, so they would leak.

   Added code to handle failures in the receive callback by closing
   the input channel.

2. The DragState held onto its input window and application handles
   even after the input channel was disposed.

   Added code to null these handles out when they are no longer needed.

3. Input channels previously used as input event targets would stick
   around until the targets were cleared (usually on the next
   event).

   Added code to detect when the input dispatcher is in
   an idle state and to proactively clear the targets then
   to ensure that resources are released promptly.

4. Native input window handles held onto the input channel even
   after the input window was removed from the input dispatcher.
   Consequently, the input channel would not be disposed until
   the input window handle itself was freed.  Since the input
   window handle is held from managed code, this meant that the
   window's input channel could stick around until the next GC.

   Refactored the input window handle to separate the properties
   (info) and identify (handle) state into different objects.
   Then modified the dispatcher to release the properties (info)
   when no longer needed, including the input channel.

7. The pointer location overlay does not actually use its
   standard input channel, only the monitor input channel.

   Added INPUT_FEATURE_NO_INPUT_CHANNEL to allow windows to
   request that they not be provided with an input channel
   at all.

Improved some of the error handling logic to emit the status
code as part of the exception message.

Change-Id: I01988d4391a70c6678c8b0e936ca051af680b1a5
2011-08-30 21:40:28 -07:00
Jeff Brown
9cc695c579 Clean up InputDispatcher debugging.
Change-Id: I020e834bfb541a1f274e26a72705f96f4307dddf
2011-08-23 18:42:06 -07:00
Jeff Brown
65fd251c39 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
2011-08-19 15:02:26 -07:00
Christopher Tate
755bd67a50 Merge "Don't crash if a drag recipient throws an uncaught exception" 2011-08-16 17:03:24 -07:00
Christopher Tate
d9be36c897 Don't crash if a drag recipient throws an uncaught exception
There turn out to be two distinct bugs leading to runtime restarts.

The first, dating from at least Android 3.1, is that following certain kinds
of app crashes we properly clean up the drag-state bookkeeping, but aren't
prepared in the case of the drag-target timeout clock firing with a now-
null drag state in effect.  We now catch that edge condition and don't NPE
(and note that there was already similar code around the separate timeout
when an app is *starting* the drag process).

The second bug is that some new-in-ICS code in the input channel management
wasn't prepared for certain cases where the current touch window could have
become unusable and its input channel torn down summarily in the case of the
aforesaid app crash during drag.  The code now makes sure that there really
is an input channel that needs to be flushed / cancelled prior to attempting
that operation.

Fixes bug 5173534

Change-Id: Idaae158ecfb4b93456ab1425769b669962893c00
2011-08-16 16:09:33 -07:00
Jeff Brown
abb4d446a1 Fix blocked event handling in InputDispatcher.
Bug: 5161854

The InputDispatcher contains code to recover from ANRs more quickly
when the user touches a different application.  When triggered,
it sets mNextUnblockedEvent to the next event it should dispatch
(to the next application).  All prior events are dropped.

This change fixes a bug where mNextUnblockedEvent could potentially
never be reset back to NULL if the inbound queue was drained
for some reason.

Change-Id: I21be2f02c9fc770bd260ea414db8bb184df89ada
2011-08-15 12:55:32 -07:00
Jeff Brown
89ef0720ee Add input system to Watchdog.
Bug: 5094994

Change-Id: I153866958efc64ac19bda8b997c1c9f6ad425ec4
2011-08-10 16:25:21 -07:00
Jeff Brown
be1aa8250c 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
2011-07-31 15:38:09 -07:00
Jeff Brown
5ea29ab7ef Reset input dispatcher targets when focus changes apps.
This fixes an issue where an ANR can occur in a newly focused
application through no fault of its own, simply because
the previous app took a little while to transfer focus to
the new app.

Bug: 4584620
Change-Id: If3227eb68d92a09a108e9de7f0afcbd9a5dbdead
2011-07-27 11:50:51 -07:00
Jeff Brown
ac386073df Remove unimplemented memory pool.
dlmalloc does such a great job that we don't need a pool anyways.

Change-Id: I105b28c4a5c491543959190c7c0a9de75a5b8052
2011-07-20 15:19:50 -07:00
Jeff Brown
9302c8796f Refactor input dispatcher use of window/app handles.
This change moves the cached window and application input state
into the handle objects themselves.  It simplifies the dispatcher
somewhat because it no longer needs to fix up references to
transient InputWindow objects each time the window list is updated.

This change will also make it easier to optimize setInputWindows
to avoid doing a lot of redundant data copying.  In principle, only
the modified fields need to be updated.  However, for now we
continue to update all fields in unison as before.

It turns out that the input dispatcher was inappropriately retaining
pointers to InputWindow objects within the mWindows InputWindow
vector.  This vector is copy-on-write so it is possible and the
item pointers to change if an editing operation is performed on
the vector when it does not exclusively own the underlying
SharedBuffer.  This bug was uncovered by a previous change that
replaced calls to clear() and appendVector() with a simple use
of operator= which caused the buffer to be shared.  Consequently
after editItemAt was called (which it shouldn't have, actually)
the buffer was copied and the cached InputWindow pointers became
invalid.  Oops.  This change fixes the problem.

Change-Id: I0a259339a6015fcf9113dc4081a6875e047fd425
2011-07-14 04:11:21 -07:00
Jeff Brown
b99a82437c Revert "fix a weird use of Vector::appendVector()"
This reverts commit 198fd888add624cf9e53ce31b776568a5d069916

This change seems to have exposed some other bugs.
Bug: 5026631
2011-07-13 12:51:11 -07:00
Mathias Agopian
198fd888ad fix a weird use of Vector::appendVector()
operator= is way more efficient.

Change-Id: I61c9adb1413bed230801a77151b8f7000fd11471
2011-07-11 16:26:36 -07:00
Jeff Brown
2717eff2ac 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
2011-07-01 02:59:26 -07:00
Jeff Brown
2e45fb6f95 Fix joystick and trackpad regression.
Change-Id: I33b6756f95a6b0725ffa210f341da3c98426491b
2011-06-29 21:19:05 -07:00
Jeff Brown
8134681b25 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
2011-06-28 20:10:40 -07:00
Jeff Brown
474dcb5c3d 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
2011-06-14 22:07:31 -07:00
Jeff Brown
98db5fabda Allow touches to slide out of the navigation bar.
Change-Id: I73cabba3d62f47829bf6217700ace56a27c42b1d
2011-06-13 18:05:18 -07:00
Kenny Root
7a9db181a6 No position information for outside touches
When a window registers to listen for outside touches, it doesn't need
the position information for touches that land outside of its activity
for normal use cases.

This patch uses the foreground window's UID as a filter to determine
whether to pass the position information. This will allow applications
to continue to rely on touch information for inputs that were directed
at one of its other windows.

Bug: 4541250
Change-Id: If16eb1ec8404b797d991859eef55ac0a20a355a3
2011-06-10 22:53:16 -07:00
Dianne Hackborn
f3b57def93 resolved conflicts for merge of 7e193916 to master
Change-Id: If06892419319c3a2d4ab6b03dd3ceb99b83803b5
2011-06-03 12:26:54 -07:00
Jeff Brown
214eaf4887 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
2011-05-31 15:00:59 -07:00
Jeff Brown
2cb7981e70 Fix deadlock in dispatcher. (DO NOT MERGE)
This regression was caused due to a bad cherry-pick / merge.

Change-Id: I79e84285bbfd4cd4b66681461543fb185b60d3ba
2011-05-25 18:53:49 -07:00
Jeff Brown
5ced76a143 Coalesce input events that arrive faster than 333Hz. (DO NOT MERGE)
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.

Change-Id: Ibc6abf8af027d9003011ac75caa12941080caba3
2011-05-25 14:37:16 -07:00
Jeff Brown
7157f6fe13 Allow batching samples onto the pending motion event. (DO NOT MERGE)
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: I8870cc3081d27a4de659fb4e375f888fe966460b
2011-05-25 14:37:15 -07:00
Jeff Brown
524ee64b91 Support chorded fallback keys. (DO NOT MERGE)
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: I043f82913830f411b3bb4018d6422467b6ca454f
2011-05-24 15:21:46 -07:00
Jeff Brown
22d789d580 Fix focused application handle. (DO NOT MERGE)
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: Ice7ce3a2b65219568a8227fc1383bafb294666b5
2011-05-24 15:21:46 -07:00
Jeff Brown
68d6075b4a 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
2011-05-23 17:20:42 -07:00
Jeff Brown
96ad3979f3 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
2011-05-23 17:19:38 -07:00
Jeff Brown
fe9f8ab03a 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
2011-05-13 12:11:17 -07:00
Dianne Hackborn
2ba3e80f94 resolved conflicts for merge of 037b54cf to master
Change-Id: I1bc2827596a349963d8aa2b63b3f7801f155668a
2011-05-11 10:59:54 -07:00
Dianne Hackborn
e7d25b74b0 Fix scaling of batched motion events.
Change-Id: I1e070c936f7b2e8f1bb7ebae62b1df0aa6998b82
2011-05-09 21:19:26 -07:00
Dianne Hackborn
aa9d84c37e resolved conflicts for merge of 05be6d6f to master
Change-Id: Ic6a6c5bb300f6f1d43f9ed550b284282b4f16212
2011-05-09 19:00:59 -07:00
Dianne Hackborn
e2515eebf4 Better compat mode part one: start scaling windows.
First step of improving app screen size compatibility mode.  When
running in compat mode, an application's windows are scaled up on
the screen rather than being small with 1:1 pixels.

Currently we scale the application to fill the entire screen, so
don't use an even pixel scaling.  Though this may have some
negative impact on the appearance (it looks okay to me), it has a
big benefit of allowing us to now treat these apps as normal
full-screens apps and do the normal transition animations as you
move in and out and around in them.

This introduces fun stuff in the input system to take care of
modifying pointer coordinates to account for the app window
surface scaling.  The input dispatcher is told about the scale
that is being applied to each window and, when there is one,
adjusts pointer events appropriately as they are being sent
to the transport.

Also modified is CompatibilityInfo, which has been greatly
simplified to not be so insane and incomprehendible.  It is
now simple -- when constructed it determines if the given app
is compatible with the current screen size and density, and
that is that.

There are new APIs on ActivityManagerService to put applications
that we would traditionally consider compatible with larger screens
in compatibility mode.  This is the start of a facility to have
a UI affordance for a user to switch apps in and out of
compatibility.

To test switching of modes, there is a new variation of the "am"
command to do this: am screen-compat [on|off] [package]

This mode switching has the fundamentals of restarting activities
when it is changed, though the state still needs to be persisted
and the overall mode switch cleaned up.

For the few small apps I have tested, things mostly seem to be
working well.  I know of one problem with the text selection
handles being drawn at the wrong position because at some point
the window offset is being scaled incorrectly.  There are
probably other similar issues around the interaction between
two windows because the different window coordinate spaces are
done in a hacky way instead of being formally integrated into
the window manager layout process.

Change-Id: Ie038e3746b448135117bd860859d74e360938557
2011-05-09 17:03:24 -07:00
Jeff Brown
4e91a180be Coalesce input events that arrive faster than 333Hz.
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
2011-04-07 13:11:16 -07:00
Jeff Brown
f6989da7c7 Allow batching samples onto the pending motion event.
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
2011-04-06 17:19:48 -07:00
Jeff Brown
b6110c2de0 Fix dispatcher crash when input monitoring enabled.
Also ensure that we actually log assertion failures.

Bug: 4203092
Change-Id: I5c14bc41b2255f876858121f5572e2de75cabcc3
2011-04-01 16:15:13 -07:00
Jeff Brown
0029c66203 Add input filter mechanism for accessibility.
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
2011-03-30 16:55:15 -07:00
Jeff Brown
da3d5a91b6 Support chorded fallback keys.
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
2011-03-29 16:16:55 -07:00
Jeff Brown
a2cc28d732 Fix focused application handle.
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
2011-03-25 15:06:17 -07:00
Jeff Brown
a032cc0086 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
2011-03-24 15:37:04 -07:00
Jeff Brown
aa3855d583 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
2011-03-17 17:29:09 -07:00
Jeff Brown
ace13b1786 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
2011-03-14 14:12:03 -07:00
Jeff Brown
efd3266b71 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
2011-03-09 18:30:28 -08:00
Jeff Brown
924c4d4777 Support POLICY_FLAG_ALT et. al. (DO NOT MERGE)
Change-Id: Ida3b8300764623662052f80095973186cb9d4616
2011-03-09 02:46:45 -08:00
makarand.karvekar
f634ded277 Set last event time to previous event batch delivery time to apps
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
2011-03-03 17:01:43 -08:00
Jeff Brown
e2e012683d Only set KeyEvent long press flag when repeat count equals 1.
This fixes a Gingerbread regression.

Bug: 3507021
Change-Id: I8c2acb35be718fea7e996175c1407e84315d17ef
2011-03-02 20:34:30 -08:00
Jeff Brown
56194ebec6 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
2011-03-02 19:57:07 -08:00
Jeff Brown
33bbfd2232 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
2011-02-25 17:06:07 -08:00
Jeff Brown
bfaf3b9170 Be more precise about tracking fallback keys.
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
2011-02-22 15:00:50 -08:00