summaryrefslogtreecommitdiffstats
path: root/libs/ui/tests/InputChannel_test.cpp
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-02-07 14:46:57 -0800
committerJeff Brown <jeffbrown@google.com>2012-02-13 10:28:41 -0800
commit072ec96a4900d4616574733646ee46311cb5d2cb (patch)
tree9172f3e3295f9d4ff3517a47dec360c2f0a99948 /libs/ui/tests/InputChannel_test.cpp
parent1adee11b5e644c74a2ed40344f4836de3bd3ac56 (diff)
downloadframeworks_base-072ec96a4900d4616574733646ee46311cb5d2cb.zip
frameworks_base-072ec96a4900d4616574733646ee46311cb5d2cb.tar.gz
frameworks_base-072ec96a4900d4616574733646ee46311cb5d2cb.tar.bz2
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
Diffstat (limited to 'libs/ui/tests/InputChannel_test.cpp')
-rw-r--r--libs/ui/tests/InputChannel_test.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libs/ui/tests/InputChannel_test.cpp b/libs/ui/tests/InputChannel_test.cpp
index c73dc2f..ee422fe 100644
--- a/libs/ui/tests/InputChannel_test.cpp
+++ b/libs/ui/tests/InputChannel_test.cpp
@@ -90,6 +90,7 @@ TEST_F(InputChannelTest, OpenInputChannelPair_ReturnsAPairOfConnectedChannels) {
InputMessage clientReply;
memset(&clientReply, 0, sizeof(InputMessage));
clientReply.header.type = InputMessage::TYPE_FINISHED;
+ clientReply.body.finished.seq = 0x11223344;
clientReply.body.finished.handled = true;
EXPECT_EQ(OK, clientChannel->sendMessage(&clientReply))
<< "client channel should be able to send message to server channel";
@@ -99,6 +100,8 @@ TEST_F(InputChannelTest, OpenInputChannelPair_ReturnsAPairOfConnectedChannels) {
<< "server channel should be able to receive message from client channel";
EXPECT_EQ(clientReply.header.type, serverReply.header.type)
<< "server channel should receive the correct message from client channel";
+ EXPECT_EQ(clientReply.body.finished.seq, serverReply.body.finished.seq)
+ << "server channel should receive the correct message from client channel";
EXPECT_EQ(clientReply.body.finished.handled, serverReply.body.finished.handled)
<< "server channel should receive the correct message from client channel";
}