From 1e08fe90df18930691b0c2ec22e5db25d7fcb4cf Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 15 Nov 2011 17:48:10 -0800 Subject: Eliminate hw.keyboards system properties. Stop using system properties to publish information about the key character map path. Instead, we can retrieve it on demand by asking the window manager. It was possible to exhaust the supply of system properties when repeatedly adding and removing input devices. Bug: 5532806 Change-Id: Idd361a24ad7db2edc185c8546db7fb05f9c28669 --- libs/ui/Keyboard.cpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'libs/ui/Keyboard.cpp') diff --git a/libs/ui/Keyboard.cpp b/libs/ui/Keyboard.cpp index 600a951d5f90..10bb39c57518 100644 --- a/libs/ui/Keyboard.cpp +++ b/libs/ui/Keyboard.cpp @@ -173,50 +173,6 @@ bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentifier, return strstr(deviceIdentifier.name.string(), "-keypad"); } -void setKeyboardProperties(int32_t deviceId, - const InputDeviceIdentifier& deviceIdentifier, - const String8& keyLayoutFile, const String8& keyCharacterMapFile) { - char propName[PROPERTY_KEY_MAX]; - snprintf(propName, sizeof(propName), "hw.keyboards.%u.devname", deviceId); - property_set(propName, deviceIdentifier.name.string()); - snprintf(propName, sizeof(propName), "hw.keyboards.%u.klfile", deviceId); - property_set(propName, keyLayoutFile.string()); - snprintf(propName, sizeof(propName), "hw.keyboards.%u.kcmfile", deviceId); - property_set(propName, keyCharacterMapFile.string()); -} - -void clearKeyboardProperties(int32_t deviceId) { - char propName[PROPERTY_KEY_MAX]; - snprintf(propName, sizeof(propName), "hw.keyboards.%u.devname", deviceId); - property_set(propName, ""); - snprintf(propName, sizeof(propName), "hw.keyboards.%u.klfile", deviceId); - property_set(propName, ""); - snprintf(propName, sizeof(propName), "hw.keyboards.%u.kcmfile", deviceId); - property_set(propName, ""); -} - -status_t getKeyCharacterMapFile(int32_t deviceId, String8& outKeyCharacterMapFile) { - if (deviceId != DEVICE_ID_VIRTUAL_KEYBOARD) { - char propName[PROPERTY_KEY_MAX]; - char fn[PROPERTY_VALUE_MAX]; - snprintf(propName, sizeof(propName), "hw.keyboards.%u.kcmfile", deviceId); - if (property_get(propName, fn, "") > 0) { - outKeyCharacterMapFile.setTo(fn); - return OK; - } - } - - // Default to Virtual since the keyboard does not appear to be installed. - outKeyCharacterMapFile.setTo(getInputDeviceConfigurationFilePathByName(String8("Virtual"), - INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_CHARACTER_MAP)); - if (!outKeyCharacterMapFile.isEmpty()) { - return OK; - } - - LOGE("Can't find any key character map files including the Virtual key map!"); - return NAME_NOT_FOUND; -} - static int lookupValueByLabel(const char* literal, const KeycodeLabel *list) { while (list->literal) { if (strcmp(literal, list->literal) == 0) { -- cgit v1.2.3-59-g8ed1b