History log of /frameworks/native/services/sensorservice/SensorService.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
dd5c5cb3b8f3df9b458dff74e247b9a542befee7 17-Mar-2017 Peng Xu <pengxu@google.com> Set sensor operation parameter implementation

Set operation parameter to sensor HAL. Possible paramters include
local geomagnetic field, local gravity acceleration, device dock
state, whether device should run in high performance mode, and
if a magnetic field calibration guide is in progress.

Bug: 30958130
Test: Tested with marlin. Modified hal implementation can get local
geomagnetic field.

Change-Id: Idaedd9e616d01383ba244cc64cf3e319ce02191f
51224681c9a80ff714d40c26d8f465fb1bae17e2 11-Mar-2017 Peng Xu <pengxu@google.com> Add uid and pid information into recent sensor registeration log

Some legacy native client do not specify a package name. Making
tracking of sensor request difficult. This cl adds uid and pid
into the dumpsys print to help alleviate this issue.

Test: adb shell dumpsys sensorservice
Change-Id: I26c778a50927cc6c4f14284c3c6a09d38b2e4dd5
801ea093b0e923a61b832f2adba698a273479880 07-Mar-2017 Mathias Agopian <mathias@google.com> split libsensor our of libgui

Test: compile & run
Bug: treble cleanup
Change-Id: I5b2c2a14f7d3b364d25695cf0901c5b08cfb0fc9
e36e34731cbe77a49aa5e7d687dde041d83d0370 03-Nov-2016 Peng Xu <pengxu@google.com> Direct report mode support in sensor service and client

Added SensorDirectConnection to represent the direct channel.
The life-cycle is similar to that of SensorEventConnection.
Modified SensorDevice and SensorDeviceTreble to support new
HAL API. Added support in SensorManager, SensorService, binder
classes. Also added related helper functions in Sensor and dumpsys
support in SensorList.

Test: manual test with demo app
Bug: 30985702
Change-Id: I8750294b6aab717ed7f525299be642f1f0b85558
ded526e8c3539b5986b46dffc1ff8ab15d7da570 13-Aug-2016 Peng Xu <pengxu@google.com> Fix dangerous unsafe_get() in SensorRecord

Change raw pointers to wp<> and constify relevant lines in

Bug: 30261110

Change-Id: I7f28c593366af44192991061fa5f71cf925b22a8
302f40459526af3598f8427ef321d5e3dac0e0ba 05-Aug-2016 Peng Xu <pengxu@google.com> Tune SensorService thread priority, lower sensor event latency am: 98d30f627e
am: f71fcf9603

Change-Id: I8e9919fef007b18272f2910edc106da1710b93ed
98d30f627ef96ca6e47c9cbcbdcfb63adbeda424 02-Aug-2016 Peng Xu <pengxu@google.com> Tune SensorService thread priority, lower sensor event latency

Change SensorService priority to SCHED_FIFO 10 to ensure
sensor events to be delivered to apps in consistent short time even
if system is under load.

Bug: 30105910

Change-Id: I5ddf7061b75cf46b54e16476d20bbc888024aa43
26af1e0419b8c5fe88306f47e7d43ab24f0b399d 08-Jul-2016 Peng Xu <pengxu@google.com> Merge \"Increase sensor registration log size\" into nyc-mr1-dev
am: 6118fb85d7

Change-Id: I74fae8dc3458adbc421d2589510bc858b1d2d79b
363b3fde1499521aafdc78d9d28380cc643ec6b5 08-Jul-2016 Peng Xu <pengxu@google.com> Increase sensor registration log size

This is for aiding debugging of b/29625330. The size is increased
so that we have a better chance to know what happened before the
failure happens.

Bug: 29625330
Change-Id: I8b741cb5981d8e91b9ef53a00e65c0bbe34ed55e
2bee6c565136c291bba0c9310f6975c6cc196728 23-Jun-2016 Greg Kaiser <gkaiser@google.com> Merge \"Sensor: Make getId() more varied\" into nyc-dev
am: c0ca0ceaa5

Change-Id: Ifa6208fea63d830d07447d5232b39f9e3ccf870b
53ca2e00c6f2a71b93c8e3c8e85aeeb03c5bd06d 22-Jun-2016 Greg Kaiser <gkaiser@google.com> Sensor: Make getId() more varied

