diff options
-rw-r--r-- | services/inputflinger/reader/mapper/TouchInputMapper.cpp | 12 | ||||
-rw-r--r-- | services/inputflinger/tests/InputReader_test.cpp | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp index 5c90cbb6ce..d9e7054322 100644 --- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp +++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp @@ -3476,7 +3476,7 @@ std::list<NotifyArgs> TouchInputMapper::dispatchPointerMouse(nsecs_t when, nsecs } return dispatchPointerSimple(when, readTime, policyFlags, down, hovering, - ui::LogicalDisplayId::INVALID); + getAssociatedDisplayId().value_or(ui::LogicalDisplayId::INVALID)); } std::list<NotifyArgs> TouchInputMapper::abortPointerMouse(nsecs_t when, nsecs_t readTime, @@ -3967,14 +3967,8 @@ bool TouchInputMapper::markSupportedKeyCodes(uint32_t sourceMask, } std::optional<ui::LogicalDisplayId> TouchInputMapper::getAssociatedDisplayId() { - if (mParameters.hasAssociatedDisplay) { - if (mDeviceMode == DeviceMode::POINTER) { - return ui::LogicalDisplayId::INVALID; - } else { - return std::make_optional(mViewport.displayId); - } - } - return std::nullopt; + return mParameters.hasAssociatedDisplay ? std::make_optional(mViewport.displayId) + : std::nullopt; } } // namespace android diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp index 9d2256f52f..54e9d4da40 100644 --- a/services/inputflinger/tests/InputReader_test.cpp +++ b/services/inputflinger/tests/InputReader_test.cpp @@ -7534,7 +7534,7 @@ TEST_F(MultiTouchInputMapperTest, Process_Pointer_ShouldHandleDisplayId) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_EQ(ui::LogicalDisplayId::INVALID, motionArgs.displayId); + ASSERT_EQ(DISPLAY_ID, motionArgs.displayId); } /** |