sensors: Fix thread-safety + cleanup source code.

This cleans up the source code of the goldfish sensors module a bit:

- Implement proper thread-safety with mutexes. The HAL is pretty
  specific that module methods can be called from different threads
  at any time, and that the code should be thread-safe. That was
  not the case.

- Get rid of un-necessary native_handle processing and dup()-ing.

- Remove the artificial distinction between 'control' and 'data'
  channels, which was probably introduced to handle calls to
  poll() and set_delay() from two different threads (without
  proper synchronization, yuck!).

Change-Id: I3300218ca8b40c9f6df637afb4b4b0da2a446199
1 file changed