Loading services/inputflinger/reader/mapper/CursorInputMapper.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,8 @@ namespace android { // The default velocity control parameters that has no effect. // The default velocity control parameters that has no effect. static const VelocityControlParameters FLAT_VELOCITY_CONTROL_PARAMS{}; static const VelocityControlParameters FLAT_VELOCITY_CONTROL_PARAMS{}; static const bool ENABLE_POINTER_CHOREOGRAPHER = input_flags::enable_pointer_choreographer(); // --- CursorMotionAccumulator --- // --- CursorMotionAccumulator --- CursorMotionAccumulator::CursorMotionAccumulator() { CursorMotionAccumulator::CursorMotionAccumulator() { Loading Loading @@ -76,9 +78,14 @@ void CursorMotionAccumulator::finishSync() { CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) const InputReaderConfiguration& readerConfig) : CursorInputMapper(deviceContext, readerConfig, ENABLE_POINTER_CHOREOGRAPHER) {} CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer) : InputMapper(deviceContext, readerConfig), : InputMapper(deviceContext, readerConfig), mLastEventTime(std::numeric_limits<nsecs_t>::min()), mLastEventTime(std::numeric_limits<nsecs_t>::min()), mEnablePointerChoreographer(input_flags::enable_pointer_choreographer()), mEnablePointerChoreographer(enablePointerChoreographer), mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {} mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {} CursorInputMapper::~CursorInputMapper() { CursorInputMapper::~CursorInputMapper() { Loading services/inputflinger/reader/mapper/CursorInputMapper.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -133,6 +133,10 @@ private: explicit CursorInputMapper(InputDeviceContext& deviceContext, explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); const InputReaderConfiguration& readerConfig); // Constructor for testing. explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer); void dumpParameters(std::string& dump); void dumpParameters(std::string& dump); void configureBasicParams(); void configureBasicParams(); void configureOnPointerCapture(const InputReaderConfiguration& config); void configureOnPointerCapture(const InputReaderConfiguration& config); Loading services/inputflinger/reader/mapper/TouchpadInputMapper.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,8 @@ namespace android { namespace { namespace { static const bool ENABLE_POINTER_CHOREOGRAPHER = input_flags::enable_pointer_choreographer(); /** /** * Log details of each gesture output by the gestures library. * Log details of each gesture output by the gestures library. * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG" (requires * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG" (requires Loading Loading @@ -232,6 +234,11 @@ private: TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) const InputReaderConfiguration& readerConfig) : TouchpadInputMapper(deviceContext, readerConfig, ENABLE_POINTER_CHOREOGRAPHER) {} TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer) : InputMapper(deviceContext, readerConfig), : InputMapper(deviceContext, readerConfig), mGestureInterpreter(NewGestureInterpreter(), DeleteGestureInterpreter), mGestureInterpreter(NewGestureInterpreter(), DeleteGestureInterpreter), mPointerController(getContext()->getPointerController(getDeviceId())), mPointerController(getContext()->getPointerController(getDeviceId())), Loading @@ -240,7 +247,7 @@ TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, mGestureConverter(*getContext(), deviceContext, getDeviceId()), mGestureConverter(*getContext(), deviceContext, getDeviceId()), mCapturedEventConverter(*getContext(), deviceContext, mMotionAccumulator, getDeviceId()), mCapturedEventConverter(*getContext(), deviceContext, mMotionAccumulator, getDeviceId()), mMetricsId(metricsIdFromInputDeviceIdentifier(deviceContext.getDeviceIdentifier())), mMetricsId(metricsIdFromInputDeviceIdentifier(deviceContext.getDeviceIdentifier())), mEnablePointerChoreographer(input_flags::enable_pointer_choreographer()) { mEnablePointerChoreographer(enablePointerChoreographer) { RawAbsoluteAxisInfo slotAxisInfo; RawAbsoluteAxisInfo slotAxisInfo; deviceContext.getAbsoluteAxisInfo(ABS_MT_SLOT, &slotAxisInfo); deviceContext.getAbsoluteAxisInfo(ABS_MT_SLOT, &slotAxisInfo); if (!slotAxisInfo.valid || slotAxisInfo.maxValue <= 0) { if (!slotAxisInfo.valid || slotAxisInfo.maxValue <= 0) { Loading services/inputflinger/reader/mapper/TouchpadInputMapper.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,10 @@ private: void resetGestureInterpreter(nsecs_t when); void resetGestureInterpreter(nsecs_t when); explicit TouchpadInputMapper(InputDeviceContext& deviceContext, explicit TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); const InputReaderConfiguration& readerConfig); // Constructor for testing. explicit TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer); void updatePalmDetectionMetrics(); void updatePalmDetectionMetrics(); [[nodiscard]] std::list<NotifyArgs> sendHardwareState(nsecs_t when, nsecs_t readTime, [[nodiscard]] std::list<NotifyArgs> sendHardwareState(nsecs_t when, nsecs_t readTime, SelfContainedHardwareState schs); SelfContainedHardwareState schs); Loading services/inputflinger/tests/CursorInputMapper_test.cpp +23 −11 Original line number Original line Diff line number Diff line Loading @@ -157,9 +157,12 @@ protected: mFakePolicy->addDisplayViewport(createPrimaryViewport(ui::Rotation::Rotation0)); mFakePolicy->addDisplayViewport(createPrimaryViewport(ui::Rotation::Rotation0)); } } virtual bool isPointerChoreographerEnabled() { return false; } void createMapper() { void createMapper() { createDevice(); createDevice(); mMapper = createInputMapper<CursorInputMapper>(*mDeviceContext, mReaderConfiguration); mMapper = createInputMapper<CursorInputMapper>(*mDeviceContext, mReaderConfiguration, isPointerChoreographerEnabled()); } } void setPointerCapture(bool enabled) { void setPointerCapture(bool enabled) { Loading Loading @@ -194,10 +197,11 @@ protected: class CursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { class CursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(false); input_flags::enable_new_mouse_pointer_ballistics(false); input_flags::enable_new_mouse_pointer_ballistics(false); CursorInputMapperUnitTestBase::SetUp(); CursorInputMapperUnitTestBase::SetUp(); } } bool isPointerChoreographerEnabled() override { return false; } }; }; TEST_F(CursorInputMapperUnitTest, GetSourcesReturnsMouseInPointerMode) { TEST_F(CursorInputMapperUnitTest, GetSourcesReturnsMouseInPointerMode) { Loading Loading @@ -321,10 +325,10 @@ TEST_F(CursorInputMapperUnitTest, ProcessPointerCapture) { // Disable pointer capture. Afterwards, events should be generated the usual way. // Disable pointer capture. Afterwards, events should be generated the usual way. setPointerCapture(false); setPointerCapture(false); const auto expectedCoords = input_flags::enable_pointer_choreographer() const auto expectedCoords = CursorInputMapperUnitTest::isPointerChoreographerEnabled() ? WithCoords(0, 0) ? WithCoords(0, 0) : WithCoords(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); : WithCoords(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); const auto expectedCursorPosition = input_flags::enable_pointer_choreographer() const auto expectedCursorPosition = CursorInputMapperUnitTest::isPointerChoreographerEnabled() ? WithCursorPosition(INVALID_CURSOR_POSITION, INVALID_CURSOR_POSITION) ? WithCursorPosition(INVALID_CURSOR_POSITION, INVALID_CURSOR_POSITION) : WithCursorPosition(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); : WithCursorPosition(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); args.clear(); args.clear(); Loading Loading @@ -708,7 +712,9 @@ TEST_F(CursorInputMapperUnitTest, ConfigureDisplayIdWithAssociatedViewport) { createDevice(); createDevice(); // Associate the InputDevice with the secondary display. // Associate the InputDevice with the secondary display. ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); mMapper = createInputMapper<CursorInputMapper>(deviceContext, mReaderConfiguration); mMapper = createInputMapper< CursorInputMapper>(deviceContext, mReaderConfiguration, CursorInputMapperUnitTest::isPointerChoreographerEnabled()); // Ensure input events are generated for the secondary display. // Ensure input events are generated for the secondary display. std::list<NotifyArgs> args; std::list<NotifyArgs> args; Loading @@ -731,7 +737,9 @@ TEST_F(CursorInputMapperUnitTest, ConfigureDisplayIdIgnoresEventsForMismatchedPo createDevice(); createDevice(); // Associate the InputDevice with the secondary display. // Associate the InputDevice with the secondary display. ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); mMapper = createInputMapper<CursorInputMapper>(deviceContext, mReaderConfiguration); mMapper = createInputMapper< CursorInputMapper>(deviceContext, mReaderConfiguration, CursorInputMapperUnitTest::isPointerChoreographerEnabled()); // The mapper should not generate any events because it is associated with a display that is // The mapper should not generate any events because it is associated with a display that is // different from the pointer display. // different from the pointer display. Loading Loading @@ -837,7 +845,9 @@ class CursorInputMapperButtonKeyTest : public CursorInputMapperUnitTest, : public CursorInputMapperUnitTest, public testing::WithParamInterface< public testing::WithParamInterface< std::tuple<int32_t /*evdevCode*/, int32_t /*expectedButtonState*/, std::tuple<int32_t /*evdevCode*/, int32_t /*expectedButtonState*/, int32_t /*expectedKeyCode*/>> {}; int32_t /*expectedKeyCode*/>> { virtual bool isPointerChoreographerEnabled() override { return false; } }; TEST_P(CursorInputMapperButtonKeyTest, ProcessShouldHandleButtonKey) { TEST_P(CursorInputMapperButtonKeyTest, ProcessShouldHandleButtonKey) { auto [evdevCode, expectedButtonState, expectedKeyCode] = GetParam(); auto [evdevCode, expectedButtonState, expectedKeyCode] = GetParam(); Loading Loading @@ -956,10 +966,11 @@ TEST_F(CursorInputMapperUnitTest, PointerCaptureDisablesVelocityProcessing) { class CursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { class CursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(true); input_flags::enable_new_mouse_pointer_ballistics(false); input_flags::enable_new_mouse_pointer_ballistics(false); CursorInputMapperUnitTestBase::SetUp(); CursorInputMapperUnitTestBase::SetUp(); } } bool isPointerChoreographerEnabled() override { return true; } }; }; TEST_F(CursorInputMapperUnitTestWithChoreographer, PopulateDeviceInfoReturnsRangeFromPolicy) { TEST_F(CursorInputMapperUnitTestWithChoreographer, PopulateDeviceInfoReturnsRangeFromPolicy) { Loading Loading @@ -1288,10 +1299,11 @@ TEST_F(CursorInputMapperUnitTestWithChoreographer, ConfigureDisplayIdNoAssociate class CursorInputMapperUnitTestWithNewBallistics : public CursorInputMapperUnitTestBase { class CursorInputMapperUnitTestWithNewBallistics : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(true); input_flags::enable_new_mouse_pointer_ballistics(true); input_flags::enable_new_mouse_pointer_ballistics(true); CursorInputMapperUnitTestBase::SetUp(); CursorInputMapperUnitTestBase::SetUp(); } } bool isPointerChoreographerEnabled() override { return true; } }; }; TEST_F(CursorInputMapperUnitTestWithNewBallistics, PointerCaptureDisablesVelocityProcessing) { TEST_F(CursorInputMapperUnitTestWithNewBallistics, PointerCaptureDisablesVelocityProcessing) { Loading Loading @@ -1413,7 +1425,6 @@ constexpr nsecs_t MAX_BLUETOOTH_SMOOTHING_DELTA = ms2ns(32); class BluetoothCursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { class BluetoothCursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(false); SetUpWithBus(BUS_BLUETOOTH); SetUpWithBus(BUS_BLUETOOTH); mFakePointerController = std::make_shared<FakePointerController>(); mFakePointerController = std::make_shared<FakePointerController>(); Loading Loading @@ -1531,12 +1542,13 @@ TEST_F(BluetoothCursorInputMapperUnitTest, TimestampSmootheningNotUsed) { class BluetoothCursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { class BluetoothCursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(true); SetUpWithBus(BUS_BLUETOOTH); SetUpWithBus(BUS_BLUETOOTH); mFakePointerController = std::make_shared<FakePointerController>(); mFakePointerController = std::make_shared<FakePointerController>(); mFakePolicy->setPointerController(mFakePointerController); mFakePolicy->setPointerController(mFakePointerController); } } bool isPointerChoreographerEnabled() override { return true; } }; }; TEST_F(BluetoothCursorInputMapperUnitTestWithChoreographer, TimestampSmoothening) { TEST_F(BluetoothCursorInputMapperUnitTestWithChoreographer, TimestampSmoothening) { Loading Loading
services/inputflinger/reader/mapper/CursorInputMapper.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,8 @@ namespace android { // The default velocity control parameters that has no effect. // The default velocity control parameters that has no effect. static const VelocityControlParameters FLAT_VELOCITY_CONTROL_PARAMS{}; static const VelocityControlParameters FLAT_VELOCITY_CONTROL_PARAMS{}; static const bool ENABLE_POINTER_CHOREOGRAPHER = input_flags::enable_pointer_choreographer(); // --- CursorMotionAccumulator --- // --- CursorMotionAccumulator --- CursorMotionAccumulator::CursorMotionAccumulator() { CursorMotionAccumulator::CursorMotionAccumulator() { Loading Loading @@ -76,9 +78,14 @@ void CursorMotionAccumulator::finishSync() { CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) const InputReaderConfiguration& readerConfig) : CursorInputMapper(deviceContext, readerConfig, ENABLE_POINTER_CHOREOGRAPHER) {} CursorInputMapper::CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer) : InputMapper(deviceContext, readerConfig), : InputMapper(deviceContext, readerConfig), mLastEventTime(std::numeric_limits<nsecs_t>::min()), mLastEventTime(std::numeric_limits<nsecs_t>::min()), mEnablePointerChoreographer(input_flags::enable_pointer_choreographer()), mEnablePointerChoreographer(enablePointerChoreographer), mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {} mEnableNewMousePointerBallistics(input_flags::enable_new_mouse_pointer_ballistics()) {} CursorInputMapper::~CursorInputMapper() { CursorInputMapper::~CursorInputMapper() { Loading
services/inputflinger/reader/mapper/CursorInputMapper.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -133,6 +133,10 @@ private: explicit CursorInputMapper(InputDeviceContext& deviceContext, explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); const InputReaderConfiguration& readerConfig); // Constructor for testing. explicit CursorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer); void dumpParameters(std::string& dump); void dumpParameters(std::string& dump); void configureBasicParams(); void configureBasicParams(); void configureOnPointerCapture(const InputReaderConfiguration& config); void configureOnPointerCapture(const InputReaderConfiguration& config); Loading
services/inputflinger/reader/mapper/TouchpadInputMapper.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,8 @@ namespace android { namespace { namespace { static const bool ENABLE_POINTER_CHOREOGRAPHER = input_flags::enable_pointer_choreographer(); /** /** * Log details of each gesture output by the gestures library. * Log details of each gesture output by the gestures library. * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG" (requires * Enable this via "adb shell setprop log.tag.TouchpadInputMapperGestures DEBUG" (requires Loading Loading @@ -232,6 +234,11 @@ private: TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig) const InputReaderConfiguration& readerConfig) : TouchpadInputMapper(deviceContext, readerConfig, ENABLE_POINTER_CHOREOGRAPHER) {} TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer) : InputMapper(deviceContext, readerConfig), : InputMapper(deviceContext, readerConfig), mGestureInterpreter(NewGestureInterpreter(), DeleteGestureInterpreter), mGestureInterpreter(NewGestureInterpreter(), DeleteGestureInterpreter), mPointerController(getContext()->getPointerController(getDeviceId())), mPointerController(getContext()->getPointerController(getDeviceId())), Loading @@ -240,7 +247,7 @@ TouchpadInputMapper::TouchpadInputMapper(InputDeviceContext& deviceContext, mGestureConverter(*getContext(), deviceContext, getDeviceId()), mGestureConverter(*getContext(), deviceContext, getDeviceId()), mCapturedEventConverter(*getContext(), deviceContext, mMotionAccumulator, getDeviceId()), mCapturedEventConverter(*getContext(), deviceContext, mMotionAccumulator, getDeviceId()), mMetricsId(metricsIdFromInputDeviceIdentifier(deviceContext.getDeviceIdentifier())), mMetricsId(metricsIdFromInputDeviceIdentifier(deviceContext.getDeviceIdentifier())), mEnablePointerChoreographer(input_flags::enable_pointer_choreographer()) { mEnablePointerChoreographer(enablePointerChoreographer) { RawAbsoluteAxisInfo slotAxisInfo; RawAbsoluteAxisInfo slotAxisInfo; deviceContext.getAbsoluteAxisInfo(ABS_MT_SLOT, &slotAxisInfo); deviceContext.getAbsoluteAxisInfo(ABS_MT_SLOT, &slotAxisInfo); if (!slotAxisInfo.valid || slotAxisInfo.maxValue <= 0) { if (!slotAxisInfo.valid || slotAxisInfo.maxValue <= 0) { Loading
services/inputflinger/reader/mapper/TouchpadInputMapper.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,10 @@ private: void resetGestureInterpreter(nsecs_t when); void resetGestureInterpreter(nsecs_t when); explicit TouchpadInputMapper(InputDeviceContext& deviceContext, explicit TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); const InputReaderConfiguration& readerConfig); // Constructor for testing. explicit TouchpadInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, bool enablePointerChoreographer); void updatePalmDetectionMetrics(); void updatePalmDetectionMetrics(); [[nodiscard]] std::list<NotifyArgs> sendHardwareState(nsecs_t when, nsecs_t readTime, [[nodiscard]] std::list<NotifyArgs> sendHardwareState(nsecs_t when, nsecs_t readTime, SelfContainedHardwareState schs); SelfContainedHardwareState schs); Loading
services/inputflinger/tests/CursorInputMapper_test.cpp +23 −11 Original line number Original line Diff line number Diff line Loading @@ -157,9 +157,12 @@ protected: mFakePolicy->addDisplayViewport(createPrimaryViewport(ui::Rotation::Rotation0)); mFakePolicy->addDisplayViewport(createPrimaryViewport(ui::Rotation::Rotation0)); } } virtual bool isPointerChoreographerEnabled() { return false; } void createMapper() { void createMapper() { createDevice(); createDevice(); mMapper = createInputMapper<CursorInputMapper>(*mDeviceContext, mReaderConfiguration); mMapper = createInputMapper<CursorInputMapper>(*mDeviceContext, mReaderConfiguration, isPointerChoreographerEnabled()); } } void setPointerCapture(bool enabled) { void setPointerCapture(bool enabled) { Loading Loading @@ -194,10 +197,11 @@ protected: class CursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { class CursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(false); input_flags::enable_new_mouse_pointer_ballistics(false); input_flags::enable_new_mouse_pointer_ballistics(false); CursorInputMapperUnitTestBase::SetUp(); CursorInputMapperUnitTestBase::SetUp(); } } bool isPointerChoreographerEnabled() override { return false; } }; }; TEST_F(CursorInputMapperUnitTest, GetSourcesReturnsMouseInPointerMode) { TEST_F(CursorInputMapperUnitTest, GetSourcesReturnsMouseInPointerMode) { Loading Loading @@ -321,10 +325,10 @@ TEST_F(CursorInputMapperUnitTest, ProcessPointerCapture) { // Disable pointer capture. Afterwards, events should be generated the usual way. // Disable pointer capture. Afterwards, events should be generated the usual way. setPointerCapture(false); setPointerCapture(false); const auto expectedCoords = input_flags::enable_pointer_choreographer() const auto expectedCoords = CursorInputMapperUnitTest::isPointerChoreographerEnabled() ? WithCoords(0, 0) ? WithCoords(0, 0) : WithCoords(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); : WithCoords(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); const auto expectedCursorPosition = input_flags::enable_pointer_choreographer() const auto expectedCursorPosition = CursorInputMapperUnitTest::isPointerChoreographerEnabled() ? WithCursorPosition(INVALID_CURSOR_POSITION, INVALID_CURSOR_POSITION) ? WithCursorPosition(INVALID_CURSOR_POSITION, INVALID_CURSOR_POSITION) : WithCursorPosition(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); : WithCursorPosition(INITIAL_CURSOR_X + 10.0f, INITIAL_CURSOR_Y + 20.0f); args.clear(); args.clear(); Loading Loading @@ -708,7 +712,9 @@ TEST_F(CursorInputMapperUnitTest, ConfigureDisplayIdWithAssociatedViewport) { createDevice(); createDevice(); // Associate the InputDevice with the secondary display. // Associate the InputDevice with the secondary display. ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); mMapper = createInputMapper<CursorInputMapper>(deviceContext, mReaderConfiguration); mMapper = createInputMapper< CursorInputMapper>(deviceContext, mReaderConfiguration, CursorInputMapperUnitTest::isPointerChoreographerEnabled()); // Ensure input events are generated for the secondary display. // Ensure input events are generated for the secondary display. std::list<NotifyArgs> args; std::list<NotifyArgs> args; Loading @@ -731,7 +737,9 @@ TEST_F(CursorInputMapperUnitTest, ConfigureDisplayIdIgnoresEventsForMismatchedPo createDevice(); createDevice(); // Associate the InputDevice with the secondary display. // Associate the InputDevice with the secondary display. ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); ViewportFakingInputDeviceContext deviceContext(*mDevice, EVENTHUB_ID, secondaryViewport); mMapper = createInputMapper<CursorInputMapper>(deviceContext, mReaderConfiguration); mMapper = createInputMapper< CursorInputMapper>(deviceContext, mReaderConfiguration, CursorInputMapperUnitTest::isPointerChoreographerEnabled()); // The mapper should not generate any events because it is associated with a display that is // The mapper should not generate any events because it is associated with a display that is // different from the pointer display. // different from the pointer display. Loading Loading @@ -837,7 +845,9 @@ class CursorInputMapperButtonKeyTest : public CursorInputMapperUnitTest, : public CursorInputMapperUnitTest, public testing::WithParamInterface< public testing::WithParamInterface< std::tuple<int32_t /*evdevCode*/, int32_t /*expectedButtonState*/, std::tuple<int32_t /*evdevCode*/, int32_t /*expectedButtonState*/, int32_t /*expectedKeyCode*/>> {}; int32_t /*expectedKeyCode*/>> { virtual bool isPointerChoreographerEnabled() override { return false; } }; TEST_P(CursorInputMapperButtonKeyTest, ProcessShouldHandleButtonKey) { TEST_P(CursorInputMapperButtonKeyTest, ProcessShouldHandleButtonKey) { auto [evdevCode, expectedButtonState, expectedKeyCode] = GetParam(); auto [evdevCode, expectedButtonState, expectedKeyCode] = GetParam(); Loading Loading @@ -956,10 +966,11 @@ TEST_F(CursorInputMapperUnitTest, PointerCaptureDisablesVelocityProcessing) { class CursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { class CursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(true); input_flags::enable_new_mouse_pointer_ballistics(false); input_flags::enable_new_mouse_pointer_ballistics(false); CursorInputMapperUnitTestBase::SetUp(); CursorInputMapperUnitTestBase::SetUp(); } } bool isPointerChoreographerEnabled() override { return true; } }; }; TEST_F(CursorInputMapperUnitTestWithChoreographer, PopulateDeviceInfoReturnsRangeFromPolicy) { TEST_F(CursorInputMapperUnitTestWithChoreographer, PopulateDeviceInfoReturnsRangeFromPolicy) { Loading Loading @@ -1288,10 +1299,11 @@ TEST_F(CursorInputMapperUnitTestWithChoreographer, ConfigureDisplayIdNoAssociate class CursorInputMapperUnitTestWithNewBallistics : public CursorInputMapperUnitTestBase { class CursorInputMapperUnitTestWithNewBallistics : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(true); input_flags::enable_new_mouse_pointer_ballistics(true); input_flags::enable_new_mouse_pointer_ballistics(true); CursorInputMapperUnitTestBase::SetUp(); CursorInputMapperUnitTestBase::SetUp(); } } bool isPointerChoreographerEnabled() override { return true; } }; }; TEST_F(CursorInputMapperUnitTestWithNewBallistics, PointerCaptureDisablesVelocityProcessing) { TEST_F(CursorInputMapperUnitTestWithNewBallistics, PointerCaptureDisablesVelocityProcessing) { Loading Loading @@ -1413,7 +1425,6 @@ constexpr nsecs_t MAX_BLUETOOTH_SMOOTHING_DELTA = ms2ns(32); class BluetoothCursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { class BluetoothCursorInputMapperUnitTest : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(false); SetUpWithBus(BUS_BLUETOOTH); SetUpWithBus(BUS_BLUETOOTH); mFakePointerController = std::make_shared<FakePointerController>(); mFakePointerController = std::make_shared<FakePointerController>(); Loading Loading @@ -1531,12 +1542,13 @@ TEST_F(BluetoothCursorInputMapperUnitTest, TimestampSmootheningNotUsed) { class BluetoothCursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { class BluetoothCursorInputMapperUnitTestWithChoreographer : public CursorInputMapperUnitTestBase { protected: protected: void SetUp() override { void SetUp() override { input_flags::enable_pointer_choreographer(true); SetUpWithBus(BUS_BLUETOOTH); SetUpWithBus(BUS_BLUETOOTH); mFakePointerController = std::make_shared<FakePointerController>(); mFakePointerController = std::make_shared<FakePointerController>(); mFakePolicy->setPointerController(mFakePointerController); mFakePolicy->setPointerController(mFakePointerController); } } bool isPointerChoreographerEnabled() override { return true; } }; }; TEST_F(BluetoothCursorInputMapperUnitTestWithChoreographer, TimestampSmoothening) { TEST_F(BluetoothCursorInputMapperUnitTestWithChoreographer, TimestampSmoothening) { Loading