Process runtime sensor events in a separate thread.

SensorService::threadLoop blocks while polling from the device, which
causes the runtime sensor events to never be processed in case there
are no "real" sensor events.

Separating the threads that handle the "real" and the runtime sensor
events solves the issue - verified by adding a long sleep in poll()
and VirtualSensorTest still passes.

The new thread is only started when the the first runtime sensor is
registered.

Bug: 281452823
Bug: 288383960
Test: atest VirtualSensorTest
Test: atest cts/tests/sensor

Change-Id: I96bb217c72462d29c68c510bd7cea97ac925ccb2
2 files changed