Loading include/input/InputTransport.h +7 −3 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ struct InputMessage { nsecs_t eventTime __attribute__((aligned(8))); int32_t deviceId; int32_t source; int32_t displayId; int32_t action; int32_t flags; int32_t keyCode; Loading @@ -83,6 +84,7 @@ struct InputMessage { nsecs_t eventTime __attribute__((aligned(8))); int32_t deviceId; int32_t source; int32_t displayId; int32_t action; int32_t actionButton; int32_t flags; Loading Loading @@ -232,6 +234,7 @@ public: uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, Loading Loading @@ -303,7 +306,7 @@ public: * Other errors probably indicate that the channel is broken. */ status_t consume(InputEventFactoryInterface* factory, bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent); nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId); /* Sends a finished signal to the publisher to inform it that the message * with the specified sequence number has finished being process and whether Loading Loading @@ -424,9 +427,10 @@ private: Vector<SeqChain> mSeqChains; status_t consumeBatch(InputEventFactoryInterface* factory, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent); nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId); status_t consumeSamples(InputEventFactoryInterface* factory, Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent); Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId); void updateTouchState(InputMessage* msg); void rewriteMessage(const TouchState& state, InputMessage* msg); Loading libs/input/InputTransport.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ status_t InputPublisher::publishMotionEvent( uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, Loading Loading @@ -327,6 +328,7 @@ status_t InputPublisher::publishMotionEvent( msg.body.motion.seq = seq; msg.body.motion.deviceId = deviceId; msg.body.motion.source = source; msg.body.motion.displayId = displayId; msg.body.motion.action = action; msg.body.motion.actionButton = actionButton; msg.body.motion.flags = flags; Loading Loading @@ -396,7 +398,8 @@ bool InputConsumer::isTouchResamplingEnabled() { } status_t InputConsumer::consume(InputEventFactoryInterface* factory, bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) { bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) { #if DEBUG_TRANSPORT_ACTIONS ALOGD("channel '%s' consumer ~ consume: consumeBatches=%s, frameTime=%lld", mChannel->getName().string(), consumeBatches ? "true" : "false", frameTime); Loading @@ -404,6 +407,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, *outSeq = 0; *outEvent = NULL; *displayId = -1; // Invalid display. // Fetch the next input message. // Loop until an event can be returned or no additional events are received. Loading @@ -418,7 +422,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, if (result) { // Consume the next batched event unless batches are being held for later. if (consumeBatches || result != WOULD_BLOCK) { result = consumeBatch(factory, frameTime, outSeq, outEvent); result = consumeBatch(factory, frameTime, outSeq, outEvent, displayId); if (*outEvent) { #if DEBUG_TRANSPORT_ACTIONS ALOGD("channel '%s' consumer ~ consumed batch event, seq=%u", Loading Loading @@ -462,7 +466,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, // the previous batch right now and defer the new message until later. mMsgDeferred = true; status_t result = consumeSamples(factory, batch, batch.samples.size(), outSeq, outEvent); batch, batch.samples.size(), outSeq, outEvent, displayId); mBatches.removeAt(batchIndex); if (result) { return result; Loading Loading @@ -496,6 +500,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, initializeMotionEvent(motionEvent, &mMsg); *outSeq = mMsg.body.motion.seq; *outEvent = motionEvent; *displayId = mMsg.body.motion.displayId; #if DEBUG_TRANSPORT_ACTIONS ALOGD("channel '%s' consumer ~ consumed motion event, seq=%u", mChannel->getName().string(), *outSeq); Loading @@ -513,14 +518,14 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, } status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) { nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) { status_t result; for (size_t i = mBatches.size(); i > 0; ) { i--; Batch& batch = mBatches.editItemAt(i); if (frameTime < 0) { result = consumeSamples(factory, batch, batch.samples.size(), outSeq, outEvent); outSeq, outEvent, displayId); mBatches.removeAt(i); return result; } Loading @@ -534,7 +539,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, continue; } result = consumeSamples(factory, batch, split + 1, outSeq, outEvent); result = consumeSamples(factory, batch, split + 1, outSeq, outEvent, displayId); const InputMessage* next; if (batch.samples.isEmpty()) { mBatches.removeAt(i); Loading @@ -552,7 +557,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, } status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory, Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent) { Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) { MotionEvent* motionEvent = factory->createMotionEvent(); if (! motionEvent) return NO_MEMORY; Loading @@ -567,6 +572,7 @@ status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory, mSeqChains.push(seqChain); addSample(motionEvent, &msg); } else { *displayId = msg.body.motion.displayId; initializeMotionEvent(motionEvent, &msg); } chain = msg.body.motion.seq; Loading libs/input/tests/InputPublisherAndConsumer_test.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -89,7 +89,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() { uint32_t consumeSeq; InputEvent* event; status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event, 0); ASSERT_EQ(OK, status) << "consumer consume should return OK"; Loading Loading @@ -132,6 +133,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { const uint32_t seq = 15; const int32_t deviceId = 1; const int32_t source = AINPUT_SOURCE_TOUCHSCREEN; const int32_t displayId = 0; const int32_t action = AMOTION_EVENT_ACTION_MOVE; const int32_t actionButton = 0; const int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED; Loading Loading @@ -164,7 +166,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 3.5 * i); } status = mPublisher->publishMotionEvent(seq, deviceId, source, action, actionButton, status = mPublisher->publishMotionEvent(seq, deviceId, source, displayId, action, actionButton, flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision, downTime, eventTime, pointerCount, pointerProperties, pointerCoords); Loading @@ -173,7 +175,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { uint32_t consumeSeq; InputEvent* event; status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event, 0); ASSERT_EQ(OK, status) << "consumer consume should return OK"; Loading Loading @@ -256,7 +259,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessTha PointerProperties pointerProperties[pointerCount]; PointerCoords pointerCoords[pointerCount]; status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pointerCount, pointerProperties, pointerCoords); ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE"; Loading @@ -272,7 +275,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreater pointerCoords[i].clear(); } status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pointerCount, pointerProperties, pointerCoords); ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE"; Loading libs/input/tests/StructLayout_test.cpp +22 −20 Original line number Diff line number Diff line Loading @@ -38,31 +38,33 @@ void TestInputMessageAlignment() { CHECK_OFFSET(InputMessage::Body::Key, eventTime, 8); CHECK_OFFSET(InputMessage::Body::Key, deviceId, 16); CHECK_OFFSET(InputMessage::Body::Key, source, 20); CHECK_OFFSET(InputMessage::Body::Key, action, 24); CHECK_OFFSET(InputMessage::Body::Key, flags, 28); CHECK_OFFSET(InputMessage::Body::Key, keyCode, 32); CHECK_OFFSET(InputMessage::Body::Key, scanCode, 36); CHECK_OFFSET(InputMessage::Body::Key, metaState, 40); CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 44); CHECK_OFFSET(InputMessage::Body::Key, downTime, 48); CHECK_OFFSET(InputMessage::Body::Key, displayId, 24); CHECK_OFFSET(InputMessage::Body::Key, action, 28); CHECK_OFFSET(InputMessage::Body::Key, flags, 32); CHECK_OFFSET(InputMessage::Body::Key, keyCode, 36); CHECK_OFFSET(InputMessage::Body::Key, scanCode, 40); CHECK_OFFSET(InputMessage::Body::Key, metaState, 44); CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 48); CHECK_OFFSET(InputMessage::Body::Key, downTime, 56); CHECK_OFFSET(InputMessage::Body::Motion, seq, 0); CHECK_OFFSET(InputMessage::Body::Motion, eventTime, 8); CHECK_OFFSET(InputMessage::Body::Motion, deviceId, 16); CHECK_OFFSET(InputMessage::Body::Motion, source, 20); CHECK_OFFSET(InputMessage::Body::Motion, action, 24); CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 28); CHECK_OFFSET(InputMessage::Body::Motion, flags, 32); CHECK_OFFSET(InputMessage::Body::Motion, metaState, 36); CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 40); CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 44); CHECK_OFFSET(InputMessage::Body::Motion, downTime, 48); CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 56); CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 60); CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 64); CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 68); CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 72); CHECK_OFFSET(InputMessage::Body::Motion, pointers, 80); CHECK_OFFSET(InputMessage::Body::Motion, displayId, 24); CHECK_OFFSET(InputMessage::Body::Motion, action, 28); CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 32); CHECK_OFFSET(InputMessage::Body::Motion, flags, 36); CHECK_OFFSET(InputMessage::Body::Motion, metaState, 40); CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 44); CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 48); CHECK_OFFSET(InputMessage::Body::Motion, downTime, 56); CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 64); CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 68); CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 72); CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 76); CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 80); CHECK_OFFSET(InputMessage::Body::Motion, pointers, 88); } } // namespace android services/inputflinger/InputDispatcher.cpp +5 −7 Original line number Diff line number Diff line Loading @@ -869,10 +869,7 @@ bool InputDispatcher::dispatchMotionLocked( return true; } // TODO: support sending secondary display events to input monitors if (isMainDisplay(entry->displayId)) { addMonitoringTargetsLocked(inputTargets); } // Dispatch the motion. if (conflictingPointerActions) { Loading Loading @@ -2026,7 +2023,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, // Publish the motion event. status = connection->inputPublisher.publishMotionEvent(dispatchEntry->seq, motionEntry->deviceId, motionEntry->source, motionEntry->deviceId, motionEntry->source, motionEntry->displayId, dispatchEntry->resolvedAction, motionEntry->actionButton, dispatchEntry->resolvedFlags, motionEntry->edgeFlags, motionEntry->metaState, motionEntry->buttonState, Loading Loading @@ -2600,8 +2597,9 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t displ uint32_t policyFlags) { #if DEBUG_INBOUND_EVENT_DETAILS ALOGD("injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, " "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x", event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags); "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x, displayId=%d", event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags, displayId); #endif nsecs_t endTime = now() + milliseconds_to_nanoseconds(timeoutMillis); Loading Loading
include/input/InputTransport.h +7 −3 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ struct InputMessage { nsecs_t eventTime __attribute__((aligned(8))); int32_t deviceId; int32_t source; int32_t displayId; int32_t action; int32_t flags; int32_t keyCode; Loading @@ -83,6 +84,7 @@ struct InputMessage { nsecs_t eventTime __attribute__((aligned(8))); int32_t deviceId; int32_t source; int32_t displayId; int32_t action; int32_t actionButton; int32_t flags; Loading Loading @@ -232,6 +234,7 @@ public: uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, Loading Loading @@ -303,7 +306,7 @@ public: * Other errors probably indicate that the channel is broken. */ status_t consume(InputEventFactoryInterface* factory, bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent); nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId); /* Sends a finished signal to the publisher to inform it that the message * with the specified sequence number has finished being process and whether Loading Loading @@ -424,9 +427,10 @@ private: Vector<SeqChain> mSeqChains; status_t consumeBatch(InputEventFactoryInterface* factory, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent); nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId); status_t consumeSamples(InputEventFactoryInterface* factory, Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent); Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId); void updateTouchState(InputMessage* msg); void rewriteMessage(const TouchState& state, InputMessage* msg); Loading
libs/input/InputTransport.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ status_t InputPublisher::publishMotionEvent( uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, Loading Loading @@ -327,6 +328,7 @@ status_t InputPublisher::publishMotionEvent( msg.body.motion.seq = seq; msg.body.motion.deviceId = deviceId; msg.body.motion.source = source; msg.body.motion.displayId = displayId; msg.body.motion.action = action; msg.body.motion.actionButton = actionButton; msg.body.motion.flags = flags; Loading Loading @@ -396,7 +398,8 @@ bool InputConsumer::isTouchResamplingEnabled() { } status_t InputConsumer::consume(InputEventFactoryInterface* factory, bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) { bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) { #if DEBUG_TRANSPORT_ACTIONS ALOGD("channel '%s' consumer ~ consume: consumeBatches=%s, frameTime=%lld", mChannel->getName().string(), consumeBatches ? "true" : "false", frameTime); Loading @@ -404,6 +407,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, *outSeq = 0; *outEvent = NULL; *displayId = -1; // Invalid display. // Fetch the next input message. // Loop until an event can be returned or no additional events are received. Loading @@ -418,7 +422,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, if (result) { // Consume the next batched event unless batches are being held for later. if (consumeBatches || result != WOULD_BLOCK) { result = consumeBatch(factory, frameTime, outSeq, outEvent); result = consumeBatch(factory, frameTime, outSeq, outEvent, displayId); if (*outEvent) { #if DEBUG_TRANSPORT_ACTIONS ALOGD("channel '%s' consumer ~ consumed batch event, seq=%u", Loading Loading @@ -462,7 +466,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, // the previous batch right now and defer the new message until later. mMsgDeferred = true; status_t result = consumeSamples(factory, batch, batch.samples.size(), outSeq, outEvent); batch, batch.samples.size(), outSeq, outEvent, displayId); mBatches.removeAt(batchIndex); if (result) { return result; Loading Loading @@ -496,6 +500,7 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, initializeMotionEvent(motionEvent, &mMsg); *outSeq = mMsg.body.motion.seq; *outEvent = motionEvent; *displayId = mMsg.body.motion.displayId; #if DEBUG_TRANSPORT_ACTIONS ALOGD("channel '%s' consumer ~ consumed motion event, seq=%u", mChannel->getName().string(), *outSeq); Loading @@ -513,14 +518,14 @@ status_t InputConsumer::consume(InputEventFactoryInterface* factory, } status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) { nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) { status_t result; for (size_t i = mBatches.size(); i > 0; ) { i--; Batch& batch = mBatches.editItemAt(i); if (frameTime < 0) { result = consumeSamples(factory, batch, batch.samples.size(), outSeq, outEvent); outSeq, outEvent, displayId); mBatches.removeAt(i); return result; } Loading @@ -534,7 +539,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, continue; } result = consumeSamples(factory, batch, split + 1, outSeq, outEvent); result = consumeSamples(factory, batch, split + 1, outSeq, outEvent, displayId); const InputMessage* next; if (batch.samples.isEmpty()) { mBatches.removeAt(i); Loading @@ -552,7 +557,7 @@ status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, } status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory, Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent) { Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent, int32_t* displayId) { MotionEvent* motionEvent = factory->createMotionEvent(); if (! motionEvent) return NO_MEMORY; Loading @@ -567,6 +572,7 @@ status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory, mSeqChains.push(seqChain); addSample(motionEvent, &msg); } else { *displayId = msg.body.motion.displayId; initializeMotionEvent(motionEvent, &msg); } chain = msg.body.motion.seq; Loading
libs/input/tests/InputPublisherAndConsumer_test.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -89,7 +89,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() { uint32_t consumeSeq; InputEvent* event; status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event, 0); ASSERT_EQ(OK, status) << "consumer consume should return OK"; Loading Loading @@ -132,6 +133,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { const uint32_t seq = 15; const int32_t deviceId = 1; const int32_t source = AINPUT_SOURCE_TOUCHSCREEN; const int32_t displayId = 0; const int32_t action = AMOTION_EVENT_ACTION_MOVE; const int32_t actionButton = 0; const int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED; Loading Loading @@ -164,7 +166,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 3.5 * i); } status = mPublisher->publishMotionEvent(seq, deviceId, source, action, actionButton, status = mPublisher->publishMotionEvent(seq, deviceId, source, displayId, action, actionButton, flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision, downTime, eventTime, pointerCount, pointerProperties, pointerCoords); Loading @@ -173,7 +175,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { uint32_t consumeSeq; InputEvent* event; status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event, 0); ASSERT_EQ(OK, status) << "consumer consume should return OK"; Loading Loading @@ -256,7 +259,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessTha PointerProperties pointerProperties[pointerCount]; PointerCoords pointerCoords[pointerCount]; status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pointerCount, pointerProperties, pointerCoords); ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE"; Loading @@ -272,7 +275,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreater pointerCoords[i].clear(); } status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pointerCount, pointerProperties, pointerCoords); ASSERT_EQ(BAD_VALUE, status) << "publisher publishMotionEvent should return BAD_VALUE"; Loading
libs/input/tests/StructLayout_test.cpp +22 −20 Original line number Diff line number Diff line Loading @@ -38,31 +38,33 @@ void TestInputMessageAlignment() { CHECK_OFFSET(InputMessage::Body::Key, eventTime, 8); CHECK_OFFSET(InputMessage::Body::Key, deviceId, 16); CHECK_OFFSET(InputMessage::Body::Key, source, 20); CHECK_OFFSET(InputMessage::Body::Key, action, 24); CHECK_OFFSET(InputMessage::Body::Key, flags, 28); CHECK_OFFSET(InputMessage::Body::Key, keyCode, 32); CHECK_OFFSET(InputMessage::Body::Key, scanCode, 36); CHECK_OFFSET(InputMessage::Body::Key, metaState, 40); CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 44); CHECK_OFFSET(InputMessage::Body::Key, downTime, 48); CHECK_OFFSET(InputMessage::Body::Key, displayId, 24); CHECK_OFFSET(InputMessage::Body::Key, action, 28); CHECK_OFFSET(InputMessage::Body::Key, flags, 32); CHECK_OFFSET(InputMessage::Body::Key, keyCode, 36); CHECK_OFFSET(InputMessage::Body::Key, scanCode, 40); CHECK_OFFSET(InputMessage::Body::Key, metaState, 44); CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 48); CHECK_OFFSET(InputMessage::Body::Key, downTime, 56); CHECK_OFFSET(InputMessage::Body::Motion, seq, 0); CHECK_OFFSET(InputMessage::Body::Motion, eventTime, 8); CHECK_OFFSET(InputMessage::Body::Motion, deviceId, 16); CHECK_OFFSET(InputMessage::Body::Motion, source, 20); CHECK_OFFSET(InputMessage::Body::Motion, action, 24); CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 28); CHECK_OFFSET(InputMessage::Body::Motion, flags, 32); CHECK_OFFSET(InputMessage::Body::Motion, metaState, 36); CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 40); CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 44); CHECK_OFFSET(InputMessage::Body::Motion, downTime, 48); CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 56); CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 60); CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 64); CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 68); CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 72); CHECK_OFFSET(InputMessage::Body::Motion, pointers, 80); CHECK_OFFSET(InputMessage::Body::Motion, displayId, 24); CHECK_OFFSET(InputMessage::Body::Motion, action, 28); CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 32); CHECK_OFFSET(InputMessage::Body::Motion, flags, 36); CHECK_OFFSET(InputMessage::Body::Motion, metaState, 40); CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 44); CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 48); CHECK_OFFSET(InputMessage::Body::Motion, downTime, 56); CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 64); CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 68); CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 72); CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 76); CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 80); CHECK_OFFSET(InputMessage::Body::Motion, pointers, 88); } } // namespace android
services/inputflinger/InputDispatcher.cpp +5 −7 Original line number Diff line number Diff line Loading @@ -869,10 +869,7 @@ bool InputDispatcher::dispatchMotionLocked( return true; } // TODO: support sending secondary display events to input monitors if (isMainDisplay(entry->displayId)) { addMonitoringTargetsLocked(inputTargets); } // Dispatch the motion. if (conflictingPointerActions) { Loading Loading @@ -2026,7 +2023,7 @@ void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, // Publish the motion event. status = connection->inputPublisher.publishMotionEvent(dispatchEntry->seq, motionEntry->deviceId, motionEntry->source, motionEntry->deviceId, motionEntry->source, motionEntry->displayId, dispatchEntry->resolvedAction, motionEntry->actionButton, dispatchEntry->resolvedFlags, motionEntry->edgeFlags, motionEntry->metaState, motionEntry->buttonState, Loading Loading @@ -2600,8 +2597,9 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t displ uint32_t policyFlags) { #if DEBUG_INBOUND_EVENT_DETAILS ALOGD("injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, " "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x", event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags); "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x, displayId=%d", event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags, displayId); #endif nsecs_t endTime = now() + milliseconds_to_nanoseconds(timeoutMillis); Loading