Add WakeLockQueueFlagBits to Sensors 2.0
WakeLockQueueFlagBits is used to signal between the framework and the
HAL whenever events are available on the Wake Lock FMQ. The
introduction of this type allows for the HAL to utilize blocking calls
when reading the Wake Lock FMQ, if desired.
Also removes stale reference to WakeLockEvent.
Bug: 122528664
Test: Builds, verified Sensors 2.0 default implementation reads events
when they become available on the Wake Lock FMQ
Change-Id: Ia83bd1642b8f6aa8ea86da05e83f4040c6e593bb
diff --git a/sensors/2.0/default/Sensors.cpp b/sensors/2.0/default/Sensors.cpp
index efc8b05..99c80df 100644
--- a/sensors/2.0/default/Sensors.cpp
+++ b/sensors/2.0/default/Sensors.cpp
@@ -31,6 +31,7 @@
using ::android::hardware::sensors::V1_0::Result;
using ::android::hardware::sensors::V1_0::SharedMemInfo;
using ::android::hardware::sensors::V2_0::SensorTimeout;
+using ::android::hardware::sensors::V2_0::WakeLockQueueFlagBits;
constexpr const char* kWakeLockName = "SensorsHAL_WAKEUP";
@@ -215,7 +216,9 @@
// Read events from the Wake Lock FMQ. Timeout after a reasonable amount of time to ensure
// that any held wake lock is able to be released if it is held for too long.
- mWakeLockQueue->readBlocking(&eventsHandled, 1 /* count */, kReadTimeoutNs);
+ mWakeLockQueue->readBlocking(&eventsHandled, 1 /* count */, 0 /* readNotification */,
+ static_cast<uint32_t>(WakeLockQueueFlagBits::DATA_WRITTEN),
+ kReadTimeoutNs);
updateWakeLock(0 /* eventsWritten */, eventsHandled);
}
}