Apps from different developers will now receive a different
ID for the same dynamic sensor. Additionally, all apps
will now receive a different/new ID for the same dynamic
sensor after a factory reset.

Bug: 28775590, 29547335
Change-Id: I368655b0e4bdc16736a7fd163ea3f7dad2886b3b
22c661db1291af40928a691f5bf5dad4d077e573 20-May-2016 Chih-hung Hsieh <chh@google.com> Merge "Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE." am: bb261bf41a
am: dea1b6820d

* commit 'dea1b6820d0370914061ee6d147c2fab0c1bfd6c':
Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE.

Change-Id: Icf533c544905be12e7a28fce4523f32a0b3bedb0
a389c7a87c1ae31e177153f1eb0b0159b9effaea 20-May-2016 Chih-Hung Hsieh <chh@google.com> Fix misc-macro-parentheses warnings in sensorservice and CHECK_INTERFACE.

Bug: 28705665
Change-Id: I53ed01b67054327ad55a7e83143cc82283573fe1
6a2d3a06caa337857cf60cfc70a9a78909ad3608 21-Dec-2015 Peng Xu <pengxu@google.com> Fix sensor uuid, retrofit recent event logger

Fix an issue that causes uuid field not being initialzed in

MostRecentEventLogger in sensorservice is migrated to use RingBuffer
instead of a custom circular buffer. This is expected to improve
readability and maintainability of code.

Dumpsys print format is retouched to offer more information in easier
to read format.

Bug: 28305085

Change-Id: I190e43350b60a22a9fccb92a95d6eab06a471560
755c451c7861a029e26e5f16e319b629169e656d 08-Apr-2016 Peng Xu <pengxu@google.com> sensorservice: switch to use sp<> in sensor list

* Switch to use smart pointer in SensorList to avoid object
life cycle issue.
* Refactor HardwareSensor and various virtual sensor class.
* Change active virtual sensor map into a set of handles.

Change-Id: I674d5eb5c0038179f9ef1b6f0d576b8b605649ec
0cc8f809924706c7d683da30605f432635dd5bb6 06-Apr-2016 Peng Xu <pengxu@google.com> Refactor sensor list in SensorService

Refactor sensor lists management logic in sensorservice:
* Factor all sensor list management code into a separate class.
* Remove error-prone repeated sensor lists.
* Solve synchronization issue when sensor is added or removed during runtime.
* Switch to STL containers.

Bug: b/27911774

Change-Id: I94d5571e1fa3166dbe893ffac2a2a7584be6349c
c130d7ad6ca88abe443a435fdb025a9a0886ea6e 05-Apr-2016 Greg Kaiser <gkaiser@google.com> SensorService: Remove unused function

We remove the unused getSensorRecord function. This function
was accessing the mActiveSensors field without obtaining a lock.
We're looking to simplify this code, so we just remove this instead
of trying to fix it.

Change-Id: I8c4ed3cc7ed17d90aa9a5d7f33f9ab9238f9403f
e51c25724d0da28a84e13ceffa40542d18ff4258 04-Apr-2016 Peng Xu <pengxu@google.com> [sensorservice] temporarily remove Autolock mSensorsLock

Bug: b/27992752

Change-Id: I3d139c988d1a3522b75374423dcda74c5bd510a3
47e96014fe6576a0ae7b02e7a2cb2275e549bbc9 29-Mar-2016 Peng Xu <pengxu@google.com> Fix a few known issues in SensorService

This CL fixes a few known issues in sensorservice which is related
to newly added dynamic sensor discovery API.

* check and ensure handle uniqueness for dynamically discovered
* add mutex for synchronizing r/w of various sensor lists.
* ensure dynamic sensor list is reported sorted by handle.
* code format fix


Change-Id: Iec6df90ae150321ea9e4309b2ac1200b8dc37f05
2576cb63b3fe1592f54816625036566b9eb0793a 20-Jan-2016 Peng Xu <pengxu@google.com> Dynamic Sensor Discovery implementation

Defined the dynamic sensor meta data type and UUID of sensor.

Implementation in sensorservice and the native SensorManager to
support Dynamic sensor discovery.

Change-Id: I9df2f2ae51d46cd946a9757393f7a60b52cc4fb8
eb4d628b69831d533f14c09fd63400f75e69ba76 11-Dec-2015 Peng Xu <pengxu@google.com> Divide huge SensorService files into managable pieces

Splitted SensorService.cpp and SensorService.h into smaller more
manageable pieces with the embedded classes/structs now in individual

Change-Id: I5e75c41b9e0e5c9aff102fe4b0f142c61d1203e2
f66684a6fb2a2991e84a085673629db2a0494fc6 23-Jul-2015 Peng Xu <pengxu@google.com> Add AOSP Geomag and Game Rotation, and Gravity

Providing AOSP software implementation of Geomag Rotation Vector, Game
Rotation Vector and Gravity sensors for platforms that does not have
hardware implementation of these sensors but do have primitive sensors
(accelerometers, gyrometers and magnetometers).

Previously, AOSP Gravity sensor is enabled only when all primitive sensors are
available. This is changed so that AOSP Gravity will be available even
no magnetometer is in the device.

Related bug/feature request:
* b/17508800
* b/22610016

Change-Id: I4e2d3e544884047d66e7fdbce2282f1f8234eae9
5c538053346107a8ec704d8769059ab6a23ebeef 29-Jun-2015 Aravind Akella <aakella@google.com> Enable sensor data injection mode through adb.

Change-Id: I415cf8ff0871fa74babaf9b879c68f210298b472
(cherry picked from commit 841a5926fc9b3f9f0e654ba3aab8e43bea7de7f1)
841a5926fc9b3f9f0e654ba3aab8e43bea7de7f1 29-Jun-2015 Aravind Akella <aakella@google.com> Enable sensor data injection mode through adb.

Change-Id: I415cf8ff0871fa74babaf9b879c68f210298b472
18d6d51a00897988e3347b130f533e9ffdd8c365 18-Jun-2015 Aravind Akella <aakella@google.com> More information in sensor bugreports.

i) Log last 20 activations/deactivations of sensors.
ii) Increase logging upto 50 events for accelerometer, step_counter and significant motion.

Change-Id: I3966ed0abda8b705f3d16e94a9370fa1b97baa57
af8ed3f06cf5a0fd37357b438da803f53f33fa56 12-May-2015 Aravind Akella <aakella@google.com> Merge "Improve logging in SensorService dump output." into mnc-dev
444f2675728dde36378beb8e67a94f86ebf1ca46 07-May-2015 Aravind Akella <aakella@google.com> Improve logging in SensorService dump output.

Maintain a per sensor circular buffer of last 10 sensor_events and the wall clock time
at which each event is received.

Change-Id: Ia50c825ab5a7aaf0932ce7dce7ac8b9be7071e77
b412f6e203b38f8047f760261a5e3dc6d0722f08 30-Apr-2015 Svetoslav <svetoslavganov@google.com> Add body sensors app op - framework native

Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f
a9e6cc387072e25706a6d847a97b02a6f25a918b 17-Apr-2015 Aravind Akella <aakella@google.com> Enable data injection mode in SensorService.

Change-Id: I0cd32a017235c31c54816e4a357ce3b988350ed6
4949c50372de4c7fdb57de1dc0c1f5bb3ac463eb 12-Feb-2015 Aravind Akella <aakella@google.com> Support restricted mode in SensorService.

In restricted mode, only CTS tests can register for sensors or call flush() on them. The requests
from other applications will be ignored.

Change-Id: Ieb923df3e0cfe3390fe2d052af776da79589744b
7d831769fce188251afb02e6b933be7bdfe504b4 26-Nov-2014 Chih-hung Hsieh <chh@google.com> am 46ca041f: Merge "Don\'t error out because SensorEventConnection::dump overloads BBinder::dump"

* commit '46ca041f43e3d80029782b12c994b232dc01b5d5':
Don't error out because SensorEventConnection::dump overloads BBinder::dump
72952efe5ce8ee10e3c591cc6d2a3475b7b91690 17-Nov-2014 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Don't error out because SensorEventConnection::dump overloads BBinder::dump

clang warns about SensorEventConnection::dump overloading BBinder::dump
in some conditions.

Since the cause isn't fixable without changing the API, tell clang not
to error out on it.

Change-Id: I15659de7c5499d937019599cfefb01305039e6b5
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
b4373ac9f53e3a6edee915715101d535e1a851a1 30-Oct-2014 Aravind Akella <aakella@google.com> Add a timeout for releasing SensorService wake_lock.

