Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 0b858c1f authored by Brian Stack's avatar Brian Stack
Browse files

Do not send stale event to on-change sensor

When a client requests to activate an on-change sensor, the
SensorService sends the previous sensor event to the new client if
the sensor is already active. This is necessary to ensure that the new
client receives a sensor event since it is unknown when the sensor may
generate a new sensor event.

If two clients simultaneously activate the same on-change sensor that
is currently not active, then the second client would receive a sensor
event from the previous activation which may be from a significant
time ago, leading to an inconsistent state between the clients.

This patch checks that the last sensor event it would send to the
second client is from the current sensor activation in order to
prevent sending any stale sensor events.

Bug: 116283108
Test: 1) Artificially added delay to generate on-change sensor event.
      2) Requested on-change sensor from client 1
      3) Requested on-change sensor from client 2
      4) Verified that client 2 did not receive a stale sensor event
      5) Verified that client 1 and client 2 both received the same
         up-to-date sensor event
Test: Verified that above test case fails at step 4 without this patch

Change-Id: I49587e3da7177882a1e8e67347bbb64acfe38200
parent c284ebf1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment