until now we were tracking when a sensors was
physically enabled or disabled and we were reporting
that to the BattaryService.
this wasn incorrect because we could have several different
apps enabling the same sensor, so the accounting by the
battery service would be incorrect in that case (depending
on the order in which these apps disabled said sensor).
BatteryService tracks sensors per uid, however SensorService
does this per binder connection, so we could have several
binder connections for the same uid, to solve this we keep
a list of sensor/uid -> count, which is the bulk of this
change.
Bug: 6661604
Change-Id: I561c198c42ba1736a8671bdacda4c76d72b9dd6f
some sensor HALs don't handle EINTR, make sure to catch it in the
sensorservice.
also if we ever encounter an error that we can't handle, we abort
which will restart us (or the whole system process if we're running
in it)
Bug: 5511741
Change-Id: I7051882b06980f778736b53d6cd021a99b5ca8d2
Add support for 9-axis gravity and linear-acceleration sensors
virtual orientation sensor using 9-axis fusion
Change-Id: I6717539373fce781c10e97b6fa59f68a831a592f
whether a physical sensor needed to be active or not was managed by
a simpe reference counter; unfortunatelly nothing prevented it to
get out of sync if a sensor was disabled more than once.
sensorservice already maintainted a list of all the "clients"
connected to a physical sensor; we now use that list to determine if
a sensor should be enabled. This can never be "out-of-sync" since
this is the only data structure linking a sensor to a user of that
sensor.
also removed the isEnabled() method, which was never used and
implemented wrongly (since it didn't take into account that a sensor
could be disabled for a client but not of another).
Change-Id: I789affb877728ca957e99f7ba749def37c4db1c7
Rework sensorservice to allow "virtual sensors", that is
sensors that report a synthetized value based on real sensors.
the main change to sensorservice is around managing which real
sensor need to be activated and which rate to use.
The logic for all this has been moved into SensorDevice, which
essentially wraps the sensor HAL but adds two features to it:
- it keeps track of which sensors need to be activated
- it keeps track of what rate needs to be used
For this purpose an "identity" is associated with each real sensor
activation, so we can track them.
On start-up we check for gravity, linear-acceleration and
rotation-vector sensors, if they're not present in the HAL, we
synthetize them in sensor-service.
Change-Id: I841db2c1b37ef127ed571efa21732ecc5adf1800