diff options
| author | 2023-05-11 09:10:49 +0000 | |
|---|---|---|
| committer | 2023-05-11 09:10:49 +0000 | |
| commit | 8a716ebf533de4e83ec4c01c9b622de90d335e0b (patch) | |
| tree | ca7e8789166f7ffc750969c6b2249645b9470a3d | |
| parent | d11bfd8d7d51b8474de2af4545acfc19d04f545b (diff) | |
| parent | a04c0f68ee7623c59f1900b40fa9b464dbfd061a (diff) | |
Merge "InputMapper refactor: RotaryEncoderInputMapper" into udc-dev am: a04c0f68ee
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/23104521
Change-Id: I1b1fb89a11e913f77aa474ee7c58b79add78ef99
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/inputflinger/reader/InputDevice.cpp | 2 | ||||
| -rw-r--r-- | services/inputflinger/reader/mapper/RotaryEncoderInputMapper.h | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp index 225d7b4cba..3f6d557aa8 100644 --- a/services/inputflinger/reader/InputDevice.cpp +++ b/services/inputflinger/reader/InputDevice.cpp @@ -451,7 +451,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers( // Scroll wheel-like devices. if (classes.test(InputDeviceClass::ROTARY_ENCODER)) { - mappers.push_back(std::make_unique<RotaryEncoderInputMapper>(contextPtr, readerConfig)); + mappers.push_back(createInputMapper<RotaryEncoderInputMapper>(contextPtr, readerConfig)); } // Vibrator-like devices. diff --git a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.h b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.h index d3dcbe1bb4..9e2e8c4342 100644 --- a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.h +++ b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.h @@ -25,8 +25,10 @@ namespace android { class RotaryEncoderInputMapper : public InputMapper { public: - explicit RotaryEncoderInputMapper(InputDeviceContext& deviceContext, - const InputReaderConfiguration& readerConfig); + template <class T, class... Args> + friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext, + const InputReaderConfiguration& readerConfig, + Args... args); virtual ~RotaryEncoderInputMapper(); virtual uint32_t getSources() const override; @@ -45,6 +47,8 @@ private: float mScalingFactor; ui::Rotation mOrientation; + explicit RotaryEncoderInputMapper(InputDeviceContext& deviceContext, + const InputReaderConfiguration& readerConfig); [[nodiscard]] std::list<NotifyArgs> sync(nsecs_t when, nsecs_t readTime); }; |