Commit Graph

18 Commits

Author SHA1 Message Date
Jaikumar Ganesh
4342fdf14f Sensor changes.
1. Some sensors can wake up the AP. Add wakelocks.
2. Handle backward compatibility for rotation vector
   heading accuracy.
3. Cleanup auto disabled sensors.
4. Fix race condition between enable and dispatch.

Change-Id: I39dddf12e208d83cd288201986ee994312555820
2013-04-12 09:34:44 -07:00
Mathias Agopian
5307d17fe3 track UID with connections
Change-Id: Id4865f3cd27a95acdbbfdff1f2bb4123f312a13b
2012-09-18 23:33:36 -07:00
Mathias Agopian
33264868ba add a way to enable debugging sensors at runtime
if debug.sensors is true, extra debugging
sensors are enabled and HAL provided sensor fusion
is disabled

Change-Id: I9b093424edb8c5363d1337237cdf6abe4ab266f9
2012-06-28 19:46:54 -07:00
Mathias Agopian
b3989276d1 Rename SensorChannel to BitTube 2012-06-27 17:07:55 -07:00
Mathias Agopian
1cb13461a8 PermissionCache caches permission checks
This is intended to absorb the cost of the IPC
to the permission controller.
Cached permission checks cost about 3us, while
full blown ones are two orders of magnitude slower.

CAVEAT: PermissionCache can only handle system
permissions safely for now, because the cache is
not purged upon global permission changes.

Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
2012-06-27 17:07:55 -07:00
Mathias Agopian
010e422301 improve orientation sensor with gyro data
when we do our own sensor fusion, we also export an
improved orientation sensor and hide the HAL sensor.
The fused orientation sensor is much more precise, fast
and smooth.

Change-Id: I0ea843b47ad9d12f6b22cce51f8629852d423126
2012-06-27 17:07:55 -07:00
Mathias Agopian
a1b7db95b6 Fix a few issues with sensors reference-counting 2012-06-27 17:07:54 -07:00
Mathias Agopian
db5b4bce9e fix [3421350] Killing a game that uses the accelerometer renders the device unable to sleep
when an app dies, make sure to disable all sensors that process
is connected to, regardless of wether this was the LAST connection
to this sensor.

Change-Id: I9c72b1792eee03815304674d5c2f25b5270e4748
2012-06-27 17:07:54 -07:00
Mathias Agopian
f001c92436 Add support for virtual sensors.
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
2012-06-27 17:07:54 -07:00
Mathias Agopian
71d7a5c289 Fix a race condition in sensormanager
the per-connection state assumed the main sensorservice
lock was held during access. This is however not true while
pre-processing the events just before sending them to clients.
Therefore, there was a small window during which this state
could be modified while being used.

we now have an internal lock that protects this state.

Change-Id: I594680f20f09d6a4f1f38f093a1d3f650dcef1be
2012-06-27 17:07:54 -07:00
Mathias Agopian
94e8f6813f record the last event received regardless of having clients or not
We only recorded the last received event (which is needed when a sensor
is activated on a connection) when there was some connection active.
This should fix an issue where sometimes the light sensor doesn't
return an event whent activated.

we also didn't need to hold the main lock while dispatching events
to clients.

Change-Id: I6c6386c040051ce205e3c0516c678e0603fa45e1
2012-06-27 17:07:54 -07:00
Mathias Agopian
24d72350f3 improve sensorservice dumpsys and increase the max sensor rate to 1 ms (1000Hz)
the increased maximum rate is needed for proper gyro integration, current gyro
parts can sample at up to 800Hz

Change-Id: Ide75f6d5bc7a0fdafeb2dafd72db39e7afb9e794
2012-06-27 17:07:54 -07:00
Mathias Agopian
3560fb24b6 SensorService handles last known state properly
SensorService now correctly sends the last known
state of a sensor as soon as a new connection is made.
This fixes the issue where, for instance, an application
could wait a long time before getting the light or proximity
sensor initial state.

Change-Id: Ic41392f3626e26c4f15746c7e17c7ecd44bbb10b
2012-06-27 17:07:53 -07:00
Mathias Agopian
cf51001dbf filter sensor event by connection
we now don't send events down to a connection that has not
registered for this event.

Change-Id: I3fe507974d3e99293749bfec2ef871e8a0ee9600
2012-06-27 17:07:53 -07:00
Mathias Agopian
7c1c531872 propagate sensor event rate properly to the sensor HAL
Change-Id: I1abe4c0fcce423caab79208353fded4d57398227
2012-06-27 17:07:53 -07:00
Mathias Agopian
50df2959e5 SensorService doesn't crash if correct HAL is not present
Change-Id: I83700b1a1b43390f5830e1056572bfb16e58e8e4
2012-06-27 17:07:53 -07:00
Mathias Agopian
5d2707214d Better dumpsys logs
Change-Id: Iae65a8547ee5815cc4c3b74d2c9ef17bed7f565d
2012-06-27 17:07:53 -07:00
Mathias Agopian
fc32881fcc new SensorService
remove old sensor service and implement SensorManager
on top of the new (native) SensorManger API.

Change-Id: Iddb77d498755da3e11646473a44d651f12f40281
2012-06-27 17:07:53 -07:00