Loading services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -456,7 +456,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Vibrator-like devices. // Vibrator-like devices. if (classes.test(InputDeviceClass::VIBRATOR)) { if (classes.test(InputDeviceClass::VIBRATOR)) { mappers.push_back(std::make_unique<VibratorInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<VibratorInputMapper>(contextPtr, readerConfig)); } } // Battery-like devices or light-containing devices. // Battery-like devices or light-containing devices. Loading services/inputflinger/reader/mapper/VibratorInputMapper.h +6 −2 Original line number Original line Diff line number Diff line Loading @@ -22,8 +22,10 @@ namespace android { class VibratorInputMapper : public InputMapper { class VibratorInputMapper : public InputMapper { public: public: explicit VibratorInputMapper(InputDeviceContext& deviceContext, template <class T, class... Args> const InputReaderConfiguration& readerConfig); friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); virtual ~VibratorInputMapper(); virtual ~VibratorInputMapper(); virtual uint32_t getSources() const override; virtual uint32_t getSources() const override; Loading @@ -46,6 +48,8 @@ private: ssize_t mIndex; ssize_t mIndex; nsecs_t mNextStepTime; nsecs_t mNextStepTime; explicit VibratorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); [[nodiscard]] std::list<NotifyArgs> nextStep(); [[nodiscard]] std::list<NotifyArgs> nextStep(); [[nodiscard]] NotifyVibratorStateArgs stopVibrating(); [[nodiscard]] NotifyVibratorStateArgs stopVibrating(); }; }; Loading services/inputflinger/tests/InputReader_test.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -2645,13 +2645,13 @@ protected: }; }; TEST_F(VibratorInputMapperTest, GetSources) { TEST_F(VibratorInputMapperTest, GetSources) { VibratorInputMapper& mapper = addMapperAndConfigure<VibratorInputMapper>(); VibratorInputMapper& mapper = constructAndAddMapper<VibratorInputMapper>(); ASSERT_EQ(AINPUT_SOURCE_UNKNOWN, mapper.getSources()); ASSERT_EQ(AINPUT_SOURCE_UNKNOWN, mapper.getSources()); } } TEST_F(VibratorInputMapperTest, GetVibratorIds) { TEST_F(VibratorInputMapperTest, GetVibratorIds) { VibratorInputMapper& mapper = addMapperAndConfigure<VibratorInputMapper>(); VibratorInputMapper& mapper = constructAndAddMapper<VibratorInputMapper>(); ASSERT_EQ(mapper.getVibratorIds().size(), 2U); ASSERT_EQ(mapper.getVibratorIds().size(), 2U); } } Loading @@ -2659,7 +2659,7 @@ TEST_F(VibratorInputMapperTest, GetVibratorIds) { TEST_F(VibratorInputMapperTest, Vibrate) { TEST_F(VibratorInputMapperTest, Vibrate) { constexpr uint8_t DEFAULT_AMPLITUDE = 192; constexpr uint8_t DEFAULT_AMPLITUDE = 192; constexpr int32_t VIBRATION_TOKEN = 100; constexpr int32_t VIBRATION_TOKEN = 100; VibratorInputMapper& mapper = addMapperAndConfigure<VibratorInputMapper>(); VibratorInputMapper& mapper = constructAndAddMapper<VibratorInputMapper>(); VibrationElement pattern(2); VibrationElement pattern(2); VibrationSequence sequence(2); VibrationSequence sequence(2); Loading Loading
services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -456,7 +456,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Vibrator-like devices. // Vibrator-like devices. if (classes.test(InputDeviceClass::VIBRATOR)) { if (classes.test(InputDeviceClass::VIBRATOR)) { mappers.push_back(std::make_unique<VibratorInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<VibratorInputMapper>(contextPtr, readerConfig)); } } // Battery-like devices or light-containing devices. // Battery-like devices or light-containing devices. Loading
services/inputflinger/reader/mapper/VibratorInputMapper.h +6 −2 Original line number Original line Diff line number Diff line Loading @@ -22,8 +22,10 @@ namespace android { class VibratorInputMapper : public InputMapper { class VibratorInputMapper : public InputMapper { public: public: explicit VibratorInputMapper(InputDeviceContext& deviceContext, template <class T, class... Args> const InputReaderConfiguration& readerConfig); friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); virtual ~VibratorInputMapper(); virtual ~VibratorInputMapper(); virtual uint32_t getSources() const override; virtual uint32_t getSources() const override; Loading @@ -46,6 +48,8 @@ private: ssize_t mIndex; ssize_t mIndex; nsecs_t mNextStepTime; nsecs_t mNextStepTime; explicit VibratorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); [[nodiscard]] std::list<NotifyArgs> nextStep(); [[nodiscard]] std::list<NotifyArgs> nextStep(); [[nodiscard]] NotifyVibratorStateArgs stopVibrating(); [[nodiscard]] NotifyVibratorStateArgs stopVibrating(); }; }; Loading
services/inputflinger/tests/InputReader_test.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -2645,13 +2645,13 @@ protected: }; }; TEST_F(VibratorInputMapperTest, GetSources) { TEST_F(VibratorInputMapperTest, GetSources) { VibratorInputMapper& mapper = addMapperAndConfigure<VibratorInputMapper>(); VibratorInputMapper& mapper = constructAndAddMapper<VibratorInputMapper>(); ASSERT_EQ(AINPUT_SOURCE_UNKNOWN, mapper.getSources()); ASSERT_EQ(AINPUT_SOURCE_UNKNOWN, mapper.getSources()); } } TEST_F(VibratorInputMapperTest, GetVibratorIds) { TEST_F(VibratorInputMapperTest, GetVibratorIds) { VibratorInputMapper& mapper = addMapperAndConfigure<VibratorInputMapper>(); VibratorInputMapper& mapper = constructAndAddMapper<VibratorInputMapper>(); ASSERT_EQ(mapper.getVibratorIds().size(), 2U); ASSERT_EQ(mapper.getVibratorIds().size(), 2U); } } Loading @@ -2659,7 +2659,7 @@ TEST_F(VibratorInputMapperTest, GetVibratorIds) { TEST_F(VibratorInputMapperTest, Vibrate) { TEST_F(VibratorInputMapperTest, Vibrate) { constexpr uint8_t DEFAULT_AMPLITUDE = 192; constexpr uint8_t DEFAULT_AMPLITUDE = 192; constexpr int32_t VIBRATION_TOKEN = 100; constexpr int32_t VIBRATION_TOKEN = 100; VibratorInputMapper& mapper = addMapperAndConfigure<VibratorInputMapper>(); VibratorInputMapper& mapper = constructAndAddMapper<VibratorInputMapper>(); VibrationElement pattern(2); VibrationElement pattern(2); VibrationSequence sequence(2); VibrationSequence sequence(2); Loading