summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-03-10 15:23:28 -0800
committerMathias Agopian <mathias@google.com>2012-06-27 17:07:54 -0700
commit3f2f8916112126fb1a93e4a4b4e2d4e01570aeee (patch)
tree2ab551ee19f73c3d7f261a96cb8d7a020e84e653 /services/sensorservice/SensorService.cpp
parentdb5b4bce9e65ec9c2c7762b601297e4abadbc22a (diff)
downloadframeworks_native-3f2f8916112126fb1a93e4a4b4e2d4e01570aeee.zip
frameworks_native-3f2f8916112126fb1a93e4a4b4e2d4e01570aeee.tar.gz
frameworks_native-3f2f8916112126fb1a93e4a4b4e2d4e01570aeee.tar.bz2
fix [4025681] continuous sensors should not try to send an event as soon as they're activated
Make sure to send an event down only for sensors that report a value only on data change. Other sensors, will naturally send an event when the next event is available. Bug: 4025681 Change-Id: I6d444deda388b6bc9a33e3371e09d390f1566ec5
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r--services/sensorservice/SensorService.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 697e879..ce1ab3d 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -340,11 +340,14 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
if (rec->addConnection(connection)) {
// this sensor is already activated, but we are adding a
// connection that uses it. Immediately send down the last
- // known value of the requested sensor.
- sensors_event_t scratch;
- sensors_event_t& event(mLastEventSeen.editValueFor(handle));
- if (event.version == sizeof(sensors_event_t)) {
- connection->sendEvents(&event, 1);
+ // known value of the requested sensor if it's not a
+ // "continuous" sensor.
+ if (sensor->getSensor().getMinDelay() == 0) {
+ sensors_event_t scratch;
+ sensors_event_t& event(mLastEventSeen.editValueFor(handle));
+ if (event.version == sizeof(sensors_event_t)) {
+ connection->sendEvents(&event, 1);
+ }
}
}
}