b/12068020 Add a way to add uniqueness to device descriptors. Do not merge
Cherry pick from https://googleplex-android-review.git.corp.google.com/#/c/398226/
This adds an integer to the descriptor of devices without uniqely
identifying information. It will reuse values that are no longer
in use, so if you remove a single device and attach a different
identical device it will appear to be the same device.
TODO: Derive uniqueness from USB port when possible. This version
will generate different descriptors for each half of a USB keyboard
that shows up twice.
Change-Id: Ie628f19c01469f6ec2d354cd00000898ac6432fa
diff --git a/libs/input/EventHub.h b/libs/input/EventHub.h
index 0d63849..86c05af 100644
--- a/libs/input/EventHub.h
+++ b/libs/input/EventHub.h
@@ -373,6 +373,7 @@
status_t openDeviceLocked(const char *devicePath);
void createVirtualKeyboardLocked();
void addDeviceLocked(Device* device);
+ void assignDescriptorLocked(InputDeviceIdentifier& identifier);
status_t closeDeviceByPathLocked(const char *devicePath);
void closeDeviceLocked(Device* device);
@@ -382,6 +383,7 @@
void scanDevicesLocked();
status_t readNotifyLocked();
+ Device* getDeviceByDescriptorLocked(String8& descriptor) const;
Device* getDeviceLocked(int32_t deviceId) const;
Device* getDeviceByPathLocked(const char* devicePath) const;