Lines Matching refs:connection
78 // Amount of time to allow touch events to be streamed out to a connection before requiring
599 commandEntry->connection.clear();
925 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
926 prepareDispatchCycleLocked(currentTime, connection, eventEntry, &inputTarget);
1019 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
1020 sp<InputWindowHandle> windowHandle = connection->inputWindowHandle;
1026 if (connection->status == Connection::STATUS_NORMAL) {
1029 synthesizeCancelationEventsForConnectionLocked(connection, options);
1667 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
1668 if (connection->inputPublisherBlocked) {
1683 return connection->outboundQueue.isEmpty()
1684 && connection->waitQueue.isEmpty();
1701 if (!connection->waitQueue.isEmpty()
1702 && currentTime >= connection->waitQueue.head->deliveryTime
1770 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget) {
1775 connection->getInputChannelName(), inputTarget->flags,
1780 // Skip this event if the connection status is not normal.
1781 // We don't want to enqueue additional outbound events if the connection is broken.
1782 if (connection->status != Connection::STATUS_NORMAL) {
1785 connection->getInputChannelName(), connection->getStatusLabel());
1803 connection->getInputChannelName());
1806 enqueueDispatchEntriesLocked(currentTime, connection,
1814 enqueueDispatchEntriesLocked(currentTime, connection, eventEntry, inputTarget);
1818 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget) {
1819 bool wasEmpty = connection->outboundQueue.isEmpty();
1822 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1824 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1826 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1828 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1830 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1832 enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
1836 if (wasEmpty && !connection->outboundQueue.isEmpty()) {
1837 startDispatchCycleLocked(currentTime, connection);
1842 const sp<Connection>& connection, EventEntry* eventEntry, const InputTarget* inputTarget,
1851 // Enqueue a new dispatch entry onto the outbound queue for this connection.
1856 // Apply target flags and update the connection's input state.
1863 if (!connection->inputState.trackKey(keyEntry,
1867 connection->getInputChannelName());
1891 && !connection->inputState.isHovering(
1895 connection->getInputChannelName());
1905 if (!connection->inputState.trackMotion(motionEntry,
1909 connection->getInputChannelName());
1924 connection->outboundQueue.enqueueAtTail(dispatchEntry);
1925 traceOutboundQueueLengthLocked(connection);
1929 const sp<Connection>& connection) {
1932 connection->getInputChannelName());
1935 while (connection->status == Connection::STATUS_NORMAL
1936 && !connection->outboundQueue.isEmpty()) {
1937 DispatchEntry* dispatchEntry = connection->outboundQueue.head;
1948 status = connection->inputPublisher.publishKeyEvent(dispatchEntry->seq,
1992 status = connection->inputPublisher.publishMotionEvent(dispatchEntry->seq,
2012 if (connection->waitQueue.isEmpty()) {
2016 "event to it, status=%d", connection->getInputChannelName(), status);
2017 abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
2024 connection->getInputChannelName());
2026 connection->inputPublisherBlocked = true;
2030 "status=%d", connection->getInputChannelName(), status);
2031 abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/);
2037 connection->outboundQueue.dequeue(dispatchEntry);
2038 traceOutboundQueueLengthLocked(connection);
2039 connection->waitQueue.enqueueAtTail(dispatchEntry);
2040 traceWaitQueueLengthLocked(connection);
2045 const sp<Connection>& connection, uint32_t seq, bool handled) {
2048 connection->getInputChannelName(), seq, toString(handled));
2051 connection->inputPublisherBlocked = false;
2053 if (connection->status == Connection::STATUS_BROKEN
2054 || connection->status == Connection::STATUS_ZOMBIE) {
2059 onDispatchCycleFinishedLocked(currentTime, connection, seq, handled);
2063 const sp<Connection>& connection, bool notify) {
2066 connection->getInputChannelName(), toString(notify));
2070 drainDispatchQueueLocked(&connection->outboundQueue);
2071 traceOutboundQueueLengthLocked(connection);
2072 drainDispatchQueueLocked(&connection->waitQueue);
2073 traceWaitQueueLengthLocked(connection);
2075 // The connection appears to be unrecoverably broken.
2077 if (connection->status == Connection::STATUS_NORMAL) {
2078 connection->status = Connection::STATUS_BROKEN;
2082 onDispatchCycleBrokenLocked(currentTime, connection);
2115 sp<Connection> connection = d->mConnectionsByFd.valueAt(connectionIndex);
2119 "events=0x%x", connection->getInputChannelName(), events);
2129 status = connection->inputPublisher.receiveFinishedSignal(&seq, &handled);
2133 d->finishDispatchCycleLocked(currentTime, connection, seq, handled);
2143 notify = status != DEAD_OBJECT || !connection->monitor;
2146 connection->getInputChannelName(), status);
2152 notify = !connection->monitor;
2155 "events=0x%x", connection->getInputChannelName(), events);
2160 d->unregisterInputChannelLocked(connection->inputChannel, notify);
2183 const sp<Connection>& connection, const CancelationOptions& options) {
2184 if (connection->status == Connection::STATUS_BROKEN) {
2191 connection->inputState.synthesizeCancelationEvents(currentTime,
2198 connection->getInputChannelName(), cancelationEvents.size(),
2215 sp<InputWindowHandle> windowHandle = getWindowHandleLocked(connection->inputChannel);
2226 target.inputChannel = connection->inputChannel;
2229 enqueueDispatchEntryLocked(connection, cancelationEventEntry, // increments ref
2235 startDispatchCycleLocked(currentTime, connection);
3034 sp<Connection> fromConnection = mConnectionsByFd.valueAt(fromConnectionIndex);
3035 sp<Connection> toConnection = mConnectionsByFd.valueAt(toConnectionIndex);
3203 const sp<Connection>& connection = mConnectionsByFd.valueAt(i);
3206 i, connection->getInputChannelName(), connection->getWindowName(),
3207 connection->getStatusLabel(), toString(connection->monitor),
3208 toString(connection->inputPublisherBlocked));
3210 if (!connection->outboundQueue.isEmpty()) {
3212 connection->outboundQueue.count());
3213 for (DispatchEntry* entry = connection->outboundQueue.head; entry;
3225 if (!connection->waitQueue.isEmpty()) {
3227 connection->waitQueue.count());
3228 for (DispatchEntry* entry = connection->waitQueue.head; entry;
3276 sp<Connection> connection = new Connection(inputChannel, inputWindowHandle, monitor);
3279 mConnectionsByFd.add(fd, connection);
3307 // Wake the poll loop because removing the connection may have changed the current
3322 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
3325 if (connection->monitor) {
3332 abortBrokenDispatchCycleLocked(currentTime, connection, notify);
3334 connection->status = Connection::STATUS_ZOMBIE;
3350 sp<Connection> connection = mConnectionsByFd.valueAt(connectionIndex);
3351 if (connection->inputChannel.get() == inputChannel.get()) {
3360 nsecs_t currentTime, const sp<Connection>& connection, uint32_t seq, bool handled) {
3363 commandEntry->connection = connection;
3370 nsecs_t currentTime, const sp<Connection>& connection) {
3372 connection->getInputChannelName());
3376 commandEntry->connection = connection;
3424 sp<Connection> connection = commandEntry->connection;
3426 if (connection->status != Connection::STATUS_ZOMBIE) {
3429 mPolicy->notifyInputChannelBroken(connection->inputWindowHandle);
3477 sp<Connection> connection = commandEntry->connection;
3483 DispatchEntry* dispatchEntry = connection->findWaitQueueEntry(seq);
3489 connection->getWindowName(), eventDuration * 0.000001f);
3497 restartEvent = afterKeyEventLockedInterruptible(connection,
3501 restartEvent = afterMotionEventLockedInterruptible(connection,
3511 if (dispatchEntry == connection->findWaitQueueEntry(seq)) {
3512 connection->waitQueue.dequeue(dispatchEntry);
3513 traceWaitQueueLengthLocked(connection);
3514 if (restartEvent && connection->status == Connection::STATUS_NORMAL) {
3515 connection->outboundQueue.enqueueAtHead(dispatchEntry);
3516 traceOutboundQueueLengthLocked(connection);
3522 // Start the next dispatch cycle for this connection.
3523 startDispatchCycleLocked(now(), connection);
3527 bool InputDispatcher::afterKeyEventLockedInterruptible(const sp<Connection>& connection,
3533 int32_t fallbackKeyCode = connection->inputState.getFallbackKey(originalKeyCode);
3535 connection->inputState.removeFallbackKey(originalKeyCode);
3556 mPolicy->dispatchUnhandledKey(connection->inputWindowHandle,
3568 synthesizeCancelationEventsForConnectionLocked(connection, options);
3570 connection->inputState.removeFallbackKey(originalKeyCode);
3601 bool fallback = mPolicy->dispatchUnhandledKey(connection->inputWindowHandle,
3606 if (connection->status != Connection::STATUS_NORMAL) {
3607 connection->inputState.removeFallbackKey(originalKeyCode);
3619 connection->inputState.setFallbackKey(originalKeyCode, fallbackKeyCode);
3646 synthesizeCancelationEventsForConnectionLocked(connection, options);
3651 connection->inputState.setFallbackKey(originalKeyCode,
3660 connection->inputState.getFallbackKeys();
3699 bool InputDispatcher::afterMotionEventLockedInterruptible(const sp<Connection>& connection,
3729 void InputDispatcher::traceOutboundQueueLengthLocked(const sp<Connection>& connection) {
3732 snprintf(counterName, sizeof(counterName), "oq:%s", connection->getWindowName());
3733 ATRACE_INT(counterName, connection->outboundQueue.count());
3737 void InputDispatcher::traceWaitQueueLengthLocked(const sp<Connection>& connection) {
3740 snprintf(counterName, sizeof(counterName), "wq:%s", connection->getWindowName());
3741 ATRACE_INT(counterName, connection->waitQueue.count());
4293 // --- InputDispatcher::Connection ---
4295 InputDispatcher::Connection::Connection(const sp<InputChannel>& inputChannel,
4302 InputDispatcher::Connection::~Connection() {
4305 const char* InputDispatcher::Connection::getWindowName() const {
4315 const char* InputDispatcher::Connection::getStatusLabel() const {
4331 InputDispatcher::DispatchEntry* InputDispatcher::Connection::findWaitQueueEntry(uint32_t seq) {