From ae4744402ecbbb418a1fd31c1c4246d6819a446a Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Fri, 2 Feb 2024 18:39:36 +0000 Subject: CursorInputMapper: Use flat velocity params when acceleration is disabled We still use velocity control params when the enable_new_mouse_pointer_ballistics flag is disabled. For the old pipeline, ensure we use flat velocity control params whenever pointer acceleration is disabled for the associated display. Bug: 323409820 Test: atest VirtualMouseTest#sendRelativeEvent --rerun-until-failure 100 Change-Id: Id411ee61809cb0a46413d109c03358be5457a8a6 --- services/inputflinger/reader/mapper/CursorInputMapper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'services/inputflinger/reader') diff --git a/services/inputflinger/reader/mapper/CursorInputMapper.cpp b/services/inputflinger/reader/mapper/CursorInputMapper.cpp index d207ed1655..65f69c5155 100644 --- a/services/inputflinger/reader/mapper/CursorInputMapper.cpp +++ b/services/inputflinger/reader/mapper/CursorInputMapper.cpp @@ -164,8 +164,9 @@ std::list CursorInputMapper::reconfigure(nsecs_t when, configureOnChangeDisplayInfo(readerConfig); } + // Pointer speed settings depend on display settings. if (!changes.any() || changes.test(InputReaderConfiguration::Change::POINTER_SPEED) || - configurePointerCapture) { + changes.test(InputReaderConfiguration::Change::DISPLAY_INFO) || configurePointerCapture) { configureOnChangePointerSpeed(readerConfig); } return out; @@ -515,7 +516,11 @@ void CursorInputMapper::configureOnChangePointerSpeed(const InputReaderConfigura mNewPointerVelocityControl.setCurve( createAccelerationCurveForPointerSensitivity(config.mousePointerSpeed)); } else { - mOldPointerVelocityControl.setParameters(config.pointerVelocityControlParameters); + mOldPointerVelocityControl.setParameters( + (config.displaysWithMousePointerAccelerationDisabled.count( + mDisplayId.value_or(ADISPLAY_ID_NONE)) == 0) + ? config.pointerVelocityControlParameters + : FLAT_VELOCITY_CONTROL_PARAMS); } mWheelXVelocityControl.setParameters(config.wheelVelocityControlParameters); mWheelYVelocityControl.setParameters(config.wheelVelocityControlParameters); -- cgit v1.2.3-59-g8ed1b