Loading include/ui/Input.h +4 −0 Original line number Diff line number Diff line Loading @@ -826,6 +826,9 @@ public: inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; } inline int32_t getKeyboardType() const { return mKeyboardType; } inline void setKeyCharacterMapFile(const String8& value) { mKeyCharacterMapFile = value; } inline const String8& getKeyCharacterMapFile() const { return mKeyCharacterMapFile; } inline const Vector<MotionRange>& getMotionRanges() const { return mMotionRanges; } Loading @@ -835,6 +838,7 @@ private: String8 mName; uint32_t mSources; int32_t mKeyboardType; String8 mKeyCharacterMapFile; Vector<MotionRange> mMotionRanges; }; Loading include/ui/KeyCharacterMap.h +0 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ public: ~KeyCharacterMap(); static status_t load(const String8& filename, KeyCharacterMap** outMap); static status_t loadByDeviceId(int32_t deviceId, KeyCharacterMap** outMap); /* Gets the keyboard type. */ int32_t getKeyboardType() const; Loading include/ui/Keyboard.h +0 −18 Original line number Diff line number Diff line Loading @@ -80,24 +80,6 @@ private: extern bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentifier, const PropertyMap* deviceConfiguration, const KeyMap* keyMap); /** * Sets keyboard system properties. */ extern void setKeyboardProperties(int32_t deviceId, const InputDeviceIdentifier& deviceIdentifier, const String8& keyLayoutFile, const String8& keyCharacterMapFile); /** * Clears keyboard system properties. */ extern void clearKeyboardProperties(int32_t deviceId); /** * Gets the key character map filename for a device using inspecting system properties * and then falling back on a default key character map if necessary. * Returns a NAME_NOT_FOUND if none found. */ extern status_t getKeyCharacterMapFile(int32_t deviceId, String8& outKeyCharacterMapFile); /** * Gets a key code by its short form label, eg. "HOME". * Returns 0 if unknown. Loading libs/ui/KeyCharacterMap.cpp +0 −11 Original line number Diff line number Diff line Loading @@ -124,17 +124,6 @@ status_t KeyCharacterMap::load(const String8& filename, KeyCharacterMap** outMap return status; } status_t KeyCharacterMap::loadByDeviceId(int32_t deviceId, KeyCharacterMap** outMap) { *outMap = NULL; String8 filename; status_t result = getKeyCharacterMapFile(deviceId, filename); if (!result) { result = load(filename, outMap); } return result; } int32_t KeyCharacterMap::getKeyboardType() const { return mType; } Loading libs/ui/Keyboard.cpp +0 −44 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading
include/ui/Input.h +4 −0 Original line number Diff line number Diff line Loading @@ -826,6 +826,9 @@ public: inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; } inline int32_t getKeyboardType() const { return mKeyboardType; } inline void setKeyCharacterMapFile(const String8& value) { mKeyCharacterMapFile = value; } inline const String8& getKeyCharacterMapFile() const { return mKeyCharacterMapFile; } inline const Vector<MotionRange>& getMotionRanges() const { return mMotionRanges; } Loading @@ -835,6 +838,7 @@ private: String8 mName; uint32_t mSources; int32_t mKeyboardType; String8 mKeyCharacterMapFile; Vector<MotionRange> mMotionRanges; }; Loading
include/ui/KeyCharacterMap.h +0 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ public: ~KeyCharacterMap(); static status_t load(const String8& filename, KeyCharacterMap** outMap); static status_t loadByDeviceId(int32_t deviceId, KeyCharacterMap** outMap); /* Gets the keyboard type. */ int32_t getKeyboardType() const; Loading
include/ui/Keyboard.h +0 −18 Original line number Diff line number Diff line Loading @@ -80,24 +80,6 @@ private: extern bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentifier, const PropertyMap* deviceConfiguration, const KeyMap* keyMap); /** * Sets keyboard system properties. */ extern void setKeyboardProperties(int32_t deviceId, const InputDeviceIdentifier& deviceIdentifier, const String8& keyLayoutFile, const String8& keyCharacterMapFile); /** * Clears keyboard system properties. */ extern void clearKeyboardProperties(int32_t deviceId); /** * Gets the key character map filename for a device using inspecting system properties * and then falling back on a default key character map if necessary. * Returns a NAME_NOT_FOUND if none found. */ extern status_t getKeyCharacterMapFile(int32_t deviceId, String8& outKeyCharacterMapFile); /** * Gets a key code by its short form label, eg. "HOME". * Returns 0 if unknown. Loading
libs/ui/KeyCharacterMap.cpp +0 −11 Original line number Diff line number Diff line Loading @@ -124,17 +124,6 @@ status_t KeyCharacterMap::load(const String8& filename, KeyCharacterMap** outMap return status; } status_t KeyCharacterMap::loadByDeviceId(int32_t deviceId, KeyCharacterMap** outMap) { *outMap = NULL; String8 filename; status_t result = getKeyCharacterMapFile(deviceId, filename); if (!result) { result = load(filename, outMap); } return result; } int32_t KeyCharacterMap::getKeyboardType() const { return mType; } Loading
libs/ui/Keyboard.cpp +0 −44 Original line number Diff line number Diff line Loading @@ -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) { Loading