Look up devices by fd

Instead of storing deviceIndex inside epoll_data_t in the epoll_event,
store the file descriptors instead. Since we already have the file
descriptors for wake pipe and inotify, we can avoid storing magic
numbers. More importantly, this allows us to add video device
monitoring. For video devices, the old approach would no longer work,
because the same device index would apply to both video device file
descriptor and the input device file descriptor.
By storing the file descriptor, we can differentiate between the two
portions of the same EventHub::Device.

Test: atest inputflinger_tests libinput_tests
Test: touch interaction with the booted phone
Bug: 111480215
Change-Id: Iadb95f2b14499d600167c89f86fde5db82608af0
diff --git a/services/inputflinger/EventHub.h b/services/inputflinger/EventHub.h
index ea663b7..125847f 100644
--- a/services/inputflinger/EventHub.h
+++ b/services/inputflinger/EventHub.h
@@ -418,6 +418,7 @@
     Device* getDeviceByDescriptorLocked(const std::string& descriptor) const;
     Device* getDeviceLocked(int32_t deviceId) const;
     Device* getDeviceByPathLocked(const char* devicePath) const;
+    Device* getDeviceByFdLocked(int fd) const;
 
     bool hasKeycodeLocked(Device* device, int keycode) const;
 
@@ -466,10 +467,6 @@
     int mWakeReadPipeFd;
     int mWakeWritePipeFd;
 
-    // Ids used for epoll notifications not associated with devices.
-    static const uint32_t EPOLL_ID_INOTIFY = 0x80000001;
-    static const uint32_t EPOLL_ID_WAKE = 0x80000002;
-
     // Epoll FD list size hint.
     static const int EPOLL_SIZE_HINT = 8;