Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 686b965e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow multiple input device in the same window" into main

parents 54602b48 ed89cbbc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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"
}
+1 −1
Original line number Diff line number Diff line
@@ -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(),
+26 −22
Original line number Diff line number Diff line
@@ -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) &&
@@ -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) {
@@ -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) &&
@@ -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;
}
+5 −3
Original line number Diff line number Diff line
@@ -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;
}

+1500 −79

File changed.

Preview size limit exceeded, changes collapsed.