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>
This commit is contained in:
Aniroop Mathur
2017-07-10 22:35:47 +05:30
parent c85724298e
commit 443a4acbf7

View File

@@ -578,10 +578,11 @@ typedef struct sensors_poll_device_1 {
* 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.
*/