If SensorService is holding a wake_lock and there are no acknowledgements
from ANY app within 5 seconds, release the wake_lock and reset the wake_lock
refcounts for all connections.

Bug: 16874240
Change-Id: I5e950dd393c20173c439cbd5a4ba614ee09d61f4
8a96955c8e14db40b16164236830fc9506a00872 29-Sep-2014 Aravind Akella <aakella@google.com> Fix sockfd leakage in SensorService.

i) Call removeFd() only if the fd in the BitTube has been
previously added to the Looper. Use a flag to determine whether the fd
has been previously added or not.
ii) Increment mPendingFlushEventsToSend after holding a connectionLock.
iii) Store the number of acks that are pending in SensorEventQueue
and send them all at once.

Bug: 17472228
Change-Id: I1ec834fea1112a9cfbd9cddd2198438793698502
0ec2066e4774b851c66176b99b0a5aa5abe6ad00 15-Sep-2014 Aravind Akella <aakella@google.com> SensorService fixes.

i) Initialize sensor_event.flags to zero or wake_up flag before sending dropped flush_complete_events. This will avoid unnecessary acks.
Currently it is not set to anything which may result in garbage values for flags field.
ii) Change the dump format of SensorEventConnection.
iii) Add const to method signatures wherever applicable.

Bug id: https://b2.corp.google.com/issues/17498626

Change-Id: Ia736ffb01c366540aab73cdcf596ce852c052593
8493b79e1cff92450076ca7450c4bf4e434a6816 09-Sep-2014 Aravind Akella <aakella@google.com> SensorService fixes

i) Significant Motion multiple clients fix. Make a copy of
mActiveConnections vector before cleaning up SensorEventConnections
when one-shot sensors trigger.
ii) Maintain a mapping between flush_complete_events and
SensorEventConnections to accurately map flush() API calls and
corresponding flush_complete_events
iii) Remove all references to 1_1 and 1_2 HALs.
iv) Dynamically allocate sensor_event buffers in SensorService main

Bug: 17412359
Change-Id: If3c3986197660cafef2d2e0b4dc7582e229cf1c4
9e3adfcebf28c5c76085108dffe98c74df56857d 04-Sep-2014 Aravind Akella <aakella@google.com> SensorService flush fixes.

i) Fix a possible race condition when adding a pending flush connection
to mActiveSensors data structure.
ii) Invalidate flush_complete_events as soon as they are consumed by a
connection so that they are not used by other connections which are
registered for the same sensor.

Change-Id: I1491bea8c2081c4aab1feacc60add13b7aa26bb7
5466c3d20d03d4ae4b0fd0e0a93175091e3b0bb2 23-Aug-2014 Aravind Akella <aakella@google.com> SensorService fixes

1) Limit maxEventsToWrite depending on the size of the socket
buffer allocated (Fix for write failure on manta).
2) Do not call flush() if the sensor is not activated (OEM issue).

Change-Id: I81ea78dbdef3a3773af505ca1c9a5e39492c0b48
e74baf6ca7d57375f38540b6b7ac5e4af019951b 21-Aug-2014 Aravind Akella <aakella@google.com> SensorService fixes.

i) Add more debug stats (acks needed, acks received)
ii) Comment out write failure message.

Change-Id: Iac892a66530849a2dd023d6f5628cd070a79537d
6c2664ae34fd582bc174d3c83e2b18e895ca2496 13-Aug-2014 Aravind Akella <aakella@google.com> SensorService fixes.

1) Flush should only be received by the app calling flush(). Maintain
a queue of all flush() calls and send flush_complete events in that
2) Log warnings for older HALs. Remove batch() calls with DRY_RUN flag.
3) Reallocate event cache when more sensors register and the desired
maxCacheSize increases. Clear NEEDS_ACK flag in the buffer whenever
there is a write() failure.
4) More dump information. Add wake-up flag, maxDelay and timestamps for
sensor events.

Bug: 16874778
Change-Id: I195646191059fd31f75f2f07886c0f98bf9b509a
56ae42613c91f6a6fb0dc3f626daa24666fd18c2 11-Jul-2014 Aravind Akella <aakella@google.com> SensorService performance improvements.

i) Send ack for wake_up sensors on the socket connection instead of using Binder RPC.
ii) Cache events per connection in case there are write failures. Compute cache size
from FIFO counts of sensors.
iii) Send FlushCompleteEvent only for apps that explicitly called flush().

