Prevent stale event from being delivered to client
When an on-change sensor is activated, the most recent event is
delivered to the client. A previous change attempted to ensure that
any event that was generated prior to deactivating the sensor would
not be delivered to a client upon activating the sensor. This was to
ensure that an event that was generated in the past, and thus stale,
would not be received by clients. The patch was successful in most
cases, but it did not address the case of a client disabling a sensor
and still maintained a reference to the SensorEventConnection through
the NDK or VNDK.
This patch marks the recent event as stale whenever a sensor
transitions from deactivated to activated. This ensures that the
recent event is always marked as stale, regardless of how the API to
the Sensor Service is utilized.
Bug: 116283108
Test: Verified that stale on-change event is not delivered to a
client.
Change-Id: Iee9a84ec57f5345fb14f0262b492ad100d05c7bb
1 file changed