Loading include/input/KeyCharacterMap.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,9 @@ public: /* Combines this key character map with the provided overlay. */ /* Combines this key character map with the provided overlay. */ void combine(const KeyCharacterMap& overlay); void combine(const KeyCharacterMap& overlay); /* Clears already applied layout overlay */ void clearLayoutOverlay(); /* Gets the keyboard type. */ /* Gets the keyboard type. */ KeyboardType getKeyboardType() const; KeyboardType getKeyboardType() const; Loading libs/input/KeyCharacterMap.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -255,6 +255,13 @@ void KeyCharacterMap::combine(const KeyCharacterMap& overlay) { mLayoutOverlayApplied = true; mLayoutOverlayApplied = true; } } void KeyCharacterMap::clearLayoutOverlay() { if (mLayoutOverlayApplied) { reloadBaseFromFile(); mLayoutOverlayApplied = false; } } KeyCharacterMap::KeyboardType KeyCharacterMap::getKeyboardType() const { KeyCharacterMap::KeyboardType KeyCharacterMap::getKeyboardType() const { return mType; return mType; } } Loading services/inputflinger/reader/EventHub.cpp +6 −1 Original line number Original line Diff line number Diff line Loading @@ -1416,12 +1416,17 @@ const std::shared_ptr<KeyCharacterMap> EventHub::getKeyCharacterMap(int32_t devi return nullptr; return nullptr; } } // If provided map is null, it will reset key character map to default KCM. bool EventHub::setKeyboardLayoutOverlay(int32_t deviceId, std::shared_ptr<KeyCharacterMap> map) { bool EventHub::setKeyboardLayoutOverlay(int32_t deviceId, std::shared_ptr<KeyCharacterMap> map) { std::scoped_lock _l(mLock); std::scoped_lock _l(mLock); Device* device = getDeviceLocked(deviceId); Device* device = getDeviceLocked(deviceId); if (device == nullptr || map == nullptr || device->keyMap.keyCharacterMap == nullptr) { if (device == nullptr || device->keyMap.keyCharacterMap == nullptr) { return false; return false; } } if (map == nullptr) { device->keyMap.keyCharacterMap->clearLayoutOverlay(); return true; } device->keyMap.keyCharacterMap->combine(*map); device->keyMap.keyCharacterMap->combine(*map); return true; return true; } } Loading Loading
include/input/KeyCharacterMap.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,9 @@ public: /* Combines this key character map with the provided overlay. */ /* Combines this key character map with the provided overlay. */ void combine(const KeyCharacterMap& overlay); void combine(const KeyCharacterMap& overlay); /* Clears already applied layout overlay */ void clearLayoutOverlay(); /* Gets the keyboard type. */ /* Gets the keyboard type. */ KeyboardType getKeyboardType() const; KeyboardType getKeyboardType() const; Loading
libs/input/KeyCharacterMap.cpp +7 −0 Original line number Original line Diff line number Diff line Loading @@ -255,6 +255,13 @@ void KeyCharacterMap::combine(const KeyCharacterMap& overlay) { mLayoutOverlayApplied = true; mLayoutOverlayApplied = true; } } void KeyCharacterMap::clearLayoutOverlay() { if (mLayoutOverlayApplied) { reloadBaseFromFile(); mLayoutOverlayApplied = false; } } KeyCharacterMap::KeyboardType KeyCharacterMap::getKeyboardType() const { KeyCharacterMap::KeyboardType KeyCharacterMap::getKeyboardType() const { return mType; return mType; } } Loading
services/inputflinger/reader/EventHub.cpp +6 −1 Original line number Original line Diff line number Diff line Loading @@ -1416,12 +1416,17 @@ const std::shared_ptr<KeyCharacterMap> EventHub::getKeyCharacterMap(int32_t devi return nullptr; return nullptr; } } // If provided map is null, it will reset key character map to default KCM. bool EventHub::setKeyboardLayoutOverlay(int32_t deviceId, std::shared_ptr<KeyCharacterMap> map) { bool EventHub::setKeyboardLayoutOverlay(int32_t deviceId, std::shared_ptr<KeyCharacterMap> map) { std::scoped_lock _l(mLock); std::scoped_lock _l(mLock); Device* device = getDeviceLocked(deviceId); Device* device = getDeviceLocked(deviceId); if (device == nullptr || map == nullptr || device->keyMap.keyCharacterMap == nullptr) { if (device == nullptr || device->keyMap.keyCharacterMap == nullptr) { return false; return false; } } if (map == nullptr) { device->keyMap.keyCharacterMap->clearLayoutOverlay(); return true; } device->keyMap.keyCharacterMap->combine(*map); device->keyMap.keyCharacterMap->combine(*map); return true; return true; } } Loading