chre: fix race when detasking sensor
When detasking a sensor, an event is enqueue to unsubscribe from the sensor events.
It is possible for a sensor sample to be in the queue before the unsubscribe, causing
that sensor event to be delivered after the sensor is detasked.
We need to check the requested rate (vs the current rate, in case the sensor has
multiple requestors). Only forward samples when there is a requested rate.
Export sensorGetReqRate so chre_app.c can call it.
Change osChreApiGetTime to use sensorGetTime so it can be compared to sensor
timestamps.
Bug: 62301968
Test: run CHQTS several times and make sure sensor tests don't fail randomly
Change-Id: I56f228182c610ab82aa0e267b24de70c740d39fb
Signed-off-by: Ben Fennema <[email protected]>
5 files changed