Change-Id: I018969736b7794b1b930529586f2294a03ee8667
9a844cf78f09953145200b4074d47589257a408c 12-Feb-2014 Aravind Akella <aakella@google.com> Enable wakeup sensors.

SensorService should hold a wakelock till the app reads events from a wakeup sensor. Currently drivers hold a wakelock with a
timeout while delivering events from a wake up sensor like Significant Motion. This hack can be removed now.

Bug: 9774884
Change-Id: If3b5acb99c9cf0cd29012fcfa9d6b04c74133d01
700180487ffec09d9df1657b018a7caadac24b75 08-Apr-2014 Aravind Akella <aakella@google.com> Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors

This reverts commit 4369a4ebd5ae7567e7075bc82830b83178099ed5.

Change-Id: Ifa8619cc6873470a07a987763d818d78d4232610
4369a4ebd5ae7567e7075bc82830b83178099ed5 05-Apr-2014 Etienne Le Grand <etn@google.com> Revert "Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors"

This reverts commit c57a019e117117c5a76c772970b26cd0f5db8c6a.

Change-Id: I3540565bc3e56a32cf3b176a29216cf68bb763b2
c57a019e117117c5a76c772970b26cd0f5db8c6a 25-Mar-2014 Etienne Le Grand <etn@google.com> Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors

Change-Id: If0f3dbdb5d2e9378e1fed4614baee4e750d0c850
4b84704b97300eff3ebfab85652e64d54149d205 04-Mar-2014 Aravind Akella <aakella@google.com> Ignore flush complete events when recording last value for a sensor.

Bug: 11822806
Change-Id: I1402d6684ed71ed413aef6a7be3aad945b331ec2
b4099e77ec2bf8e9d4259ff30f0cb1d621deed91 16-Oct-2013 Aravind Akella <aakella@google.com> Bug fixes for SensorService

i) Emulate Flush for AOSP Fusion Sesnsors on newer HALs that support batching.
ii) Early return if there are no events for the current SensorEventConnection.

Bug: 11325707, 11376538

Change-Id: Idb856302463649a99d3d5d0c965bb06ba06b8e1d
c551eac5b16a53f872cbb692d3a0c81e39329725 15-Oct-2013 Aravind Akella <aakella@google.com> SensorService Flush API bug fix.

SensorService is dead locking itself when flush is called on older devices which don't support batching. mConnectionLock is acquired twice.

Change-Id: I5c25585bfb2b396df4b05826a9cba1da7997a3ee
701166d9f60a6e1149ff568aec0e03f3f3925292 08-Oct-2013 Aravind Akella <aakella@google.com> Change API from flush(handle) to flush(). Call flush on all active sensors in the given SensorEventConnection.

Change-Id: I4ef2bec80406c517903ab9782dc9eaf3fa8b7f36
4c8b951f8d6a121e758bd3905fa8987c77863790 06-Sep-2013 Aravind Akella <aakella@google.com> Sensor Batching Bug fixes.

i) SensorService dropping events. Increase SOCKET_BUFFER_SIZE in BitTube ctor.
ii) Call flush before every activate.
iii) Emulate flush for older devices. Add a trivial flush complete event when flush is called.

Bug: 10641596
Change-Id: I30d0f3948e830457143f16e157b6ad81908687ce
724d91d778e71c8186399f4955de14b54812b3ed 27-Jun-2013 Aravind Akella <aakella@google.com> Sensor batching. Changes to the native code.

Bug: 10109508
Change-Id: I7333f3aac76125a8226a4c99c901fb904588df04
cdd7d8bc145bbbd21a1689ed87a381287aeec229 12-Jul-2013 Mathias Agopian <mathias@google.com> resolved conflicts for merge of 00aea5c5 to master

Change-Id: Ie1769be863ee2d411eae451907a928db57882e14
ac9a96da65f6eae4513654adaad8a457d1c1575c 12-Jul-2013 Mathias Agopian <mathias@google.com> fix a dead-lock in sensorservice

sensorservice would deadlock if for some reason
a sensor failed to enable.

simplifed the code a bit, and made it behave a little
closer to mr1.1 -- I couldn't convince myself that
some changes in how locks were used were correct.

