Enable wakeup sensors.
SensorService should hold a wakelock till the app reads events from a wakeup sensor. Currently drivers hold a wakelock with a
timeout while delivering events from a wake up sensor like Significant Motion. This hack can be removed now.
Bug: 9774884
Change-Id: If3b5acb99c9cf0cd29012fcfa9d6b04c74133d01
diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
index c365671..c2eaf4e 100644
--- a/libs/gui/SensorEventQueue.cpp
+++ b/libs/gui/SensorEventQueue.cpp
@@ -144,6 +144,15 @@
return mSensorEventConnection->setEventRate(sensor->getHandle(), ns);
}
+void SensorEventQueue::sendAck(const ASensorEvent* events, int count) {
+ for (int i = 0; i < count; ++i) {
+ if (events[i].flags & WAKE_UP_SENSOR_EVENT_NEEDS_ACK) {
+ mSensorEventConnection->decreaseWakeLockRefCount();
+ }
+ }
+ return;
+}
+
// ----------------------------------------------------------------------------
}; // namespace android