Add TouchVideoDevice
TouchVideoDevice will represent a video device that reports heatmaps.
The heatmaps are strength of the signal at each point of the
touchscreen, taken at a particular time.
The only purpose of TouchVideoDevice is to read TouchVideoFrames.
Test: this is a partial cherry-pick of a standalone binary that was used
to pull heatmaps. Integration tested by observing the action of
InputClassifier HAL.
Bug: 111480215
Change-Id: Iba1b38114b156d4debb5966b803f3df6cdb1b91c
diff --git a/services/inputflinger/include/EventHub.h b/services/inputflinger/include/EventHub.h
index 1ddb978..744b2a3 100644
--- a/services/inputflinger/include/EventHub.h
+++ b/services/inputflinger/include/EventHub.h
@@ -37,6 +37,8 @@
#include <linux/input.h>
#include <sys/epoll.h>
+#include "TouchVideoDevice.h"
+
/* Convenience constants. */
#define BTN_FIRST 0x100 // first button code
@@ -378,11 +380,13 @@
};
status_t openDeviceLocked(const char *devicePath);
+ void openVideoDeviceLocked(const std::string& devicePath);
void createVirtualKeyboardLocked();
void addDeviceLocked(Device* device);
void assignDescriptorLocked(InputDeviceIdentifier& identifier);
- status_t closeDeviceByPathLocked(const char *devicePath);
+ void closeDeviceByPathLocked(const char *devicePath);
+ void closeVideoDeviceByPathLocked(const std::string& devicePath);
void closeDeviceLocked(Device* device);
void closeAllDevicesLocked();
@@ -397,6 +401,7 @@
status_t unregisterDeviceFromEpollLocked(Device* device);
status_t scanDirLocked(const char *dirname);
+ status_t scanVideoDirLocked(const std::string& dirname);
void scanDevicesLocked();
status_t readNotifyLocked();
@@ -438,6 +443,14 @@
BitSet32 mControllerNumbers;
KeyedVector<int32_t, Device*> mDevices;
+ /**
+ * Video devices that report touchscreen heatmap, but have not (yet) been paired
+ * with a specific input device. Video device discovery is independent from input device
+ * discovery, so the two types of devices could be found in any order.
+ * Ideally, video devices in this queue do not have an open fd, or at least aren't
+ * actively streaming.
+ */
+ std::vector<std::unique_ptr<TouchVideoDevice>> mUnattachedVideoDevices;
Device *mOpeningDevices;
Device *mClosingDevices;