summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-04-03 15:38:14 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-03 15:38:14 -0700
commit66ac90276a07b63ad74761d0bd0f1a7218babfbf (patch)
treec7b0e7bbec2702da755917335e402961c56e3c4a
parente252077d254c84b0e5e86123055ff0b9ab51cd04 (diff)
parent89c30a5486045439ae88561ecea2d6b77f8f942e (diff)
downloadframeworks_base-66ac90276a07b63ad74761d0bd0f1a7218babfbf.zip
frameworks_base-66ac90276a07b63ad74761d0bd0f1a7218babfbf.tar.gz
frameworks_base-66ac90276a07b63ad74761d0bd0f1a7218babfbf.tar.bz2
Merge "usea socketpair instead of a pipe in BitTube"
-rw-r--r--services/sensorservice/SensorService.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index dd6c426..16ddd91 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -35,6 +35,7 @@
#include <gui/ISensorServer.h>
#include <gui/ISensorEventConnection.h>
+#include <gui/SensorEventQueue.h>
#include <hardware/sensors.h>
@@ -587,10 +588,9 @@ status_t SensorService::SensorEventConnection::sendEvents(
count = numEvents;
}
- if (count == 0)
- return 0;
-
- ssize_t size = mChannel->write(scratch, count*sizeof(sensors_event_t));
+ // NOTE: ASensorEvent and sensors_event_t are the same type
+ ssize_t size = SensorEventQueue::write(mChannel,
+ reinterpret_cast<ASensorEvent const*>(scratch), count);
if (size == -EAGAIN) {
// the destination doesn't accept events anymore, it's probably
// full. For now, we just drop the events on the floor.
@@ -598,9 +598,6 @@ status_t SensorService::SensorEventConnection::sendEvents(
return size;
}
- //ALOGE_IF(size<0, "dropping %d events on the floor (%s)",
- // count, strerror(-size));
-
return size < 0 ? status_t(size) : status_t(NO_ERROR);
}