From 2d8c79afe6dbbb6c9c04bed008a73b6438b14df1 Mon Sep 17 00:00:00 2001 From: Josep del Río Date: Mon, 23 Jan 2023 19:33:50 +0000 Subject: Revert "Use both mouse and touchpad sources for touchpads" This reverts commit 16a24cc68aecf8f5b29efb1ef9420b3060559446. Reason for revert: The change affects the accuracy and functionality of the original touchpad stack Change-Id: Idf3ffa805aec8f5e36e04b5a86e3337ae62e6a70 --- services/inputflinger/reader/mapper/TouchInputMapper.cpp | 2 -- services/inputflinger/tests/InputReader_test.cpp | 16 ++++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp index 16bc381a9c..615889ebe3 100644 --- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp +++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp @@ -897,8 +897,6 @@ void TouchInputMapper::configureInputDevice(nsecs_t when, bool* outResetNeeded) mDeviceMode = DeviceMode::POINTER; if (hasStylus()) { mSource |= AINPUT_SOURCE_STYLUS; - } else { - mSource |= AINPUT_SOURCE_TOUCHPAD; } } else if (isTouchScreen()) { mSource = AINPUT_SOURCE_TOUCHSCREEN; diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp index 076be9eb70..bc70584af8 100644 --- a/services/inputflinger/tests/InputReader_test.cpp +++ b/services/inputflinger/tests/InputReader_test.cpp @@ -5521,7 +5521,7 @@ TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecifiedAndNot prepareAxes(POSITION); SingleTouchInputMapper& mapper = addMapperAndConfigure(); - ASSERT_EQ(AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); + ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper.getSources()); } TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsTouchScreen_ReturnsTouchScreen) { @@ -8791,8 +8791,8 @@ TEST_F(MultiTouchInputMapperTest, Process_Pointer_ShouldHandleDisplayId) { prepareAxes(POSITION); MultiTouchInputMapper& mapper = addMapperAndConfigure(); - // Check source is a touchpad that would obtain the PointerController. - ASSERT_EQ(AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); + // Check source is mouse that would obtain the PointerController. + ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper.getSources()); NotifyMotionArgs motionArgs; processPosition(mapper, 100, 100); @@ -9795,11 +9795,11 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchpadCapture) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); ASSERT_EQ(AMOTION_EVENT_ACTION_UP, args.action); - // A non captured touchpad should have a mouse and touchpad source. + // non captured touchpad should be a mouse source mFakePolicy->setPointerCapture(false); configureDevice(InputReaderConfiguration::CHANGE_POINTER_CAPTURE); ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); - ASSERT_EQ(AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); + ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper.getSources()); } TEST_F(MultiTouchInputMapperTest, Process_UnCapturedTouchpadPointer) { @@ -9858,10 +9858,10 @@ TEST_F(MultiTouchInputMapperTest, WhenCapturedAndNotCaptured_GetSources) { mFakePolicy->setPointerCapture(false); MultiTouchInputMapper& mapper = addMapperAndConfigure(); - // An uncaptured touchpad should be a pointer device, with additional touchpad source. - ASSERT_EQ(AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); + // uncaptured touchpad should be a pointer device + ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper.getSources()); - // A captured touchpad should just have a touchpad source. + // captured touchpad should be a touchpad device mFakePolicy->setPointerCapture(true); configureDevice(InputReaderConfiguration::CHANGE_POINTER_CAPTURE); ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); -- cgit v1.2.3-59-g8ed1b