Sensor: HAL guideline clarification upon activation request
Sensor events can be generated even after completion of sensor deactivation
request so the correct time to abandon the stale events is before making new
activation request instead after sensor deactivation request.
For example: In data injection mode which make sensor deactivation request,
sensor events are generated in sensor deactivation state. These events may
not have been picked up by poll before completion of switching to normal mode.
So it is necessary to abandon stale events at the time of activation request
so that in normal mode, application will not get injected events generated
during data injection mode.
Test: Inject sensor events at fastest possible sensor rate in data injection
mode and check whether there is any injected event received by application
after switching to normal mode.
Change-Id: I3a2c8a76946569a12e9416ac20ad2389f914d6e2
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index dde997f..d058d3b 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -578,10 +578,11 @@
* sensor_handle is the handle of the sensor to change.
* enabled set to 1 to enable, or 0 to disable the sensor.
*
- * After sensor de-activation, existing sensor events that have not
- * been picked up by poll() should be abandoned immediately so that
- * subsequent activation will not get stale sensor events (events
- * that is generated prior to the latter activation).
+ * Before sensor activation, existing sensor events that have not
+ * been picked up by poll() should be abandoned so that application
+ * upon new activation request will not get stale events.
+ * (events that are generated during latter activation or during
+ * data injection mode after sensor deactivation)
*
* Return 0 on success, negative errno code otherwise.
*/