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

Commit 61d0da32 authored by Abdelrahman Awadalla's avatar Abdelrahman Awadalla
Browse files

Add InputReaderConfiguration option for touchpad visualization

Test: Enable the flag and enable the "Show touchpad input" in developer
      options and trace the logs in TouchpadInputMapper.
Bug: 286551975
Flag: com.android.hardware.input.touchpad_visualizer
Change-Id: Ibe8bdae8757391501eb66753d53b046011d1da45
parent 2b65f7a9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -227,6 +227,9 @@ struct InputReaderConfiguration {
    // True to enable tap dragging on touchpads.
    bool touchpadTapDraggingEnabled;

    // True if hardware state update notifications should be sent to the policy.
    bool shouldNotifyTouchpadHardwareState;

    // True to enable a zone on the right-hand side of touchpads where clicks will be turned into
    // context (a.k.a. "right") clicks.
    bool touchpadRightClickZoneEnabled;
@@ -268,6 +271,7 @@ struct InputReaderConfiguration {
            touchpadNaturalScrollingEnabled(true),
            touchpadTapToClickEnabled(true),
            touchpadTapDraggingEnabled(false),
            shouldNotifyTouchpadHardwareState(false),
            touchpadRightClickZoneEnabled(false),
            stylusButtonMotionEventsEnabled(true),
            stylusPointerIconEnabled(false) {}
+6 −0
Original line number Diff line number Diff line
@@ -372,6 +372,7 @@ std::list<NotifyArgs> TouchpadInputMapper::reconfigure(nsecs_t when,
                .setBoolValues({config.touchpadTapDraggingEnabled});
        mPropertyProvider.getProperty("Button Right Click Zone Enable")
                .setBoolValues({config.touchpadRightClickZoneEnabled});
        mTouchpadHardwareStateNotificationsEnabled = config.shouldNotifyTouchpadHardwareState;
    }
    std::list<NotifyArgs> out;
    if ((!changes.any() && config.pointerCaptureRequest.isEnable()) ||
@@ -421,6 +422,11 @@ std::list<NotifyArgs> TouchpadInputMapper::process(const RawEvent& rawEvent) {
    }
    std::optional<SelfContainedHardwareState> state = mStateConverter.processRawEvent(rawEvent);
    if (state) {
        if (mTouchpadHardwareStateNotificationsEnabled) {
            // TODO(b/286551975): Notify policy of the touchpad hardware state.
            LOG(DEBUG) << "Notify touchpad hardware state here!";
        }

        updatePalmDetectionMetrics();
        return sendHardwareState(rawEvent.when, rawEvent.readTime, *state);
    } else {
+4 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ private:
    std::optional<ui::LogicalDisplayId> mDisplayId;

    nsecs_t mGestureStartTime{0};

    // True if hardware state update notifications is available for usage based on its feature flag
    // and settings value.
    bool mTouchpadHardwareStateNotificationsEnabled = false;
};

} // namespace android