Request key maps from input manager service.
Instead of each application loading the KeyCharacterMap from the file system, get them from the input manager service as part of the InputDevice object. Refactored InputManager to be a proper singleton instead of having a bunch of static methods. InputManager now maintains a cache of all InputDevice objects that it has loaded. Currently we never invalidate the cache which can cause InputDevice to return stale motion ranges if the device is reconfigured. This will be fixed in a future change. Added a fake InputDevice with ID -1 to represent the virtual keyboard. Change-Id: If7a695839ad0972317a5aab89e9d1e42ace28eb7
This commit is contained in:
@@ -523,19 +523,21 @@ void InputReader::updateInputConfigurationLocked() {
|
||||
InputDeviceInfo deviceInfo;
|
||||
for (size_t i = 0; i < mDevices.size(); i++) {
|
||||
InputDevice* device = mDevices.valueAt(i);
|
||||
device->getDeviceInfo(& deviceInfo);
|
||||
uint32_t sources = deviceInfo.getSources();
|
||||
if (!(device->getClasses() & INPUT_DEVICE_CLASS_VIRTUAL)) {
|
||||
device->getDeviceInfo(& deviceInfo);
|
||||
uint32_t sources = deviceInfo.getSources();
|
||||
|
||||
if ((sources & AINPUT_SOURCE_TOUCHSCREEN) == AINPUT_SOURCE_TOUCHSCREEN) {
|
||||
touchScreenConfig = InputConfiguration::TOUCHSCREEN_FINGER;
|
||||
}
|
||||
if ((sources & AINPUT_SOURCE_TRACKBALL) == AINPUT_SOURCE_TRACKBALL) {
|
||||
navigationConfig = InputConfiguration::NAVIGATION_TRACKBALL;
|
||||
} else if ((sources & AINPUT_SOURCE_DPAD) == AINPUT_SOURCE_DPAD) {
|
||||
navigationConfig = InputConfiguration::NAVIGATION_DPAD;
|
||||
}
|
||||
if (deviceInfo.getKeyboardType() == AINPUT_KEYBOARD_TYPE_ALPHABETIC) {
|
||||
keyboardConfig = InputConfiguration::KEYBOARD_QWERTY;
|
||||
if ((sources & AINPUT_SOURCE_TOUCHSCREEN) == AINPUT_SOURCE_TOUCHSCREEN) {
|
||||
touchScreenConfig = InputConfiguration::TOUCHSCREEN_FINGER;
|
||||
}
|
||||
if ((sources & AINPUT_SOURCE_TRACKBALL) == AINPUT_SOURCE_TRACKBALL) {
|
||||
navigationConfig = InputConfiguration::NAVIGATION_TRACKBALL;
|
||||
} else if ((sources & AINPUT_SOURCE_DPAD) == AINPUT_SOURCE_DPAD) {
|
||||
navigationConfig = InputConfiguration::NAVIGATION_DPAD;
|
||||
}
|
||||
if (deviceInfo.getKeyboardType() == AINPUT_KEYBOARD_TYPE_ALPHABETIC) {
|
||||
keyboardConfig = InputConfiguration::KEYBOARD_QWERTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1789,7 +1791,7 @@ void KeyboardInputMapper::populateDeviceInfo(InputDeviceInfo* info) {
|
||||
InputMapper::populateDeviceInfo(info);
|
||||
|
||||
info->setKeyboardType(mKeyboardType);
|
||||
info->setKeyCharacterMapFile(getEventHub()->getKeyCharacterMapFile(getDeviceId()));
|
||||
info->setKeyCharacterMap(getEventHub()->getKeyCharacterMap(getDeviceId()));
|
||||
}
|
||||
|
||||
void KeyboardInputMapper::dump(String8& dump) {
|
||||
|
||||
Reference in New Issue
Block a user