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
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
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
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
Bug: 5149443
Removed some dead code and unnecessary checks, such as checks
for non-nullity of arrays that used to be dynamically allocated
once upon a time but are now part of the Device object itself.
Change-Id: I531116e816772d7c5030d22da0c8e1d7dcfba778
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
We should use all-makefiles-under instead.
all-subdir-makefiles can be used only before any "include" statement.
Before this change, both subdirs were actually not included.
Change-Id: I6bf35d07f294a5012c9322096f999ac26e37432f
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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