Add HAL Bypass Data Injection mode to Sensor Service
Add a new mode, HAL_BYPASS_REPLAY_DATA_INJECTION, which behaves similar
to Replay Data Injection with the difference that injected sensor data
is not injected into the HAL but simply passed back up to clients in
the platform.
Also, while I was in there, hook up the remaining bits and bobs to get
Replay Data Injection working and accessible from APIs in
SystemSensorManager in the platform.
Bug: 287257057
Test: manual
Change-Id: I9fc33a8bf5b67c02483089f849ba7ff0346d8097
(cherry picked from commit b0df44e2a6a40fb70a6e98a1e4e629945995a5f6)
diff --git a/services/sensorservice/SensorDevice.h b/services/sensorservice/SensorDevice.h
index 747a6b0..f127c0f 100644
--- a/services/sensorservice/SensorDevice.h
+++ b/services/sensorservice/SensorDevice.h
@@ -35,6 +35,9 @@
#include <utils/Timers.h>
#include <algorithm> //std::max std::min
+#include <condition_variable>
+#include <mutex>
+#include <queue>
#include <string>
#include <unordered_map>
#include <vector>
@@ -225,6 +228,12 @@
float getResolutionForSensor(int sensorHandle);
bool mIsDirectReportSupported;
+
+ std::mutex mHalBypassLock;
+ std::condition_variable mHalBypassCV;
+ std::queue<sensors_event_t> mHalBypassInjectedEventQueue;
+ ssize_t getHalBypassInjectedEvents(sensors_event_t* buffer, size_t count);
+ bool mInHalBypassMode;
};
// ---------------------------------------------------------------------------