summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorAravind Akella <aakella@google.com>2014-02-11 18:44:42 -0800
committerAravind Akella <aakella@google.com>2014-04-23 17:05:41 -0700
commit35187bd5c1e40ea52a672c525411d05cbcdd6482 (patch)
tree0eaae3cec2a38f4123c836e5170c93b2afb05bff /native
parent3a025393b50658b988411fbbb7435f8f87a4e16e (diff)
downloadframeworks_base-35187bd5c1e40ea52a672c525411d05cbcdd6482.zip
frameworks_base-35187bd5c1e40ea52a672c525411d05cbcdd6482.tar.gz
frameworks_base-35187bd5c1e40ea52a672c525411d05cbcdd6482.tar.bz2
Bug fix for 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: I6cab0147c63f57a494a61f4dfe2a64a27dfe1b4e
Diffstat (limited to 'native')
-rw-r--r--native/android/sensor.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp
index fb4de9e..acfcd83 100644
--- a/native/android/sensor.cpp
+++ b/native/android/sensor.cpp
@@ -123,10 +123,13 @@ int ASensorEventQueue_hasEvents(ASensorEventQueue* queue)
ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue,
ASensorEvent* events, size_t count)
{
- return static_cast<SensorEventQueue*>(queue)->read(events, count);
+ ssize_t actual = static_cast<SensorEventQueue*>(queue)->read(events, count);
+ if (actual > 0) {
+ static_cast<SensorEventQueue*>(queue)->sendAck(events, actual);
+ }
+ return actual;
}
-
/*****************************************************************************/
const char* ASensor_getName(ASensor const* sensor)