Lines Matching refs:Connection
79 // Amount of time to allow touch events to be streamed out to a connection before requiring
603 commandEntry->connection.clear();
938 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
939 prepareDispatchCycleLocked(currentTime, connection, eventEntry, &inputTarget);
1032 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
1033 sp<InputWindowHandle> windowHandle = connection->inputWindowHandle;
1046 if (connection->status == Connection::STATUS_NORMAL) {
1049 synthesizeCancelationEventsForConnectionLocked(connection, options);
1670 // If the window's connection is not registered then keep waiting.
1678 // If the connection is dead then keep waiting.
1679 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
1680 if (connection->status != Connection::STATUS_NORMAL) {
1681 return String8::format("Waiting because the %s window's input connection is %s."
1683 connection->getStatusLabel());
1686 // If the connection is backed up then keep waiting.
1687 if (connection->inputPublisherBlocked) {
1690 targetType, connection->outboundQueue.count(), connection->waitQueue.count());
1706 if (!connection->outboundQueue.isEmpty() || !connection->waitQueue.isEmpty()) {
1710 targetType, connection->outboundQueue.count(), connection->waitQueue.count());
1728 if (!connection->waitQueue.isEmpty()
1729 && currentTime >= connection->waitQueue.head->deliveryTime
1735 connection->waitQueue.count(),
1736 (currentTime - connection->waitQueue.head->deliveryTime) * 0.000001f);
1802 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget) {
1807 connection->getInputChannelName(), inputTarget->flags,
1812 // Skip this event if the connection status is not normal.
1813 // We don't want to enqueue additional outbound events if the connection is broken.
1814 if (connection->status != Connection::STATUS_NORMAL) {
1817 connection->getInputChannelName(), connection->getStatusLabel());
1835 connection->getInputChannelName());
1838 enqueueDispatchEntriesLocked(currentTime, connection,
1846 enqueueDispatchEntriesLocked(currentTime, connection, eventEntry, inputTarget);
1850 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget) {
1851 bool wasEmpty = connection->outboundQueue.isEmpty();
1854 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1856 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1858 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1860 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1862 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1864 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1868 if (wasEmpty && !connection->outboundQueue.isEmpty()) {
1869 startDispatchCycleLocked(currentTime, connection);
1874 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget,
1883 // Enqueue a new dispatch entry onto the outbound queue for this connection.
1888 // Apply target flags and update the connection's input state.
1895 if (!connection->inputState.trackKey(keyEntry,
1899 connection->getInputChannelName());
1923 && !connection->inputState.isHovering(
1927 connection->getInputChannelName());
1940 if (!connection->inputState.trackMotion(motionEntry,
1944 connection->getInputChannelName());
1959 connection->outboundQueue.enqueueAtTail(dispatchEntry);
1960 traceOutboundQueueLengthLocked(connection);
1964 const sp<Connection>& connection) {
1967 connection->getInputChannelName());
1970 while (connection->status == Connection::STATUS_NORMAL
1971 && !connection->outboundQueue.isEmpty()) {
1972 connection->outboundQueue.head;
1983 status = connection->inputPublisher.publishKeyEvent(dispatchEntry->seq,
2027 status = connection->inputPublisher.publishMotionEvent(dispatchEntry->seq,
2047 if (connection->waitQueue.isEmpty()) {
2051 "event to it, status=%d", connection->getInputChannelName(), status);
2052 abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
2059 connection->getInputChannelName());
2061 connection->inputPublisherBlocked = true;
2065 "status=%d", connection->getInputChannelName(), status);
2066 abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
2072 connection->outboundQueue.dequeue(dispatchEntry);
2073 traceOutboundQueueLengthLocked(connection);
2074 connection->waitQueue.enqueueAtTail(dispatchEntry);
2075 traceWaitQueueLengthLocked(connection);
2080 const sp<Connection>& connection, uint32_t seq, bool handled) {
2083 connection->getInputChannelName(), seq, toString(handled));
2086 connection->inputPublisherBlocked = false;
2088 if (connection->status == Connection::STATUS_BROKEN
2089 || connection->status == Connection::STATUS_ZOMBIE) {
2094 onDispatchCycleFinishedLocked(currentTime, connection, seq, handled);
2098 const sp<Connection>& connection, bool notify) {
2101 connection->getInputChannelName(), toString(notify));
2105 drainDispatchQueueLocked(&connection->outboundQueue);
2106 traceOutboundQueueLengthLocked(connection);
2107 drainDispatchQueueLocked(&connection->waitQueue);
2108 traceWaitQueueLengthLocked(connection);
2110 // The connection appears to be unrecoverably broken.
2112 if (connection->status == Connection::STATUS_NORMAL) {
2113 connection->status = Connection::STATUS_BROKEN;
2117 onDispatchCycleBrokenLocked(currentTime, connection);
2150 sp<Connection> connection = d->mConnectionsByFd.valueAt(connectionIndex);
2154 "events=0x%x", connection->getInputChannelName(), events);
2164 status = connection->inputPublisher.receiveFinishedSignal(&seq, &handled);
2168 d->finishDispatchCycleLocked(currentTime, connection, seq, handled);
2178 notify = status != DEAD_OBJECT || !connection->monitor;
2181 connection->getInputChannelName(), status);
2187 notify = !connection->monitor;
2190 "events=0x%x", connection->getInputChannelName(), events);
2195 d->unregisterInputChannelLocked(connection->inputChannel, notify);
2225 const sp<Connection>& connection, const CancelationOptions& options) {
2226 if (connection->status == Connection::STATUS_BROKEN) {
2233 connection->inputState.synthesizeCancelationEvents(currentTime,
2240 connection->getInputChannelName(), cancelationEvents.size(),
2257 sp<InputWindowHandle> windowHandle = getWindowHandleLocked(connection->inputChannel);
2268 target.inputChannel = connection->inputChannel;
2271 enqueueDispatchEntryLocked(connection, cancelationEventEntry, // increments ref
2277 startDispatchCycleLocked(currentTime, connection);
3097 sp<Connection> fromConnection = mConnectionsByFd.valueAt(fromConnectionIndex);
3098 sp<Connection> toConnection = mConnectionsByFd.valueAt(toConnectionIndex);
3285 const sp<Connection>& connection = mConnectionsByFd.valueAt(i);
3288 i, connection->getInputChannelName(), connection->getWindowName(),
3289 connection->getStatusLabel(), toString(connection->monitor),
3290 toString(connection->inputPublisherBlocked));
3292 if (!connection->outboundQueue.isEmpty()) {
3294 connection->outboundQueue.count());
3295 for (DispatchEntry* entry = connection->outboundQueue.head; entry;
3307 if (!connection->waitQueue.isEmpty()) {
3309 connection->waitQueue.count());
3310 for (DispatchEntry* entry = connection->waitQueue.head; entry;
3358 sp<Connection> connection = new Connection(inputChannel, inputWindowHandle, monitor);
3361 mConnectionsByFd.add(fd, connection);
3389 // Wake the poll loop because removing the connection may have changed the current
3404 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
3407 if (connection->monitor) {
3414 abortBrokenDispatchCycleLocked(currentTime, connection, notify);
3416 connection->status = Connection::STATUS_ZOMBIE;
3432 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
3433 if (connection->inputChannel.get() == inputChannel.get()) {
3442 nsecs_t currentTime, const sp<Connection>& connection, uint32_t seq, bool handled) {
3445 commandEntry->connection = connection;
3452 nsecs_t currentTime, const sp<Connection>& connection) {
3454 connection->getInputChannelName());
3458 commandEntry->connection = connection;
3506 sp<Connection> connection = commandEntry->connection;
3508 if (connection->status != Connection::STATUS_ZOMBIE) {
3511 mPolicy->notifyInputChannelBroken(connection->inputWindowHandle);
3559 sp<Connection> connection = commandEntry->connection;
3565 DispatchEntry* dispatchEntry = connection->findWaitQueueEntry(seq);
3571 connection->getWindowName(), eventDuration * 0.000001f);
3579 restartEvent = afterKeyEventLockedInterruptible(connection,
3583 restartEvent = afterMotionEventLockedInterruptible(connection,
3593 if (dispatchEntry == connection->findWaitQueueEntry(seq)) {
3594 connection->waitQueue.dequeue(dispatchEntry);
3595 traceWaitQueueLengthLocked(connection);
3596 if (restartEvent && connection->status == Connection::STATUS_NORMAL) {
3597 connection->outboundQueue.enqueueAtHead(dispatchEntry);
3598 traceOutboundQueueLengthLocked(connection);
3604 // Start the next dispatch cycle for this connection.
3605 startDispatchCycleLocked(now(), connection);
3609 Connection>& connection,
3615 int32_t fallbackKeyCode = connection->inputState.getFallbackKey(originalKeyCode);
3617 connection->inputState.removeFallbackKey(originalKeyCode);
3638 mPolicy->dispatchUnhandledKey(connection->inputWindowHandle,
3650 synthesizeCancelationEventsForConnectionLocked(connection, options);
3652 connection->inputState.removeFallbackKey(originalKeyCode);
3683 bool fallback = mPolicy->dispatchUnhandledKey(connection->inputWindowHandle,
3688 if (connection->status != Connection::STATUS_NORMAL) {
3689 connection->inputState.removeFallbackKey(originalKeyCode);
3701 connection->inputState.setFallbackKey(originalKeyCode, fallbackKeyCode);
3728 synthesizeCancelationEventsForConnectionLocked(connection, options);
3733 connection->inputState.setFallbackKey(originalKeyCode,
3742 connection->inputState.getFallbackKeys();
3781 bool InputDispatcher::afterMotionEventLockedInterruptible(const sp<Connection>& connection,
3811 void InputDispatcher::traceOutboundQueueLengthLocked(const sp<Connection>& connection) {
3814 snprintf(counterName, sizeof(counterName), "oq:%s", connection->getWindowName());
3815 ATRACE_INT(counterName, connection->outboundQueue.count());
3819 void InputDispatcher::traceWaitQueueLengthLocked(const sp<Connection>& connection) {
3822 snprintf(counterName, sizeof(counterName), "wq:%s", connection->getWindowName());
3823 ATRACE_INT(counterName, connection->waitQueue.count());
4389 // --- InputDispatcher::Connection ---
4391 InputDispatcher::Connection::Connection(const sp<InputChannel>& inputChannel,
4398 InputDispatcher::Connection::~Connection() {
4401 const char* InputDispatcher::Connection::getWindowName() const {
4411 const char* InputDispatcher::Connection::getStatusLabel() const {
4427 InputDispatcher::DispatchEntry* InputDispatcher::Connection::findWaitQueueEntry(uint32_t seq) {