OSDN Git Service

Implement batching of input events on the consumer side.
authorJeff Brown <jeffbrown@google.com>
Tue, 7 Feb 2012 22:46:57 +0000 (14:46 -0800)
committerJeff Brown <jeffbrown@google.com>
Mon, 13 Feb 2012 18:28:41 +0000 (10:28 -0800)
commitf0490c94d01aa7536e4fd3bdf6a888099ba9a5c6
tree2fe3e4c4f68b1797ac40886986f00e9924358d23
parentcd50850d4825e597b48ff2ad88a8ac33f74ac6cf
Implement batching of input events on the consumer side.

To support this feature, the input dispatcher now allows input
events to be acknowledged out-of-order.  As a result, the
consumer can choose to defer handling an input event from one
device (because it is building a big batch) while continuing
to handle input events from other devices.

The InputEventReceiver now sends a notification when a batch
is pending.  The ViewRoot handles this notification by scheduling
a draw on the next sync.  When the draw happens, the InputEventReceiver
is instructed to consume all pending batched input events, the
input event queue is fully processed (as much as possible),
and then the ViewRoot performs traversals as usual.

With these changes in place, the input dispatch latency is
consistently less than one frame as long as the application itself
isn't stalled.  Input events are delivered to the application
as soon as possible and are handled as soon as possible.  In practice,
it is no longer possible for an application to build up a huge
backlog of touch events.

This is part of a series of changes to improve input system pipelining.

Bug: 5963420

Change-Id: I42c01117eca78f12d66d49a736c1c122346ccd1d
include/ui/InputTransport.h
libs/ui/InputTransport.cpp
libs/ui/tests/InputChannel_test.cpp
libs/ui/tests/InputPublisherAndConsumer_test.cpp