summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-02-06 19:12:47 -0800
committerJeff Brown <jeffbrown@google.com>2012-02-13 10:28:41 -0800
commitcd50850d4825e597b48ff2ad88a8ac33f74ac6cf (patch)
tree5a0a47b9a14826cb405e933cc56792faf86fca96 /libs/ui
parent6cdee9831d8d2bf8393c2d130cbdc2eced125e15 (diff)
downloadframeworks_native-cd50850d4825e597b48ff2ad88a8ac33f74ac6cf.zip
frameworks_native-cd50850d4825e597b48ff2ad88a8ac33f74ac6cf.tar.gz
frameworks_native-cd50850d4825e597b48ff2ad88a8ac33f74ac6cf.tar.bz2
Dispatch multiple touch events in parallel.
This change enables the input dispatcher to send multiple touch events to an application without waiting for them to be acknowledged. Essentially this is a variation on the old streaming optimization but it is much more comprehensive. Event dispatch will stall as soon as 0.5sec of unacknowledged events are accumulated or a focused event (such as a key event) needs to be delivered. Streaming input events makes a tremendous difference in application performance. The next step will be to enable batching of input events on the client side once again. This is part of a series of changes to improve input system pipelining. Bug: 5963420 Change-Id: I025df90c06165d719fcca7f63eed322a5cce4a78
Diffstat (limited to 'libs/ui')
-rw-r--r--libs/ui/InputTransport.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp
index 7047322..f7bcb68 100644
--- a/libs/ui/InputTransport.cpp
+++ b/libs/ui/InputTransport.cpp
@@ -28,6 +28,13 @@
namespace android {
+// Socket buffer size. The default is typically about 128KB, which is much larger than
+// we really need. So we make it smaller. It just needs to be big enough to hold
+// a few dozen large multi-finger motion events in the case where an application gets
+// behind processing touches.
+static const size_t SOCKET_BUFFER_SIZE = 32 * 1024;
+
+
// --- InputMessage ---
bool InputMessage::isValid(size_t actualSize) const {
@@ -93,6 +100,12 @@ status_t InputChannel::openInputChannelPair(const String8& name,
return result;
}
+ int bufferSize = SOCKET_BUFFER_SIZE;
+ setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
+ setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
+ setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
+ setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
+
String8 serverChannelName = name;
serverChannelName.append(" (server)");
outServerChannel = new InputChannel(serverChannelName, sockets[0]);