Loading libs/input/input_flags.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -93,13 +93,6 @@ flag { bug: "309018874" } flag { name: "enable_new_mouse_pointer_ballistics" namespace: "input" description: "Change the acceleration curves for mouse pointer movements to match the touchpad ones" bug: "315313622" } flag { name: "rate_limit_user_activity_poke_in_dispatcher" namespace: "input" Loading services/inputflinger/include/InputReaderBase.h +6 −7 Original line number Diff line number Diff line Loading @@ -137,19 +137,18 @@ struct InputReaderConfiguration { ui::LogicalDisplayId defaultPointerDisplayId; // The mouse pointer speed, as a number from -7 (slowest) to 7 (fastest). // // Currently only used when the enable_new_mouse_pointer_ballistics flag is enabled. int32_t mousePointerSpeed; // Displays on which an acceleration curve shouldn't be applied for pointer movements from mice. // // Currently only used when the enable_new_mouse_pointer_ballistics flag is enabled. std::set<ui::LogicalDisplayId> displaysWithMousePointerAccelerationDisabled; // Velocity control parameters for mouse pointer movements. // Velocity control parameters for touchpad pointer movements on the old touchpad stack (based // on TouchInputMapper). // // For mice, these are ignored and the values of mousePointerSpeed and // mousePointerAccelerationEnabled used instead. // // If the enable_new_mouse_pointer_ballistics flag is enabled, these are ignored and the values // of mousePointerSpeed and mousePointerAccelerationEnabled used instead. // TODO(b/281840344): remove this. VelocityControlParameters pointerVelocityControlParameters; // Velocity control parameters for mouse wheel movements. Loading services/inputflinger/reader/mapper/CursorInputMapper.cpp +9 −29 Original line number Diff line number Diff line Loading @@ -33,8 +33,6 @@ #include "input/PrintTools.h" namespace input_flags = com::android::input::flags; namespace android { // The default velocity control parameters that has no effect. Loading Loading @@ -77,8 +75,7 @@ void CursorMotionAccumulator::finishSync() { CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) : InputMapper(deviceContext, readerConfig), mLastEventTime(std::numeric_limits<nsecs_t>::min()), mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {} mLastEventTime(std::numeric_limits<nsecs_t>::min()) {} uint32_t CursorInputMapper::getSources() const { return mSource; Loading Loading @@ -207,8 +204,7 @@ std::list<NotifyArgs> CursorInputMapper::reset(nsecs_t when) { mDownTime = 0; mLastEventTime = std::numeric_limits<nsecs_t>::min(); mOldPointerVelocityControl.reset(); mNewPointerVelocityControl.reset(); mPointerVelocityControl.reset(); mWheelXVelocityControl.reset(); mWheelYVelocityControl.reset(); Loading Loading @@ -291,11 +287,7 @@ std::list<NotifyArgs> CursorInputMapper::sync(nsecs_t when, nsecs_t readTime) { mWheelYVelocityControl.move(when, nullptr, &vscroll); mWheelXVelocityControl.move(when, &hscroll, nullptr); if (mEnableNewMousePointerBallistics) { mNewPointerVelocityControl.move(when, &deltaX, &deltaY); } else { mOldPointerVelocityControl.move(when, &deltaX, &deltaY); } mPointerVelocityControl.move(when, &deltaX, &deltaY); float xCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION; float yCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION; Loading Loading @@ -486,27 +478,15 @@ void CursorInputMapper::configureOnPointerCapture(const InputReaderConfiguration void CursorInputMapper::configureOnChangePointerSpeed(const InputReaderConfiguration& config) { if (mParameters.mode == Parameters::Mode::POINTER_RELATIVE) { // Disable any acceleration or scaling for the pointer when Pointer Capture is enabled. if (mEnableNewMousePointerBallistics) { mNewPointerVelocityControl.setAccelerationEnabled(false); } else { mOldPointerVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); } mPointerVelocityControl.setAccelerationEnabled(false); mWheelXVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); mWheelYVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); } else { if (mEnableNewMousePointerBallistics) { mNewPointerVelocityControl.setAccelerationEnabled( mPointerVelocityControl.setAccelerationEnabled( config.displaysWithMousePointerAccelerationDisabled.count( mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0); mNewPointerVelocityControl.setCurve( mPointerVelocityControl.setCurve( createAccelerationCurveForPointerSensitivity(config.mousePointerSpeed)); } else { mOldPointerVelocityControl.setParameters( (config.displaysWithMousePointerAccelerationDisabled.count( mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0) ? config.pointerVelocityControlParameters : FLAT_VELOCITY_CONTROL_PARAMS); } mWheelXVelocityControl.setParameters(config.wheelVelocityControlParameters); mWheelYVelocityControl.setParameters(config.wheelVelocityControlParameters); } Loading services/inputflinger/reader/mapper/CursorInputMapper.h +1 −3 Original line number Diff line number Diff line Loading @@ -104,8 +104,7 @@ private: // Velocity controls for mouse pointer and wheel movements. // The controls for X and Y wheel movements are separate to keep them decoupled. SimpleVelocityControl mOldPointerVelocityControl; CurvedVelocityControl mNewPointerVelocityControl; CurvedVelocityControl mPointerVelocityControl; SimpleVelocityControl mWheelXVelocityControl; SimpleVelocityControl mWheelYVelocityControl; Loading @@ -120,7 +119,6 @@ private: nsecs_t mDownTime; nsecs_t mLastEventTime; const bool mEnableNewMousePointerBallistics; bool mMouseReverseVerticalScrolling = false; explicit CursorInputMapper(InputDeviceContext& deviceContext, Loading services/inputflinger/tests/CursorInputMapper_test.cpp +94 −179 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
libs/input/input_flags.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -93,13 +93,6 @@ flag { bug: "309018874" } flag { name: "enable_new_mouse_pointer_ballistics" namespace: "input" description: "Change the acceleration curves for mouse pointer movements to match the touchpad ones" bug: "315313622" } flag { name: "rate_limit_user_activity_poke_in_dispatcher" namespace: "input" Loading
services/inputflinger/include/InputReaderBase.h +6 −7 Original line number Diff line number Diff line Loading @@ -137,19 +137,18 @@ struct InputReaderConfiguration { ui::LogicalDisplayId defaultPointerDisplayId; // The mouse pointer speed, as a number from -7 (slowest) to 7 (fastest). // // Currently only used when the enable_new_mouse_pointer_ballistics flag is enabled. int32_t mousePointerSpeed; // Displays on which an acceleration curve shouldn't be applied for pointer movements from mice. // // Currently only used when the enable_new_mouse_pointer_ballistics flag is enabled. std::set<ui::LogicalDisplayId> displaysWithMousePointerAccelerationDisabled; // Velocity control parameters for mouse pointer movements. // Velocity control parameters for touchpad pointer movements on the old touchpad stack (based // on TouchInputMapper). // // For mice, these are ignored and the values of mousePointerSpeed and // mousePointerAccelerationEnabled used instead. // // If the enable_new_mouse_pointer_ballistics flag is enabled, these are ignored and the values // of mousePointerSpeed and mousePointerAccelerationEnabled used instead. // TODO(b/281840344): remove this. VelocityControlParameters pointerVelocityControlParameters; // Velocity control parameters for mouse wheel movements. Loading
services/inputflinger/reader/mapper/CursorInputMapper.cpp +9 −29 Original line number Diff line number Diff line Loading @@ -33,8 +33,6 @@ #include "input/PrintTools.h" namespace input_flags = com::android::input::flags; namespace android { // The default velocity control parameters that has no effect. Loading Loading @@ -77,8 +75,7 @@ void CursorMotionAccumulator::finishSync() { CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) : InputMapper(deviceContext, readerConfig), mLastEventTime(std::numeric_limits<nsecs_t>::min()), mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {} mLastEventTime(std::numeric_limits<nsecs_t>::min()) {} uint32_t CursorInputMapper::getSources() const { return mSource; Loading Loading @@ -207,8 +204,7 @@ std::list<NotifyArgs> CursorInputMapper::reset(nsecs_t when) { mDownTime = 0; mLastEventTime = std::numeric_limits<nsecs_t>::min(); mOldPointerVelocityControl.reset(); mNewPointerVelocityControl.reset(); mPointerVelocityControl.reset(); mWheelXVelocityControl.reset(); mWheelYVelocityControl.reset(); Loading Loading @@ -291,11 +287,7 @@ std::list<NotifyArgs> CursorInputMapper::sync(nsecs_t when, nsecs_t readTime) { mWheelYVelocityControl.move(when, nullptr, &vscroll); mWheelXVelocityControl.move(when, &hscroll, nullptr); if (mEnableNewMousePointerBallistics) { mNewPointerVelocityControl.move(when, &deltaX, &deltaY); } else { mOldPointerVelocityControl.move(when, &deltaX, &deltaY); } mPointerVelocityControl.move(when, &deltaX, &deltaY); float xCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION; float yCursorPosition = AMOTION_EVENT_INVALID_CURSOR_POSITION; Loading Loading @@ -486,27 +478,15 @@ void CursorInputMapper::configureOnPointerCapture(const InputReaderConfiguration void CursorInputMapper::configureOnChangePointerSpeed(const InputReaderConfiguration& config) { if (mParameters.mode == Parameters::Mode::POINTER_RELATIVE) { // Disable any acceleration or scaling for the pointer when Pointer Capture is enabled. if (mEnableNewMousePointerBallistics) { mNewPointerVelocityControl.setAccelerationEnabled(false); } else { mOldPointerVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); } mPointerVelocityControl.setAccelerationEnabled(false); mWheelXVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); mWheelYVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); } else { if (mEnableNewMousePointerBallistics) { mNewPointerVelocityControl.setAccelerationEnabled( mPointerVelocityControl.setAccelerationEnabled( config.displaysWithMousePointerAccelerationDisabled.count( mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0); mNewPointerVelocityControl.setCurve( mPointerVelocityControl.setCurve( createAccelerationCurveForPointerSensitivity(config.mousePointerSpeed)); } else { mOldPointerVelocityControl.setParameters( (config.displaysWithMousePointerAccelerationDisabled.count( mDisplayId.value_or(ui::LogicalDisplayId::INVALID)) == 0) ? config.pointerVelocityControlParameters : FLAT_VELOCITY_CONTROL_PARAMS); } mWheelXVelocityControl.setParameters(config.wheelVelocityControlParameters); mWheelYVelocityControl.setParameters(config.wheelVelocityControlParameters); } Loading
services/inputflinger/reader/mapper/CursorInputMapper.h +1 −3 Original line number Diff line number Diff line Loading @@ -104,8 +104,7 @@ private: // Velocity controls for mouse pointer and wheel movements. // The controls for X and Y wheel movements are separate to keep them decoupled. SimpleVelocityControl mOldPointerVelocityControl; CurvedVelocityControl mNewPointerVelocityControl; CurvedVelocityControl mPointerVelocityControl; SimpleVelocityControl mWheelXVelocityControl; SimpleVelocityControl mWheelYVelocityControl; Loading @@ -120,7 +119,6 @@ private: nsecs_t mDownTime; nsecs_t mLastEventTime; const bool mEnableNewMousePointerBallistics; bool mMouseReverseVerticalScrolling = false; explicit CursorInputMapper(InputDeviceContext& deviceContext, Loading
services/inputflinger/tests/CursorInputMapper_test.cpp +94 −179 File changed.Preview size limit exceeded, changes collapsed. Show changes