Add support for 9-axis gravity and linear-acceleration sensors
virtual orientation sensor using 9-axis fusion
Change-Id: I6717539373fce781c10e97b6fa59f68a831a592f
SensorService main thread wasn't java-enabled. however, in
some situations we end-up calling into the BatteryService from
that thread which causes a crash.
Change-Id: Iffba90e4c4b743dba84d62f1342001a9db31916d
Make sure to send an event down only for sensors that report a value only on data
change. Other sensors, will naturally send an event when the next event is available.
Bug: 4025681
Change-Id: I6d444deda388b6bc9a33e3371e09d390f1566ec5
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
The cut-off frequency of the lowpass filter was too high
for the sampling rate used by DELAY_NORMAL.
Now we use the same filters used for the gravity vector
(cascaded biquad at 1.5 Hz)
Change-Id: I319dc4f449a3abd553d61b196a9ddcf7782f912d
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
Most accelerometers have 8-bits accuracy so we beed to
reject 48dB in thestop-band, which requires a 4-th order
filter at the cut-off frequency we're using.
Change-Id: Ic00421d38d751641f86b1f3ad7663e6b44a91198
- upadte documentation for rotation vector
- update method dealing with rotation vector to deal with 4 components
- virtual rotation-vector sensor reports all four components
- improve SensorManager documentation layout
Whent he 4-th component of the rotation-vector is present, we can save
a square-root when computing the quaternion or rotation matrix from it.
Change-Id: Ia84d278dd5f0909fab1c5ba050f8df2679e2c7c8
indeed, by construction of the rotation matrix, it is
guaranteed to have a length of 1.
moreover, the normalization code was missing a square-root,
fortunatelly, since the length is 1, this didn't cause any
damage (since sqrt(1) = 1).
Change-Id: I9facd668caaf5bb3bfccb139ab872f2bb2066365
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
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
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
the increased maximum rate is needed for proper gyro integration, current gyro
parts can sample at up to 800Hz
Change-Id: Ide75f6d5bc7a0fdafeb2dafd72db39e7afb9e794
As part of this change, consolidated and cleaned up the Looper API so
that there are fewer distinctions between the NDK and non-NDK declarations
(no need for two callback types, etc.).
Removed the dependence on specific constants from sys/poll.h such as
POLLIN. Instead looper.h defines events like LOOPER_EVENT_INPUT for
the events that it supports. That should help make any future
under-the-hood implementation changes easier.
Fixed a couple of compiler warnings along the way.
Change-Id: I449a7ec780bf061bdd325452f823673e2b39b6ae
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
remove old sensor service and implement SensorManager
on top of the new (native) SensorManger API.
Change-Id: Iddb77d498755da3e11646473a44d651f12f40281