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

Commit 849beb4c authored by Arpit Singh's avatar Arpit Singh
Browse files

Sync disabling of touchpad taps with hiding pointer

Due to an earlier refactor hiding cursor logic was moved to
pointer choreographer it caused disabling touchpad taps to be out or
sync.

This change consolidates these to ensure whenever mouse pointer is
hidden, touchpad tap is also disabled.

Test: atest inputflinger_tests
Bug: b/338652288
Flag: EXEMPT bugfix
Change-Id: I9faf7d68e5eebc5ca197688c96c661419334f0cf
parent 02705d68
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ void PointerChoreographer::fadeMouseCursorOnKeyPress(const android::NotifyKeyArg
    }
    auto it = mMousePointersByDisplay.find(targetDisplay);
    if (it != mMousePointersByDisplay.end()) {
        mPolicy.notifyMouseCursorFadedOnTyping();
        it->second->fade(PointerControllerInterface::Transition::GRADUAL);
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -397,6 +397,9 @@ public:
     * Returns ReservedInputDeviceId::INVALID_INPUT_DEVICE_ID if no device has been used since boot.
     */
    virtual DeviceId getLastUsedInputDeviceId() = 0;

    /* Notifies that mouse cursor faded due to typing. */
    virtual void notifyMouseCursorFadedOnTyping() = 0;
};

// --- TouchAffineTransformation ---
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ public:

    /* Returns true if any InputConnection is currently active. */
    virtual bool isInputMethodConnectionActive() = 0;

    /* Notifies that mouse cursor faded due to typing. */
    virtual void notifyMouseCursorFadedOnTyping() = 0;
};

} // namespace android
+6 −0
Original line number Diff line number Diff line
@@ -907,6 +907,12 @@ DeviceId InputReader::getLastUsedInputDeviceId() {
    return mLastUsedDeviceId;
}

void InputReader::notifyMouseCursorFadedOnTyping() {
    std::scoped_lock _l(mLock);
    // disable touchpad taps when cursor has faded due to typing
    mPreventingTouchpadTaps = true;
}

void InputReader::dump(std::string& dump) {
    std::scoped_lock _l(mLock);

+3 −1
Original line number Diff line number Diff line
@@ -118,6 +118,8 @@ public:

    DeviceId getLastUsedInputDeviceId() override;

    void notifyMouseCursorFadedOnTyping() override;

protected:
    // These members are protected so they can be instrumented by test cases.
    virtual std::shared_ptr<InputDevice> createDeviceLocked(nsecs_t when, int32_t deviceId,
@@ -199,7 +201,7 @@ private:
    std::unordered_map<std::shared_ptr<InputDevice>, std::vector<int32_t> /*eventHubId*/>
            mDeviceToEventHubIdsMap GUARDED_BY(mLock);

    // true if tap-to-click on touchpad currently disabled
    // true if tap-to-click on touchpad is currently disabled
    bool mPreventingTouchpadTaps GUARDED_BY(mLock){false};

    // records timestamp of the last key press on the physical keyboard
Loading