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
This commit is contained in:
parent
db5b4bce9e
commit
3f2f891611
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user