Loading include/input/InputDevice.h +7 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,13 @@ extern std::string getInputDeviceConfigurationFilePathByDeviceIdentifier( extern std::string getInputDeviceConfigurationFilePathByName( const std::string& name, InputDeviceConfigurationFileType type); enum ReservedInputDeviceId : int32_t { // Device id of a special "virtual" keyboard that is always present. VIRTUAL_KEYBOARD_ID = -1, // Device id of the "built-in" keyboard if there is one. BUILT_IN_KEYBOARD_ID = 0, }; } // namespace android #endif // _LIBINPUT_INPUT_DEVICE_H services/inputflinger/EventHub.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -763,7 +763,7 @@ EventHub::Device* EventHub::getDeviceByDescriptorLocked(const std::string& descr } EventHub::Device* EventHub::getDeviceLocked(int32_t deviceId) const { if (deviceId == BUILT_IN_KEYBOARD_ID) { if (deviceId == ReservedInputDeviceId::BUILT_IN_KEYBOARD_ID) { deviceId = mBuiltInKeyboardId; } ssize_t index = mDevices.indexOfKey(deviceId); Loading Loading @@ -835,7 +835,8 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz device->id, device->path.c_str()); mClosingDevices = device->next; event->when = now; event->deviceId = device->id == mBuiltInKeyboardId ? BUILT_IN_KEYBOARD_ID : device->id; event->deviceId = (device->id == mBuiltInKeyboardId) ? ReservedInputDeviceId::BUILT_IN_KEYBOARD_ID : device->id; event->type = DEVICE_REMOVED; event += 1; delete device; Loading Loading @@ -1081,7 +1082,7 @@ void EventHub::scanDevicesLocked() { ALOGE("scan video dir failed for %s", VIDEO_DEVICE_PATH); } } if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) { if (mDevices.indexOfKey(ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID) < 0) { createVirtualKeyboardLocked(); } } Loading Loading @@ -1580,7 +1581,8 @@ void EventHub::createVirtualKeyboardLocked() { identifier.uniqueId = "<virtual>"; assignDescriptorLocked(identifier); Device* device = new Device(-1, VIRTUAL_KEYBOARD_ID, "<virtual>", identifier); Device* device = new Device(-1, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, "<virtual>", identifier); device->classes = INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_ALPHAKEY | INPUT_DEVICE_CLASS_DPAD Loading services/inputflinger/include/EventHub.h→services/inputflinger/EventHub.h +0 −7 Original line number Diff line number Diff line Loading @@ -46,13 +46,6 @@ namespace android { enum { // Device id of a special "virtual" keyboard that is always present. VIRTUAL_KEYBOARD_ID = -1, // Device id of the "built-in" keyboard if there is one. BUILT_IN_KEYBOARD_ID = 0, }; /* * A raw event as retrieved from the EventHub. */ Loading Loading
include/input/InputDevice.h +7 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,13 @@ extern std::string getInputDeviceConfigurationFilePathByDeviceIdentifier( extern std::string getInputDeviceConfigurationFilePathByName( const std::string& name, InputDeviceConfigurationFileType type); enum ReservedInputDeviceId : int32_t { // Device id of a special "virtual" keyboard that is always present. VIRTUAL_KEYBOARD_ID = -1, // Device id of the "built-in" keyboard if there is one. BUILT_IN_KEYBOARD_ID = 0, }; } // namespace android #endif // _LIBINPUT_INPUT_DEVICE_H
services/inputflinger/EventHub.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -763,7 +763,7 @@ EventHub::Device* EventHub::getDeviceByDescriptorLocked(const std::string& descr } EventHub::Device* EventHub::getDeviceLocked(int32_t deviceId) const { if (deviceId == BUILT_IN_KEYBOARD_ID) { if (deviceId == ReservedInputDeviceId::BUILT_IN_KEYBOARD_ID) { deviceId = mBuiltInKeyboardId; } ssize_t index = mDevices.indexOfKey(deviceId); Loading Loading @@ -835,7 +835,8 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz device->id, device->path.c_str()); mClosingDevices = device->next; event->when = now; event->deviceId = device->id == mBuiltInKeyboardId ? BUILT_IN_KEYBOARD_ID : device->id; event->deviceId = (device->id == mBuiltInKeyboardId) ? ReservedInputDeviceId::BUILT_IN_KEYBOARD_ID : device->id; event->type = DEVICE_REMOVED; event += 1; delete device; Loading Loading @@ -1081,7 +1082,7 @@ void EventHub::scanDevicesLocked() { ALOGE("scan video dir failed for %s", VIDEO_DEVICE_PATH); } } if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) { if (mDevices.indexOfKey(ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID) < 0) { createVirtualKeyboardLocked(); } } Loading Loading @@ -1580,7 +1581,8 @@ void EventHub::createVirtualKeyboardLocked() { identifier.uniqueId = "<virtual>"; assignDescriptorLocked(identifier); Device* device = new Device(-1, VIRTUAL_KEYBOARD_ID, "<virtual>", identifier); Device* device = new Device(-1, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, "<virtual>", identifier); device->classes = INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_ALPHAKEY | INPUT_DEVICE_CLASS_DPAD Loading
services/inputflinger/include/EventHub.h→services/inputflinger/EventHub.h +0 −7 Original line number Diff line number Diff line Loading @@ -46,13 +46,6 @@ namespace android { enum { // Device id of a special "virtual" keyboard that is always present. VIRTUAL_KEYBOARD_ID = -1, // Device id of the "built-in" keyboard if there is one. BUILT_IN_KEYBOARD_ID = 0, }; /* * A raw event as retrieved from the EventHub. */ Loading