Loading services/inputflinger/reader/mapper/CursorInputMapper.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,7 @@ void CursorInputMapper::configureOnChangePointerSpeed(const InputReaderConfigura mPointerVelocityControl.setAccelerationEnabled(false); mWheelXVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); mWheelYVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); mXScale = mYScale = 1.0; return; } Loading services/inputflinger/tests/CursorInputMapper_test.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -1293,6 +1293,32 @@ TEST_F(DensityDependentCursorUnitTest, WithRelativeMotion(rawRelativeX, rawRelativeY))))); } TEST_F(DensityDependentCursorUnitTest, DoesNotScaleCursorMoveWithPointerCaptureEnabled) { // Create a medium density viewport, that should have scaling enabled by default. DisplayViewport mediumDensityViewport = createPrimaryViewport(ui::Rotation::Rotation0, ACONFIGURATION_DENSITY_MEDIUM); mReaderConfiguration.setDisplayViewports({mediumDensityViewport}); EXPECT_CALL((*mDevice), getAssociatedViewport).WillRepeatedly(Return(mediumDensityViewport)); mMapper = createInputMapper<CursorInputMapper>(*mDeviceContext, mReaderConfiguration); // Request pointer capture after the mapper has been configured. setPointerCapture(true); // Verify pointer capture has been enabled. const int32_t rawRelativeX = 10; const int32_t rawRelativeY = 20; std::list<NotifyArgs> args; args += processRelativeMove(rawRelativeX, rawRelativeY); ASSERT_THAT(args, ElementsAre(VariantWith<NotifyMotionArgs>( AllOf(WithMotionAction(ACTION_MOVE), WithSource(AINPUT_SOURCE_MOUSE_RELATIVE), WithCoords(rawRelativeX, rawRelativeY), WithRelativeMotion(rawRelativeX, rawRelativeY), WithCursorPosition(INVALID_CURSOR_POSITION, INVALID_CURSOR_POSITION))))); } namespace { // Minimum timestamp separation between subsequent input events from a Bluetooth device. Loading Loading
services/inputflinger/reader/mapper/CursorInputMapper.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,7 @@ void CursorInputMapper::configureOnChangePointerSpeed(const InputReaderConfigura mPointerVelocityControl.setAccelerationEnabled(false); mWheelXVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); mWheelYVelocityControl.setParameters(FLAT_VELOCITY_CONTROL_PARAMS); mXScale = mYScale = 1.0; return; } Loading
services/inputflinger/tests/CursorInputMapper_test.cpp +26 −0 Original line number Diff line number Diff line Loading @@ -1293,6 +1293,32 @@ TEST_F(DensityDependentCursorUnitTest, WithRelativeMotion(rawRelativeX, rawRelativeY))))); } TEST_F(DensityDependentCursorUnitTest, DoesNotScaleCursorMoveWithPointerCaptureEnabled) { // Create a medium density viewport, that should have scaling enabled by default. DisplayViewport mediumDensityViewport = createPrimaryViewport(ui::Rotation::Rotation0, ACONFIGURATION_DENSITY_MEDIUM); mReaderConfiguration.setDisplayViewports({mediumDensityViewport}); EXPECT_CALL((*mDevice), getAssociatedViewport).WillRepeatedly(Return(mediumDensityViewport)); mMapper = createInputMapper<CursorInputMapper>(*mDeviceContext, mReaderConfiguration); // Request pointer capture after the mapper has been configured. setPointerCapture(true); // Verify pointer capture has been enabled. const int32_t rawRelativeX = 10; const int32_t rawRelativeY = 20; std::list<NotifyArgs> args; args += processRelativeMove(rawRelativeX, rawRelativeY); ASSERT_THAT(args, ElementsAre(VariantWith<NotifyMotionArgs>( AllOf(WithMotionAction(ACTION_MOVE), WithSource(AINPUT_SOURCE_MOUSE_RELATIVE), WithCoords(rawRelativeX, rawRelativeY), WithRelativeMotion(rawRelativeX, rawRelativeY), WithCursorPosition(INVALID_CURSOR_POSITION, INVALID_CURSOR_POSITION))))); } namespace { // Minimum timestamp separation between subsequent input events from a Bluetooth device. Loading