Loading libs/input/input_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -137,3 +137,10 @@ flag { is_fixed_read_only: true } flag { name: "enable_multi_device_same_window_stream" namespace: "input" description: "Allow multiple input devices to be active in the same window simultaneously" bug: "330752824" } services/inputflinger/dispatcher/InputDispatcher.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -4390,7 +4390,7 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent( // different pointer ids than we expected based on the previous ACTION_DOWN // or ACTION_POINTER_DOWN events that caused us to decide to split the pointers // in this way. ALOGW("Dropping split motion event because the pointer count is %d but " ALOGW("Dropping split motion event because the pointer count is %zu but " "we expected there to be %zu pointers. This probably means we received " "a broken sequence of pointer ids from the input device: %s", pointerCoords.size(), pointerIds.count(), Loading services/inputflinger/dispatcher/InputState.cpp +26 −22 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ bool InputState::trackMotion(const MotionEntry& entry, int32_t flags) { return true; } if (!input_flags::enable_multi_device_same_window_stream()) { if (!mMotionMementos.empty()) { const MotionMemento& lastMemento = mMotionMementos.back(); if (isStylusEvent(lastMemento.source, lastMemento.pointerProperties) && Loading @@ -103,6 +104,7 @@ bool InputState::trackMotion(const MotionEntry& entry, int32_t flags) { return false; } } } int32_t actionMasked = entry.action & AMOTION_EVENT_ACTION_MASK; switch (actionMasked) { Loading Loading @@ -345,6 +347,7 @@ bool InputState::shouldCancelPreviousStream(const MotionEntry& motionEntry) cons return false; } if (!input_flags::enable_multi_device_same_window_stream()) { if (isStylusEvent(lastMemento.source, lastMemento.pointerProperties)) { // A stylus is already active. if (isStylusEvent(motionEntry.source, motionEntry.pointerProperties) && Loading @@ -364,6 +367,7 @@ bool InputState::shouldCancelPreviousStream(const MotionEntry& motionEntry) cons actionMasked == AMOTION_EVENT_ACTION_HOVER_ENTER) { return true; } } // By default, don't cancel any events. return false; } Loading services/inputflinger/tests/FakeWindows.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -298,16 +298,18 @@ std::unique_ptr<MotionEvent> FakeWindowHandle::consumeMotionEvent( const ::testing::Matcher<MotionEvent>& matcher) { std::unique_ptr<InputEvent> event = consume(CONSUME_TIMEOUT_EVENT_EXPECTED); if (event == nullptr) { ADD_FAILURE() << "No event"; std::ostringstream matcherDescription; matcher.DescribeTo(&matcherDescription); ADD_FAILURE() << "No event (expected " << matcherDescription.str() << ") on " << mName; return nullptr; } if (event->getType() != InputEventType::MOTION) { ADD_FAILURE() << "Instead of motion event, got " << *event; ADD_FAILURE() << "Instead of motion event, got " << *event << " on " << mName; return nullptr; } std::unique_ptr<MotionEvent> motionEvent = std::unique_ptr<MotionEvent>(static_cast<MotionEvent*>(event.release())); EXPECT_THAT(*motionEvent, matcher); EXPECT_THAT(*motionEvent, matcher) << " on " << mName; return motionEvent; } Loading services/inputflinger/tests/InputDispatcher_test.cpp +1500 −79 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
libs/input/input_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -137,3 +137,10 @@ flag { is_fixed_read_only: true } flag { name: "enable_multi_device_same_window_stream" namespace: "input" description: "Allow multiple input devices to be active in the same window simultaneously" bug: "330752824" }
services/inputflinger/dispatcher/InputDispatcher.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -4390,7 +4390,7 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent( // different pointer ids than we expected based on the previous ACTION_DOWN // or ACTION_POINTER_DOWN events that caused us to decide to split the pointers // in this way. ALOGW("Dropping split motion event because the pointer count is %d but " ALOGW("Dropping split motion event because the pointer count is %zu but " "we expected there to be %zu pointers. This probably means we received " "a broken sequence of pointer ids from the input device: %s", pointerCoords.size(), pointerIds.count(), Loading
services/inputflinger/dispatcher/InputState.cpp +26 −22 Original line number Diff line number Diff line Loading @@ -95,6 +95,7 @@ bool InputState::trackMotion(const MotionEntry& entry, int32_t flags) { return true; } if (!input_flags::enable_multi_device_same_window_stream()) { if (!mMotionMementos.empty()) { const MotionMemento& lastMemento = mMotionMementos.back(); if (isStylusEvent(lastMemento.source, lastMemento.pointerProperties) && Loading @@ -103,6 +104,7 @@ bool InputState::trackMotion(const MotionEntry& entry, int32_t flags) { return false; } } } int32_t actionMasked = entry.action & AMOTION_EVENT_ACTION_MASK; switch (actionMasked) { Loading Loading @@ -345,6 +347,7 @@ bool InputState::shouldCancelPreviousStream(const MotionEntry& motionEntry) cons return false; } if (!input_flags::enable_multi_device_same_window_stream()) { if (isStylusEvent(lastMemento.source, lastMemento.pointerProperties)) { // A stylus is already active. if (isStylusEvent(motionEntry.source, motionEntry.pointerProperties) && Loading @@ -364,6 +367,7 @@ bool InputState::shouldCancelPreviousStream(const MotionEntry& motionEntry) cons actionMasked == AMOTION_EVENT_ACTION_HOVER_ENTER) { return true; } } // By default, don't cancel any events. return false; } Loading
services/inputflinger/tests/FakeWindows.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -298,16 +298,18 @@ std::unique_ptr<MotionEvent> FakeWindowHandle::consumeMotionEvent( const ::testing::Matcher<MotionEvent>& matcher) { std::unique_ptr<InputEvent> event = consume(CONSUME_TIMEOUT_EVENT_EXPECTED); if (event == nullptr) { ADD_FAILURE() << "No event"; std::ostringstream matcherDescription; matcher.DescribeTo(&matcherDescription); ADD_FAILURE() << "No event (expected " << matcherDescription.str() << ") on " << mName; return nullptr; } if (event->getType() != InputEventType::MOTION) { ADD_FAILURE() << "Instead of motion event, got " << *event; ADD_FAILURE() << "Instead of motion event, got " << *event << " on " << mName; return nullptr; } std::unique_ptr<MotionEvent> motionEvent = std::unique_ptr<MotionEvent>(static_cast<MotionEvent*>(event.release())); EXPECT_THAT(*motionEvent, matcher); EXPECT_THAT(*motionEvent, matcher) << " on " << mName; return motionEvent; } Loading
services/inputflinger/tests/InputDispatcher_test.cpp +1500 −79 File changed.Preview size limit exceeded, changes collapsed. Show changes