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

Commit 5ebf21f3 authored by Omar Abdelmonem's avatar Omar Abdelmonem
Browse files

Create JNI pipeline for touchpad gestures

Create JNI pipeline to send touchpad gesture types from native
code to display it in the TouchpadDebugView

Bug: 365562952
Test: Verified that the data flow works correctly and the method references are valid.
Flag: com.android.hardware.input.touchpad_visualizer
Change-Id: Ia318f0c7a8cfd359d25d2512ac02060b06b958bf
parent 43a68c3f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -466,6 +466,9 @@ public:
    virtual void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs,
                                             int32_t deviceId) = 0;

    /* Sends the Info of gestures that happen on the touchpad. */
    virtual void notifyTouchpadGestureInfo(GestureType type, int32_t deviceId) = 0;

    /* Gets the keyboard layout for a particular input device. */
    virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay(
            const InputDeviceIdentifier& identifier,
+3 −0
Original line number Diff line number Diff line
@@ -480,6 +480,9 @@ void TouchpadInputMapper::consumeGesture(const Gesture* gesture) {
        return;
    }
    mGesturesToProcess.push_back(*gesture);
    if (mTouchpadHardwareStateNotificationsEnabled) {
        getPolicy()->notifyTouchpadGestureInfo(gesture->type, getDeviceId());
    }
}

std::list<NotifyArgs> TouchpadInputMapper::processGestures(nsecs_t when, nsecs_t readTime) {
+4 −0
Original line number Diff line number Diff line
@@ -256,6 +256,10 @@ void FakeInputReaderPolicy::notifyTouchpadHardwareState(const SelfContainedHardw
    mTouchpadHardwareStateNotified.notify_all();
}

void FakeInputReaderPolicy::notifyTouchpadGestureInfo(GestureType type, int32_t deviceId) {
    std::scoped_lock lock(mLock);
}

std::shared_ptr<KeyCharacterMap> FakeInputReaderPolicy::getKeyboardLayoutOverlay(
        const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) {
    return nullptr;
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ private:
    void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) override;
    void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs,
                                     int32_t deviceId) override;
    void notifyTouchpadGestureInfo(GestureType type, int32_t deviceId) override;
    std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay(
            const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) override;
    std::string getDeviceAlias(const InputDeviceIdentifier&) override;
+1 −0
Original line number Diff line number Diff line
@@ -283,6 +283,7 @@ public:
    void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) override {}
    void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs,
                                     int32_t deviceId) override {}
    void notifyTouchpadGestureInfo(GestureType type, int32_t deviceId) override {}
    std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay(
            const InputDeviceIdentifier& identifier,
            const std::optional<KeyboardLayoutInfo> layoutInfo) override {