Fix the bug that causes setDelay not working. Many native sensor
apps, such as camera EIS, still use this API.
Bug: b/27790706
Change-Id: Iaf7eeb3311a2148ca556d27dbd117e1992715644
Support factory calibration, low-level debug, etc. using direct access
to the device file while the Android runtime is up without interference
from the sensors HAL or context hub HAL by using a lock file. When the
HALs notice that this lock file is present, their read threads will
block until the file is removed, rather than reading from their
respective device files. This avoids the race between the read threads
and a command-line utility that are both attempting to read events from
a device file with no inherent multi-client support.
This lock file is created and deleted by nanotool (or potentially some
other utility in the future), assuming it is run with sufficient
privileges to access the directory.
The current implementation sacrifices true inter-process synchronization
for lower overhead in the read threads, meaning that nanotool needs to
use a time delay to have reasonable assurance that the HAL threads have
noticed the creation of the lock file.
Bug: 27569995
Change-Id: I692acc4ca773151fbd677ac1d71f526c598b4e5f