Compute the actual number of indices in the GAMEPAD_KEYCODES instead of
the pure size in bytes.
Bug: 3121536
Change-Id: I71edbd8bf6eff2c8cc0ea5c6845362b3d1e06466
We now poke user activity twice: once upon dequeueing an event
for dispatch and then again just before we dispatch it. The second
poke is to compensate for the fact that it can take a few seconds to
identify the dispatch target (if the application is responding slowly)
but we want to keep the display from going to sleep for X amount of time
after the app gets a chance to actually receive the event. This mirrors
pre-Gingerbread behavior.
Removed some unnecessary code that filters user activity pokes when sending
events to KeyGuard. We don't need this because KeyGuard already tells the
power manager to disable user activity.
Bug: 3101397
Change-Id: I8c3a77601fdef8f584e84cfdd11aa79da0ff51db
This change adds a new window type for secure system overlays
created by the system itself from non-secure system overlays that
might be created by applications that have the system alert permission.
Secure views ignore the presence of secure system overlays.
Bug: 3098519
Change-Id: I8f8398f4fdeb0469e5d71124c21bedf121bd8c07
Added support for calibrating touch size for devices that report
size as an area measurement rather than as a width.
Fixed some bugs.
Bug: 3096045
Change-Id: I30a12e73752883516ed054f8af407204bca45814
Fixed some issues with Monkeys turning off their own screens. Ook ook!
Added some more comments to explain what's going on.
Change-Id: Id2bc0466161a642a73ef7ef97725d1c81e984b12
Added the concept of a "trusted" event to distinguish between events from
attached input devices or trusted injectors vs. other applications.
This change enables us to move certain policy decisions out of the
dispatcher and into the policy itself where they can be handled more
systematically.
Change-Id: I4d56fdcdd31aaa675d452088af39a70c4e039970
This change fixes several issues where events would be dropped in the
input dispatch pipeline in such a way that the dispatcher could not
accurately track the state of the input device.
Given more robust tracking, we can now also provide robust cancelation
of input events in cases where an application might otherwise become
out of sync with the event stream due to ANR, app switch, policy decisions,
or forced focus transitions.
Pruned some of the input dispatcher log output.
Moved the responsibility for calling intercept*BeforeQueueing into
the input dispatcher instead of the input reader and added support for
early interception of injected events for events coming from trusted
sources. This enables behaviors like injection of media keys while
the screen is off, haptic feedback of injected virtual keys, so injected
events become more "first class" in a way.
Change-Id: Iec6ff1dd21e5f3c7feb80ea4feb5382bd090dbd9
This change narrows the opportunity for a race condition setting the
resource Configuration while devices are being updated.
Change-Id: I58efa563f4129ab0fce7108511d16a99dff7e451
Added dumpsys reporting to EventHub.
Made the formatting a bit clearer.
Added 'Locked' suffix to some internal methods of EventHub.
Change-Id: Ic449560bcce378f6361895d27c66854e9724abb0
This feature is currently used to enable dragging the start and end
selection handles of a TextView at the same time. Could be used for
other things later.
Deleted some dead code in ArrowKeyMovementMethod and CursorControllers.
Change-Id: I930accd97ca1ca1917aab8a807db2c950fc7b409
Older glibc version do not include BSD htole32 and htole64 which are
present in bionic. This worksaround a sim-eng build issue by only
using htole32/htole64 if the host is not little endian.
Change-Id: Ia8d0d36285f3c34c51a331790458e52a21c2925f
Redesigned the input dispatcher's ANR timeout mechanism so it is much
closer to Froyo's policy. ANR is only ever signalled if the dispatcher
is waiting on a window to finish processing its previous event(s) and
there is new pending input.
In the old code, we tracked the dispatch timeout separately for each
input channel. This was somewhat complicated and also resulted in the
situation where applications could ANR long after the user had pushed
them into the background.
Change-Id: I666ecada0952d4b95f1d67b9f733842b745c7f4b
As part of this change, consolidated and cleaned up the Looper API so
that there are fewer distinctions between the NDK and non-NDK declarations
(no need for two callback types, etc.).
Removed the dependence on specific constants from sys/poll.h such as
POLLIN. Instead looper.h defines events like LOOPER_EVENT_INPUT for
the events that it supports. That should help make any future
under-the-hood implementation changes easier.
Fixed a couple of compiler warnings along the way.
Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
There are 16 events logged in the event log:
SF_APP_DEQUEUE_BEFORE
SF_APP_DEQUEUE_AFTER
SF_APP_LOCK_BEFORE
SF_APP_LOCK_AFTER
SF_APP_QUEUE
SF_REPAINT
SF_COMPOSITION_COMPLETE
SF_UNLOCK_CLIENTS
SF_SWAP_BUFFERS
SF_REPAINT_DONE
SF_FB_POST_BEFORE
SF_FB_POST_AFTER
SF_FB_DEQUEUE_BEFORE
SF_FB_DEQUEUE_AFTER
SF_FB_LOCK_BEFORE
SF_FB_LOCK_AFTER
all events log the buffer conserned and a timestamp in microseconds.
by default the logging is not enabled, to turn it on:
adb shell service call SurfaceFlinger 1006 i31 1
adb shell setprop debug.graphic_log 1
The effect is immediate in SurfaceFlinger, but applications need to be
restarted.
Change-Id: Ifc2e31f7aed072d9a7dede20ff2ce59231edbec1
This change is essentially a rewrite of the main input dispatcher loop
with the target identification folded in. Since the input dispatcher now
has all of the window state, it can make better decisions about
when to ANR.
Added a .5 second deadline for processing app switch keys. This behavior
predates Gingerbread but had not previously been ported.
Fixed some timing inaccuracies in the ANR accounting that could cause
applications to ANR sooner than they should have.
Added a mechanism for tracking key and motion events that have been
dispatched to a window so that appropriate cancelation events can be
synthesized when recovering from ANR. This change helps to keep
applications in sync so they don't end up with stuck buttons upon
recovery from ANRs.
Added more comments to describe the tricky parts of PollLoop.
Change-Id: I13dffca27acb436fc383980db536abc4d8b9e6f1
Added the MotionEvent.FLAG_WINDOW_IS_OBSCURED flag which is set by the
input manager whenever another visible window is partly or wholly obscured
the target of a touch event so that applications can filter touches
accordingly.
Added a "filterTouchesWhenObscured" attribute to View which can be used to
enable filtering of touches when the view's window is obscured.
Change-Id: I936d9c85013fd2d77fb296a600528d30a29027d2
Finished the input device capability API.
Added a mechanism for calibrating touch devices to obtain more
accurate information about the touch contact area.
Improved pointer location to show new coordinates and capabilities.
Optimized pointer location display and formatting to avoid allocating large
numbers of temporary objects. The GC churn was causing the application to
stutter very badly when more than a couple of fingers were down).
Added more diagnostics.
Change-Id: Ie25380278ed6f16c5b04cd9df848015850383498
The code now takes into account the time when the event was generated.
So with a 60Hz throttling rate, it ensures that a motion event will not
be delayed due to throttling by any more than 1/60th of second past
the time it was generated.
Change-Id: Iaea1d4f76e79036b4a18873485230731c3cd63c3
system_server can potentially monitor uevent devices that are
of no use to it. For instance, an accelerometer implementation
as uevents. This would cause the process to be busy when
unnecessary. If a device cannot be classified, don't monitor it.
Change-Id: Ib2c93105e7d746d9c1a7414bea8bab3fb8c0b70a
On single-touch devices, pointer up/down is signalled by a BTN_TOUCH
key event. Previously we handled BTN_TOUCH immediately but some drivers
may produce the sequence BTN_TOUCH, ABS_X, ABS_Y, SYN_REPORT on pointer down
which caused us to emit a bad initial pointer down location.
Now we wait for SYN_REPORT before reporting the up or down.
On multi-touch devices, pointer up can be signalled by as little as
the sequence SYN_MT_REPORT, SYN_REPORT. This change ensures that we
handle this case.
Added support for reading ABS_MT_PRESSURE when available.
Corrected mapping of touchMajor/touchMinor on single touch devices.
Minor code cleanup.
Change-Id: Ic7ec4811241ed85a06e59b8a839ca05180d491d4
Sometimes the wrong fd was accessed when the device was addressed
by device id.
The earlier implementation assumed that two arrays were in sync
but one of them was compacted when devices were removed. Instead
of that dependency the device now keeps track of it's file descriptor.
Change-Id: Ib0f320603aafb07ded354bc3687de9759c9068f2
Previously, the input dispatcher assumed that the input channel's
receive pipe file descriptor was a sufficiently unique identifier for
looking up input channels in its various tables. However, it can happen
that an input channel is disposed and then a new input channel is
immediately created that reuses the same file descriptor. Ordinarily
this is not a problem, however there is a small opportunity for a race
to arise in InputQueue.
When InputQueue receives an input event from the dispatcher, it
generates a finishedToken that encodes the channel's receive pipe fd,
and a sequence number. The finishedToken is used by the ViewRoot
as a handle for the event so that it can tell the InputQueue when
the event has finished being processed.
Here is the race:
1. InputQueue receives an input event, assigns a new finishedToken.
2. ViewRoot begins processing the input event.
3. During processing, ViewRoot unregisters the InputChannel.
4. A new InputChannel is created and is registered with the Input Queue.
This InputChannel happens to have the same receive pipe fd as
the one previously registered.
5. ViewRoot tells the InputQueue that it has finished processing the
input event, passing along the original finishedToken.
6. InputQueue throws an exception because the finishedToken's receive
pipe fd is registered but the sequence number is incorrect so it
assumes that the client has called finish spuriously.
The fix is to include a unique connection id within the finishedToken so
that the InputQueue can accurately confirm that the token belongs to
the currently registered InputChannel rather than to an old one that
happened to have the same receive pipe fd. When it notices this, it
ignores the spurious finish.
I've also made a couple of other small changes to avoid similar races
elsewhere.
This patch set also includes a fix to synthesize a finished signal
when the input channel is unregistered on the client side to
help keep the server and client in sync.
Bug: 2834068
Change-Id: I1de34a36249ab74c359c2c67a57e333543400f7b
Also fixed bug where old touch screen size could be reported by
getMotionRange if an orientation change occurred but the user has not
yet touched the screen.
Bug: 2877345
Change-Id: I7878f47458f310ed6ebe6a5d1b2c9bec2c598ab9