Bug: 9794362
Change-Id: I6110f5dbb67e543f1c71d127de2299232badb36a
7438fd1a0132bc6de101e2a5f75040a119b6f29b 08-Jul-2013 Mathias Agopian <mathias@google.com> simplify some unnecessary complex code

getSensorType() ran in O(n) instead of O(1). fix that.

Change-Id: Idcf29e46fc34db32604a0d8e5a9156486783b74f
0319306670b0344da99efa606b6f172dde575a39 11-May-2013 Mathias Agopian <mathias@google.com> various fixes to the sensorservice

1) "google" sensors are now reporting AOSP as the vendor string
2) don't expose the system's sensor fusion if the HAL provides it
3) use uncalibrated gyro if availble for the system's sensor fusion

Change-Id: I25140436cdb29d55e39fd6fbbf8c44a410a83d5c
b6df7d0e4c2117ca476662bd52b6745b3d8a305f 09-May-2013 Mathias Agopian <mathias@google.com> make all libsurfaceflinger and libsensorservice symbols's visibility hidden

we only export the main entry-point.
this saves about 150KB.

Change-Id: I55eb2b6705386fdfa43860deb62f9cdd2a0982aa
4342fdf14ffb792a36c1de25ad14b745df628da2 09-Apr-2013 Jaikumar Ganesh <jaikumar@google.com> 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
5307d17fe33fc26eeeacd6339a9fbfe96cf56873 19-Sep-2012 Mathias Agopian <mathias@google.com> track UID with connections

Change-Id: Id4865f3cd27a95acdbbfdff1f2bb4123f312a13b
33264868ba0aaccb9d4b5e5a067a79a43633f6ec 29-Jun-2012 Mathias Agopian <mathias@google.com> 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
b3989276d17f2b083bec67b695d1078fb86c6c53 21-Oct-2011 Mathias Agopian <mathias@google.com> Rename SensorChannel to BitTube
1cb13461a8cf62e3ba634e5965332f2d284f6d42 28-Jun-2011 Mathias Agopian <mathias@google.com> 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
010e42230135815907e76e5d7e5f30edf9e1799d 09-Jun-2011 Mathias Agopian <mathias@google.com> 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
a1b7db95b6ccf5be9d8dfaac1b8f45494813edc0 28-May-2011 Mathias Agopian <mathias@google.com> Fix a few issues with sensors reference-counting
db5b4bce9e65ec9c2c7762b601297e4abadbc22a 03-Feb-2011 Mathias Agopian <mathias@google.com> 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
f001c92436b4a66eb7687286325ced7f10c9f917 12-Nov-2010 Mathias Agopian <mathias@google.com> 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
71d7a5c289c6ef6b5fc86dd4784a075ca6470e38 15-Nov-2010 Mathias Agopian <mathias@google.com> 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
94e8f6813f3fb2beaa9bcbfb1ad9b4ae2eb46949 11-Nov-2010 Mathias Agopian <mathias@google.com> 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
24d72350f321c17b0bfe1ef3fd52d4070a1c02c3 06-Nov-2010 Mathias Agopian <mathias@google.com> 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
3560fb24b668675627934356f210d84d19bf4e56 23-Jul-2010 Mathias Agopian <mathias@google.com> 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
cf51001dbf28e9885fcacd4048902f1c75768fe9 23-Jul-2010 Mathias Agopian <mathias@google.com> 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
7c1c531872a95051cb11ec829e3daf890d9bb58a 22-Jul-2010 Mathias Agopian <mathias@google.com> propagate sensor event rate properly to the sensor HAL

Change-Id: I1abe4c0fcce423caab79208353fded4d57398227
50df2959e58fc7408f98d11d77c8428397dca445 20-Jul-2010 Mathias Agopian <mathias@google.com> SensorService doesn't crash if correct HAL is not present

Change-Id: I83700b1a1b43390f5830e1056572bfb16e58e8e4
5d2707214dfb97bd8dfcc6620be36841d3c82420 20-Jul-2010 Mathias Agopian <mathias@google.com> Better dumpsys logs

Change-Id: Iae65a8547ee5815cc4c3b74d2c9ef17bed7f565d
fc32881fcc68640d008c7515cdd1bcd866f72cd5 15-Jul-2010 Mathias Agopian <mathias@google.com> new SensorService

remove old sensor service and implement SensorManager
on top of the new (native) SensorManger API.

Change-Id: Iddb77d498755da3e11646473a44d651f12f40281