Skip to content

Commit 7e6be23

Browse files
Treehugger Robotandroid-build-merge-worker-robot
authored andcommitted
Merge "TouchInputMapper: Fix display association for POINTER mode" into main am: 041ee31
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>
2 parents 709de11 + 041ee31 commit 7e6be23

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

services/inputflinger/reader/mapper/TouchInputMapper.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3476,7 +3476,7 @@ std::list<NotifyArgs> TouchInputMapper::dispatchPointerMouse(nsecs_t when, nsecs
34763476
}
34773477

34783478
return dispatchPointerSimple(when, readTime, policyFlags, down, hovering,
3479-
ui::LogicalDisplayId::INVALID);
3479+
getAssociatedDisplayId().value_or(ui::LogicalDisplayId::INVALID));
34803480
}
34813481

34823482
std::list<NotifyArgs> TouchInputMapper::abortPointerMouse(nsecs_t when, nsecs_t readTime,
@@ -3967,14 +3967,8 @@ bool TouchInputMapper::markSupportedKeyCodes(uint32_t sourceMask,
39673967
}
39683968

39693969
std::optional<ui::LogicalDisplayId> TouchInputMapper::getAssociatedDisplayId() {
3970-
if (mParameters.hasAssociatedDisplay) {
3971-
if (mDeviceMode == DeviceMode::POINTER) {
3972-
return ui::LogicalDisplayId::INVALID;
3973-
} else {
3974-
return std::make_optional(mViewport.displayId);
3975-
}
3976-
}
3977-
return std::nullopt;
3970+
return mParameters.hasAssociatedDisplay ? std::make_optional(mViewport.displayId)
3971+
: std::nullopt;
39783972
}
39793973

39803974
} // namespace android

services/inputflinger/tests/InputReader_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7534,7 +7534,7 @@ TEST_F(MultiTouchInputMapperTest, Process_Pointer_ShouldHandleDisplayId) {
75347534

75357535
ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs));
75367536
ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action);
7537-
ASSERT_EQ(ui::LogicalDisplayId::INVALID, motionArgs.displayId);
7537+
ASSERT_EQ(DISPLAY_ID, motionArgs.displayId);
75387538
}
75397539

75407540
/**

0 commit comments

Comments
 (0)