Loading services/inputflinger/reader/InputDevice.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when, using Change = InputReaderConfiguration::Change; if (!isIgnored()) { if (!changes.any() || !isIgnored()) { // Full configuration should happen the first time configure is called // and when the device type is changed. Changing a device type can // affect various other parameters so should result in a Loading Loading @@ -503,9 +503,9 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( classes.test(InputDeviceClass::TOUCH_MT) && !isSonyDualShock4Touchpad) { mappers.push_back(std::make_unique<TouchpadInputMapper>(contextPtr, readerConfig)); } else if (classes.test(InputDeviceClass::TOUCH_MT)) { mappers.push_back(std::make_unique<MultiTouchInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<MultiTouchInputMapper>(contextPtr, readerConfig)); } else if (classes.test(InputDeviceClass::TOUCH)) { mappers.push_back(std::make_unique<SingleTouchInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<SingleTouchInputMapper>(contextPtr, readerConfig)); } // Joystick-like devices. Loading services/inputflinger/reader/include/InputDevice.h +10 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,16 @@ public: return *mapper; } template <class T, typename... Args> T& constructAndAddMapper(int32_t eventHubId, Args... args) { // create mapper auto& devicePair = mDevices[eventHubId]; auto& deviceContext = devicePair.first; auto& mappers = devicePair.second; mappers.push_back(createInputMapper<T>(*deviceContext, args...)); return static_cast<T&>(*mappers.back()); } // construct and add a controller to the input device template <class T> T& addController(int32_t eventHubId) { Loading services/inputflinger/reader/mapper/InputMapper.h +26 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,20 @@ #include "VibrationElement.h" namespace android { /** * This is the factory method that must be used to create any InputMapper */ template <class T, class... Args> std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args) { // Using `new` to access non-public constructors. std::unique_ptr<T> mapper(new T(deviceContext, readerConfig, args...)); // We need to reset and configure the mapper to ensure it is ready to process event nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); std::list<NotifyArgs> unused = mapper->reset(now); unused += mapper->reconfigure(now, readerConfig, /*changes=*/{}); return mapper; } /* An input mapper transforms raw input events into cooked event data. * A single input device can have multiple associated input mappers in order to interpret Loading @@ -39,8 +53,15 @@ namespace android { */ class InputMapper { public: explicit InputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); /** * Subclasses must either provide a public constructor * or must be-friend the factory method. */ template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); virtual ~InputMapper(); inline int32_t getDeviceId() { return mDeviceContext.getId(); } Loading Loading @@ -102,6 +123,9 @@ public: protected: InputDeviceContext& mDeviceContext; explicit InputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); status_t getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo); void bumpGeneration(); Loading services/inputflinger/reader/mapper/MultiTouchInputMapper.h +7 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,11 @@ namespace android { class MultiTouchInputMapper : public TouchInputMapper { public: explicit MultiTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); ~MultiTouchInputMapper() override; [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; Loading @@ -36,6 +39,8 @@ protected: bool hasStylus() const override; private: explicit MultiTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); // simulate_stylus_with_touch is a debug mode that converts all finger pointers reported by this // mapper's touchscreen into stylus pointers, and adds SOURCE_STYLUS to the input device. // It is used to simulate stylus events for debugging and testing on a device that does not Loading services/inputflinger/reader/mapper/SingleTouchInputMapper.h +7 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,11 @@ namespace android { class SingleTouchInputMapper : public TouchInputMapper { public: explicit SingleTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); ~SingleTouchInputMapper() override; [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; Loading @@ -37,6 +40,8 @@ protected: private: SingleTouchMotionAccumulator mSingleTouchMotionAccumulator; explicit SingleTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); }; } // namespace android Loading
services/inputflinger/reader/InputDevice.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ std::list<NotifyArgs> InputDevice::configure(nsecs_t when, using Change = InputReaderConfiguration::Change; if (!isIgnored()) { if (!changes.any() || !isIgnored()) { // Full configuration should happen the first time configure is called // and when the device type is changed. Changing a device type can // affect various other parameters so should result in a Loading Loading @@ -503,9 +503,9 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( classes.test(InputDeviceClass::TOUCH_MT) && !isSonyDualShock4Touchpad) { mappers.push_back(std::make_unique<TouchpadInputMapper>(contextPtr, readerConfig)); } else if (classes.test(InputDeviceClass::TOUCH_MT)) { mappers.push_back(std::make_unique<MultiTouchInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<MultiTouchInputMapper>(contextPtr, readerConfig)); } else if (classes.test(InputDeviceClass::TOUCH)) { mappers.push_back(std::make_unique<SingleTouchInputMapper>(contextPtr, readerConfig)); mappers.push_back(createInputMapper<SingleTouchInputMapper>(contextPtr, readerConfig)); } // Joystick-like devices. Loading
services/inputflinger/reader/include/InputDevice.h +10 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,16 @@ public: return *mapper; } template <class T, typename... Args> T& constructAndAddMapper(int32_t eventHubId, Args... args) { // create mapper auto& devicePair = mDevices[eventHubId]; auto& deviceContext = devicePair.first; auto& mappers = devicePair.second; mappers.push_back(createInputMapper<T>(*deviceContext, args...)); return static_cast<T&>(*mappers.back()); } // construct and add a controller to the input device template <class T> T& addController(int32_t eventHubId) { Loading
services/inputflinger/reader/mapper/InputMapper.h +26 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,20 @@ #include "VibrationElement.h" namespace android { /** * This is the factory method that must be used to create any InputMapper */ template <class T, class... Args> std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args) { // Using `new` to access non-public constructors. std::unique_ptr<T> mapper(new T(deviceContext, readerConfig, args...)); // We need to reset and configure the mapper to ensure it is ready to process event nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); std::list<NotifyArgs> unused = mapper->reset(now); unused += mapper->reconfigure(now, readerConfig, /*changes=*/{}); return mapper; } /* An input mapper transforms raw input events into cooked event data. * A single input device can have multiple associated input mappers in order to interpret Loading @@ -39,8 +53,15 @@ namespace android { */ class InputMapper { public: explicit InputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); /** * Subclasses must either provide a public constructor * or must be-friend the factory method. */ template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); virtual ~InputMapper(); inline int32_t getDeviceId() { return mDeviceContext.getId(); } Loading Loading @@ -102,6 +123,9 @@ public: protected: InputDeviceContext& mDeviceContext; explicit InputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); status_t getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo); void bumpGeneration(); Loading
services/inputflinger/reader/mapper/MultiTouchInputMapper.h +7 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,11 @@ namespace android { class MultiTouchInputMapper : public TouchInputMapper { public: explicit MultiTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); ~MultiTouchInputMapper() override; [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; Loading @@ -36,6 +39,8 @@ protected: bool hasStylus() const override; private: explicit MultiTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); // simulate_stylus_with_touch is a debug mode that converts all finger pointers reported by this // mapper's touchscreen into stylus pointers, and adds SOURCE_STYLUS to the input device. // It is used to simulate stylus events for debugging and testing on a device that does not Loading
services/inputflinger/reader/mapper/SingleTouchInputMapper.h +7 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,11 @@ namespace android { class SingleTouchInputMapper : public TouchInputMapper { public: explicit SingleTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); template <class T, class... Args> friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig, Args... args); ~SingleTouchInputMapper() override; [[nodiscard]] std::list<NotifyArgs> reset(nsecs_t when) override; Loading @@ -37,6 +40,8 @@ protected: private: SingleTouchMotionAccumulator mSingleTouchMotionAccumulator; explicit SingleTouchInputMapper(InputDeviceContext& deviceContext, const InputReaderConfiguration& readerConfig); }; } // namespace android