summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-14 15:41:40 -0700
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-03-14 15:41:40 -0700
commit7e6be236a6f64c2a76f4590a47edca43361ab557 (patch)
treeb9f05c690590d08653e9f7e242c06ff27d054a03
parent709de11f8a1909cdc848a93b552bf6fba042c667 (diff)
parent041ee31d8ec9362c388e9b42b0f4947426cf1b3a (diff)
Merge "TouchInputMapper: Fix display association for POINTER mode" into main am: 041ee31d8e
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3545439 Change-Id: I18dc21860c1b32e9b42e1aeb269c3080efcd60e9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--services/inputflinger/reader/mapper/TouchInputMapper.cpp12
-rw-r--r--services/inputflinger/tests/InputReader_test.cpp2
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);
}
/**