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

Commit 2de01edc authored by Android Build Prod User's avatar Android Build Prod User Committed by Android (Google) Code Review
Browse files

Merge "Fix toggleCapsLock failed for multiple EventHub devices"

parents a1530043 cb40a00d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1209,6 +1209,15 @@ bool EventHub::hasScanCode(int32_t deviceId, int32_t scanCode) const {
    return false;
}

bool EventHub::hasKeyCode(int32_t deviceId, int32_t keyCode) const {
    std::scoped_lock _l(mLock);
    Device* device = getDeviceLocked(deviceId);
    if (device != nullptr) {
        return device->hasKeycodeLocked(keyCode);
    }
    return false;
}

bool EventHub::hasLed(int32_t deviceId, int32_t led) const {
    std::scoped_lock _l(mLock);
    Device* device = getDeviceLocked(deviceId);
+7 −1
Original line number Diff line number Diff line
@@ -559,7 +559,13 @@ int32_t InputDevice::getMetaState() {
}

void InputDevice::updateMetaState(int32_t keyCode) {
    for_each_mapper([keyCode](InputMapper& mapper) { mapper.updateMetaState(keyCode); });
    first_in_mappers<bool>([keyCode](InputMapper& mapper) {
        if (sourcesMatchMask(mapper.getSources(), AINPUT_SOURCE_KEYBOARD) &&
            mapper.updateMetaState(keyCode)) {
            return std::make_optional(true);
        }
        return std::optional<bool>();
    });
}

void InputDevice::bumpGeneration() {
+1 −0
Original line number Diff line number Diff line
@@ -555,6 +555,7 @@ void InputReader::toggleCapsLockState(int32_t deviceId) {
    }

    if (device->isIgnored()) {
        ALOGW("Ignoring toggleCapsLock for ignored deviceId %" PRId32 ".", deviceId);
        return;
    }

+2 −0
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ public:
                                       uint8_t* outFlags) const = 0;

    virtual bool hasScanCode(int32_t deviceId, int32_t scanCode) const = 0;
    virtual bool hasKeyCode(int32_t deviceId, int32_t keyCode) const = 0;

    /* LED related functions expect Android LED constants, not scan codes or HID usages */
    virtual bool hasLed(int32_t deviceId, int32_t led) const = 0;
@@ -489,6 +490,7 @@ public:
    std::vector<TouchVideoFrame> getVideoFrames(int32_t deviceId) override final;

    bool hasScanCode(int32_t deviceId, int32_t scanCode) const override final;
    bool hasKeyCode(int32_t deviceId, int32_t keyCode) const override final;
    bool hasLed(int32_t deviceId, int32_t led) const override final;
    void setLedState(int32_t deviceId, int32_t led, bool on) override final;

+1 −0
Original line number Diff line number Diff line
@@ -323,6 +323,7 @@ public:
    inline bool hasScanCode(int32_t scanCode) const {
        return mEventHub->hasScanCode(mId, scanCode);
    }
    inline bool hasKeyCode(int32_t keyCode) const { return mEventHub->hasKeyCode(mId, keyCode); }
    inline bool hasLed(int32_t led) const { return mEventHub->hasLed(mId, led); }
    inline void setLedState(int32_t led, bool on) { return mEventHub->setLedState(mId, led, on); }
    inline void getVirtualKeyDefinitions(std::vector<VirtualKeyDefinition>& outVirtualKeys) const {
Loading