diff options
| author | 2022-11-12 04:44:31 +0000 | |
|---|---|---|
| committer | 2022-12-16 06:54:05 +0000 | |
| commit | fecb60640999c4758a8967e7d7960d4530198d17 (patch) | |
| tree | bc4c40765018b8563e0f62f67e8c176acf8ed6bd /include/input/InputDevice.h | |
| parent | 7d089caad4b61600d0d876d18b13f0fb1d255685 (diff) | |
Gets keyboard layout info from user space when available.
The layout info consists of a BCP 47 conformant language tag and a
layout type such as "qwerty" or "azerty". They will be used to
initialize the input device.
This is currently used by uinput virtual keyboard to pass in layout
information.
Bug: 237537306
Test: atest inputflinger_tests
Change-Id: Icfc30f1afb0f88dd704d1d598d62a300a032b0f5
Diffstat (limited to 'include/input/InputDevice.h')
| -rw-r--r-- | include/input/InputDevice.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h index e911734407..5fa9fda64b 100644 --- a/include/input/InputDevice.h +++ b/include/input/InputDevice.h @@ -205,6 +205,16 @@ struct InputDeviceBatteryInfo { int32_t id; }; +struct KeyboardLayoutInfo { + explicit KeyboardLayoutInfo(std::string languageTag, std::string layoutType) + : languageTag(languageTag), layoutType(layoutType) {} + + // A BCP 47 conformant language tag such as "en-US". + std::string languageTag; + // The layout type such as QWERTY or AZERTY. + std::string layoutType; +}; + /* * Describes the characteristics and capabilities of an input device. */ @@ -256,6 +266,11 @@ public: void setKeyboardType(int32_t keyboardType); inline int32_t getKeyboardType() const { return mKeyboardType; } + void setKeyboardLayoutInfo(KeyboardLayoutInfo keyboardLayoutInfo); + inline const std::optional<KeyboardLayoutInfo>& getKeyboardLayoutInfo() const { + return mKeyboardLayoutInfo; + } + inline void setKeyCharacterMap(const std::shared_ptr<KeyCharacterMap> value) { mKeyCharacterMap = value; } @@ -296,6 +311,7 @@ private: bool mIsExternal; bool mHasMic; hardware::input::InputDeviceCountryCode mCountryCode; + std::optional<KeyboardLayoutInfo> mKeyboardLayoutInfo; uint32_t mSources; int32_t mKeyboardType; std::shared_ptr<KeyCharacterMap> mKeyCharacterMap; |