Loading services/inputflinger/reader/mapper/TouchInputMapper.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,19 @@ void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) { info->addMotionRange(mOrientedRanges.y); info->addMotionRange(mOrientedRanges.pressure); if (mDeviceMode == DeviceMode::UNSCALED && mSource == AINPUT_SOURCE_TOUCHPAD) { // Populate RELATIVE_X and RELATIVE_Y motion range for touchpad capture mode // RELATIVE_X and RELATIVE_Y motion range is the largest possible hardware relative // motion, e.g. the hardware size finger moved completely across the touchpad in one // sample cycle. const InputDeviceInfo::MotionRange& x = mOrientedRanges.x; const InputDeviceInfo::MotionRange& y = mOrientedRanges.y; info->addMotionRange(AMOTION_EVENT_AXIS_RELATIVE_X, mSource, -x.max, x.max, x.flat, x.fuzz, x.resolution); info->addMotionRange(AMOTION_EVENT_AXIS_RELATIVE_Y, mSource, -y.max, y.max, y.flat, y.fuzz, y.resolution); } if (mOrientedRanges.haveSize) { info->addMotionRange(mOrientedRanges.size); } Loading services/inputflinger/tests/InputReader_test.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -7652,6 +7652,20 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchpadCapture) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); InputDeviceInfo deviceInfo; mDevice->getDeviceInfo(&deviceInfo); const InputDeviceInfo::MotionRange* relRangeX = deviceInfo.getMotionRange(AMOTION_EVENT_AXIS_RELATIVE_X, AINPUT_SOURCE_TOUCHPAD); ASSERT_NE(relRangeX, nullptr); ASSERT_EQ(relRangeX->min, -(RAW_X_MAX - RAW_X_MIN)); ASSERT_EQ(relRangeX->max, RAW_X_MAX - RAW_X_MIN); const InputDeviceInfo::MotionRange* relRangeY = deviceInfo.getMotionRange(AMOTION_EVENT_AXIS_RELATIVE_Y, AINPUT_SOURCE_TOUCHPAD); ASSERT_NE(relRangeY, nullptr); ASSERT_EQ(relRangeY->min, -(RAW_Y_MAX - RAW_Y_MIN)); ASSERT_EQ(relRangeY->max, RAW_Y_MAX - RAW_Y_MIN); // run captured pointer tests - note that this is unscaled, so input listener events should be // identical to what the hardware sends (accounting for any // calibration). Loading Loading
services/inputflinger/reader/mapper/TouchInputMapper.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,19 @@ void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) { info->addMotionRange(mOrientedRanges.y); info->addMotionRange(mOrientedRanges.pressure); if (mDeviceMode == DeviceMode::UNSCALED && mSource == AINPUT_SOURCE_TOUCHPAD) { // Populate RELATIVE_X and RELATIVE_Y motion range for touchpad capture mode // RELATIVE_X and RELATIVE_Y motion range is the largest possible hardware relative // motion, e.g. the hardware size finger moved completely across the touchpad in one // sample cycle. const InputDeviceInfo::MotionRange& x = mOrientedRanges.x; const InputDeviceInfo::MotionRange& y = mOrientedRanges.y; info->addMotionRange(AMOTION_EVENT_AXIS_RELATIVE_X, mSource, -x.max, x.max, x.flat, x.fuzz, x.resolution); info->addMotionRange(AMOTION_EVENT_AXIS_RELATIVE_Y, mSource, -y.max, y.max, y.flat, y.fuzz, y.resolution); } if (mOrientedRanges.haveSize) { info->addMotionRange(mOrientedRanges.size); } Loading
services/inputflinger/tests/InputReader_test.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -7652,6 +7652,20 @@ TEST_F(MultiTouchInputMapperTest, Process_TouchpadCapture) { ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper.getSources()); InputDeviceInfo deviceInfo; mDevice->getDeviceInfo(&deviceInfo); const InputDeviceInfo::MotionRange* relRangeX = deviceInfo.getMotionRange(AMOTION_EVENT_AXIS_RELATIVE_X, AINPUT_SOURCE_TOUCHPAD); ASSERT_NE(relRangeX, nullptr); ASSERT_EQ(relRangeX->min, -(RAW_X_MAX - RAW_X_MIN)); ASSERT_EQ(relRangeX->max, RAW_X_MAX - RAW_X_MIN); const InputDeviceInfo::MotionRange* relRangeY = deviceInfo.getMotionRange(AMOTION_EVENT_AXIS_RELATIVE_Y, AINPUT_SOURCE_TOUCHPAD); ASSERT_NE(relRangeY, nullptr); ASSERT_EQ(relRangeY->min, -(RAW_Y_MAX - RAW_Y_MIN)); ASSERT_EQ(relRangeY->max, RAW_Y_MAX - RAW_Y_MIN); // run captured pointer tests - note that this is unscaled, so input listener events should be // identical to what the hardware sends (accounting for any // calibration). Loading