am e90c4998: Merge "fix [4025681] continuous sensors should not try to send an event as soon as they\'re activated" into honeycomb-mr1

* commit 'e90c4998b514f738b3655e55b51a38119b8c5f23':
  fix [4025681] continuous sensors should not try to send an event as soon as they're activated
This commit is contained in:
Mathias Agopian
2011-03-10 17:37:47 -08:00
committed by Android Git Automerger

View File

@@ -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);
}
}
}
}