summaryrefslogtreecommitdiff
path: root/libs/input/Keyboard.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2022-07-13 07:29:51 -0700
committer Siarhei Vishniakou <svv@google.com> 2022-07-13 12:07:08 -0700
commit4f94c1ad3fe73105a34178af3a086aa571b8bf78 (patch)
tree9798dc5bce1eec050ef9a3460f3ca5064f128fef /libs/input/Keyboard.cpp
parent4f4aff66c60ed16e9f089693ef0a64ea227c9a62 (diff)
Avoid KeyedVector and String8 in PropertyMap
Update the external-facing APIs of PropertyMap to reduce the dependency on libutils. Here we remove String8 and KeyedVector from the header file. Eventually the Tokenizer can be moved to libinput as well, which would allow us to further reduce this dependency. Bug: 233177558 Test: atest libinput_tests inputflinger_tests Change-Id: I58965ccf7dbd5514c8526f15e713f0e26e498c83
Diffstat (limited to 'libs/input/Keyboard.cpp')
-rw-r--r--libs/input/Keyboard.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/libs/input/Keyboard.cpp b/libs/input/Keyboard.cpp
index c3f5151fd1..3f8467d818 100644
--- a/libs/input/Keyboard.cpp
+++ b/libs/input/Keyboard.cpp
@@ -49,25 +49,23 @@ status_t KeyMap::load(const InputDeviceIdentifier& deviceIdentifier,
const PropertyMap* deviceConfiguration) {
// Use the configured key layout if available.
if (deviceConfiguration) {
- String8 keyLayoutName;
- if (deviceConfiguration->tryGetProperty(String8("keyboard.layout"),
- keyLayoutName)) {
+ std::string keyLayoutName;
+ if (deviceConfiguration->tryGetProperty("keyboard.layout", keyLayoutName)) {
status_t status = loadKeyLayout(deviceIdentifier, keyLayoutName.c_str());
if (status == NAME_NOT_FOUND) {
ALOGE("Configuration for keyboard device '%s' requested keyboard layout '%s' but "
- "it was not found.",
- deviceIdentifier.name.c_str(), keyLayoutName.string());
+ "it was not found.",
+ deviceIdentifier.name.c_str(), keyLayoutName.c_str());
}
}
- String8 keyCharacterMapName;
- if (deviceConfiguration->tryGetProperty(String8("keyboard.characterMap"),
- keyCharacterMapName)) {
+ std::string keyCharacterMapName;
+ if (deviceConfiguration->tryGetProperty("keyboard.characterMap", keyCharacterMapName)) {
status_t status = loadKeyCharacterMap(deviceIdentifier, keyCharacterMapName.c_str());
if (status == NAME_NOT_FOUND) {
ALOGE("Configuration for keyboard device '%s' requested keyboard character "
- "map '%s' but it was not found.",
- deviceIdentifier.name.c_str(), keyCharacterMapName.string());
+ "map '%s' but it was not found.",
+ deviceIdentifier.name.c_str(), keyCharacterMapName.c_str());
}
}
@@ -165,7 +163,7 @@ bool isKeyboardSpecialFunction(const PropertyMap* config) {
return false;
}
bool isSpecialFunction = false;
- config->tryGetProperty(String8("keyboard.specialFunction"), isSpecialFunction);
+ config->tryGetProperty("keyboard.specialFunction", isSpecialFunction);
return isSpecialFunction;
}
@@ -180,8 +178,7 @@ bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentifier,
if (deviceConfiguration) {
bool builtIn = false;
- if (deviceConfiguration->tryGetProperty(String8("keyboard.builtIn"), builtIn)
- && builtIn) {
+ if (deviceConfiguration->tryGetProperty("keyboard.builtIn", builtIn) && builtIn) {
return true;
}
}