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

Commit 86c3ae2d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12478163 from 6a3c7c9b to 25Q1-release

Change-Id: I373fef43beffdc5d8fc6b6aeed583c323641c2c7
parents df79be8a 6a3c7c9b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -137,6 +137,9 @@ public:
    /* Returns keycode after applying Android key code remapping defined in mKeyRemapping */
    int32_t applyKeyRemapping(int32_t fromKeyCode) const;

    /** Returns list of keycodes that remap to provided keycode (@see setKeyRemapping()) */
    std::vector<int32_t> findKeyCodesMappedToKeyCode(int32_t toKeyCode) const;

    /* Returns the <keyCode, metaState> pair after applying key behavior defined in the kcm file,
     * that tries to find a replacement key code based on current meta state */
    std::pair<int32_t /*keyCode*/, int32_t /*metaState*/> applyKeyBehavior(int32_t keyCode,
+11 −0
Original line number Diff line number Diff line
@@ -365,6 +365,17 @@ int32_t KeyCharacterMap::applyKeyRemapping(int32_t fromKeyCode) const {
    return toKeyCode;
}

std::vector<int32_t> KeyCharacterMap::findKeyCodesMappedToKeyCode(int32_t toKeyCode) const {
    std::vector<int32_t> fromKeyCodes;

    for (const auto& [from, to] : mKeyRemapping) {
        if (toKeyCode == to) {
            fromKeyCodes.push_back(from);
        }
    }
    return fromKeyCodes;
}

std::pair<int32_t, int32_t> KeyCharacterMap::applyKeyBehavior(int32_t fromKeyCode,
                                                              int32_t fromMetaState) const {
    int32_t toKeyCode = fromKeyCode;
+13 −1
Original line number Diff line number Diff line
@@ -659,6 +659,19 @@ void EventHub::Device::populateAbsoluteAxisStates() {
}

bool EventHub::Device::hasKeycodeLocked(int keycode) const {
    if (hasKeycodeInternalLocked(keycode)) {
        return true;
    }

    for (auto& fromKey : getKeyCharacterMap()->findKeyCodesMappedToKeyCode(keycode)) {
        if (hasKeycodeInternalLocked(fromKey)) {
            return true;
        }
    }
    return false;
}

bool EventHub::Device::hasKeycodeInternalLocked(int keycode) const {
    if (!keyMap.haveKeyLayout()) {
        return false;
    }
@@ -676,7 +689,6 @@ bool EventHub::Device::hasKeycodeLocked(int keycode) const {
    if (usageCodes.size() > 0 && mscBitmask.test(MSC_SCAN)) {
        return true;
    }

    return false;
}

+0 −10
Original line number Diff line number Diff line
@@ -691,16 +691,6 @@ int32_t InputDevice::getMetaState() {
    return result;
}

void InputDevice::updateMetaState(int32_t 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() {
    mGeneration = mContext->bumpGeneration();
}
+2 −11
Original line number Diff line number Diff line
@@ -584,18 +584,9 @@ int32_t InputReader::getStateLocked(int32_t deviceId, uint32_t sourceMask, int32

void InputReader::toggleCapsLockState(int32_t deviceId) {
    std::scoped_lock _l(mLock);
    InputDevice* device = findInputDeviceLocked(deviceId);
    if (!device) {
        ALOGW("Ignoring toggleCapsLock for unknown deviceId %" PRId32 ".", deviceId);
        return;
    }

    if (device->isIgnored()) {
        ALOGW("Ignoring toggleCapsLock for ignored deviceId %" PRId32 ".", deviceId);
        return;
    if (mKeyboardClassifier->getKeyboardType(deviceId) == KeyboardType::ALPHABETIC) {
        updateLedMetaStateLocked(mLedMetaState ^ AMETA_CAPS_LOCK_ON);
    }

    device->updateMetaState(AKEYCODE_CAPS_LOCK);
}

bool InputReader::hasKeys(int32_t deviceId, uint32_t sourceMask,
Loading