Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c55f75fc authored by Arpit Singh's avatar Arpit Singh
Browse files

InputMapper refactor: ExternalStylusInputMapper

Add a factory method for ExternalStylusInputMapper to be configured on
initilisation

Test: m checkinput && atest libinput_tests inputflinger_tests
Bug: 256009910
Change-Id: If75377416f4f6d3954480bf4e32886f3daf7f1f3
parent 33b9193e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -520,7 +520,7 @@ std::vector<std::unique_ptr<InputMapper>> InputDevice::createMappers(

    // External stylus-like devices.
    if (classes.test(InputDeviceClass::EXTERNAL_STYLUS)) {
        mappers.push_back(std::make_unique<ExternalStylusInputMapper>(contextPtr, readerConfig));
        mappers.push_back(createInputMapper<ExternalStylusInputMapper>(contextPtr, readerConfig));
    }
    return mappers;
}
+6 −2
Original line number Diff line number Diff line
@@ -26,8 +26,10 @@ namespace android {

class ExternalStylusInputMapper : public InputMapper {
public:
    explicit ExternalStylusInputMapper(InputDeviceContext& deviceContext,
                                       const InputReaderConfiguration& readerConfig);
    template <class T, class... Args>
    friend std::unique_ptr<T> createInputMapper(InputDeviceContext& deviceContext,
                                                const InputReaderConfiguration& readerConfig,
                                                Args... args);
    virtual ~ExternalStylusInputMapper() = default;

    uint32_t getSources() const override;
@@ -46,6 +48,8 @@ private:

    StylusState mStylusState;

    explicit ExternalStylusInputMapper(InputDeviceContext& deviceContext,
                                       const InputReaderConfiguration& readerConfig);
    [[nodiscard]] std::list<NotifyArgs> sync(nsecs_t when);
};