Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd1c5e80 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disable density based scaling on pointer capture" into main

parents 5ede2629 f61c6dd7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
    }

+26 −0
Original line number Diff line number Diff line
@@ -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.