Loading services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -515,7 +515,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Motion sensor enabled devices. // Motion sensor enabled devices. if (classes.test(InputDeviceClass::SENSOR)) { if (classes.test(InputDeviceClass::SENSOR)) { mappers.push_back(std::make_unique<SensorInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<SensorInputMapper>(contextPtr, readerConfig)); } } // External stylus-like devices. // External stylus-like devices. Loading services/inputflinger/reader/mapper/SensorInputMapper.h +7 −2 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,10 @@ static constexpr ssize_t SENSOR_VEC_LEN = 3; class SensorInputMapper : public InputMapper { class SensorInputMapper : public InputMapper { public: public: explicit SensorInputMapper(InputDeviceContext& deviceContext, template <class T, class... Args> const InputReaderConfiguration& readerConfig); friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); ~SensorInputMapper() override; ~SensorInputMapper() override; uint32_t getSources() const override; uint32_t getSources() const override; Loading Loading @@ -106,6 +108,9 @@ private: } } }; }; explicit SensorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); static Axis createAxis(const AxisInfo& AxisInfo, const RawAbsoluteAxisInfo& rawAxisInfo); static Axis createAxis(const AxisInfo& AxisInfo, const RawAbsoluteAxisInfo& rawAxisInfo); // Axes indexed by raw ABS_* axis index. // Axes indexed by raw ABS_* axis index. Loading services/inputflinger/tests/InputReader_test.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -2784,7 +2784,7 @@ void SensorInputMapperTest::setGyroProperties() { } } TEST_F(SensorInputMapperTest, GetSources) { TEST_F(SensorInputMapperTest, GetSources) { SensorInputMapper& mapper = addMapperAndConfigure<SensorInputMapper>(); SensorInputMapper& mapper = constructAndAddMapper<SensorInputMapper>(); ASSERT_EQ(static_cast<uint32_t>(AINPUT_SOURCE_SENSOR), mapper.getSources()); ASSERT_EQ(static_cast<uint32_t>(AINPUT_SOURCE_SENSOR), mapper.getSources()); } } Loading @@ -2792,7 +2792,7 @@ TEST_F(SensorInputMapperTest, GetSources) { TEST_F(SensorInputMapperTest, ProcessAccelerometerSensor) { TEST_F(SensorInputMapperTest, ProcessAccelerometerSensor) { setAccelProperties(); setAccelProperties(); prepareAccelAxes(); prepareAccelAxes(); SensorInputMapper& mapper = addMapperAndConfigure<SensorInputMapper>(); SensorInputMapper& mapper = constructAndAddMapper<SensorInputMapper>(); ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::ACCELEROMETER, ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::ACCELEROMETER, std::chrono::microseconds(10000), std::chrono::microseconds(10000), Loading Loading @@ -2822,7 +2822,7 @@ TEST_F(SensorInputMapperTest, ProcessAccelerometerSensor) { TEST_F(SensorInputMapperTest, ProcessGyroscopeSensor) { TEST_F(SensorInputMapperTest, ProcessGyroscopeSensor) { setGyroProperties(); setGyroProperties(); prepareGyroAxes(); prepareGyroAxes(); SensorInputMapper& mapper = addMapperAndConfigure<SensorInputMapper>(); SensorInputMapper& mapper = constructAndAddMapper<SensorInputMapper>(); ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::GYROSCOPE, ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::GYROSCOPE, std::chrono::microseconds(10000), std::chrono::microseconds(10000), Loading Loading
services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -515,7 +515,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Motion sensor enabled devices. // Motion sensor enabled devices. if (classes.test(InputDeviceClass::SENSOR)) { if (classes.test(InputDeviceClass::SENSOR)) { mappers.push_back(std::make_unique<SensorInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<SensorInputMapper>(contextPtr, readerConfig)); } } // External stylus-like devices. // External stylus-like devices. Loading
services/inputflinger/reader/mapper/SensorInputMapper.h +7 −2 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,10 @@ static constexpr ssize_t SENSOR_VEC_LEN = 3; class SensorInputMapper : public InputMapper { class SensorInputMapper : public InputMapper { public: public: explicit SensorInputMapper(InputDeviceContext& deviceContext, template <class T, class... Args> const InputReaderConfiguration& readerConfig); friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); ~SensorInputMapper() override; ~SensorInputMapper() override; uint32_t getSources() const override; uint32_t getSources() const override; Loading Loading @@ -106,6 +108,9 @@ private: } } }; }; explicit SensorInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); static Axis createAxis(const AxisInfo& AxisInfo, const RawAbsoluteAxisInfo& rawAxisInfo); static Axis createAxis(const AxisInfo& AxisInfo, const RawAbsoluteAxisInfo& rawAxisInfo); // Axes indexed by raw ABS_* axis index. // Axes indexed by raw ABS_* axis index. Loading
services/inputflinger/tests/InputReader_test.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -2784,7 +2784,7 @@ void SensorInputMapperTest::setGyroProperties() { } } TEST_F(SensorInputMapperTest, GetSources) { TEST_F(SensorInputMapperTest, GetSources) { SensorInputMapper& mapper = addMapperAndConfigure<SensorInputMapper>(); SensorInputMapper& mapper = constructAndAddMapper<SensorInputMapper>(); ASSERT_EQ(static_cast<uint32_t>(AINPUT_SOURCE_SENSOR), mapper.getSources()); ASSERT_EQ(static_cast<uint32_t>(AINPUT_SOURCE_SENSOR), mapper.getSources()); } } Loading @@ -2792,7 +2792,7 @@ TEST_F(SensorInputMapperTest, GetSources) { TEST_F(SensorInputMapperTest, ProcessAccelerometerSensor) { TEST_F(SensorInputMapperTest, ProcessAccelerometerSensor) { setAccelProperties(); setAccelProperties(); prepareAccelAxes(); prepareAccelAxes(); SensorInputMapper& mapper = addMapperAndConfigure<SensorInputMapper>(); SensorInputMapper& mapper = constructAndAddMapper<SensorInputMapper>(); ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::ACCELEROMETER, ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::ACCELEROMETER, std::chrono::microseconds(10000), std::chrono::microseconds(10000), Loading Loading @@ -2822,7 +2822,7 @@ TEST_F(SensorInputMapperTest, ProcessAccelerometerSensor) { TEST_F(SensorInputMapperTest, ProcessGyroscopeSensor) { TEST_F(SensorInputMapperTest, ProcessGyroscopeSensor) { setGyroProperties(); setGyroProperties(); prepareGyroAxes(); prepareGyroAxes(); SensorInputMapper& mapper = addMapperAndConfigure<SensorInputMapper>(); SensorInputMapper& mapper = constructAndAddMapper<SensorInputMapper>(); ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::GYROSCOPE, ASSERT_TRUE(mapper.enableSensor(InputDeviceSensorType::GYROSCOPE, std::chrono::microseconds(10000), std::chrono::microseconds(10000), Loading