summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.h
Commit message (Collapse)AuthorAgeFilesLines
* Enable sensor data injection mode through adb.Aravind Akella2015-06-301-2/+18
| | | | Change-Id: I415cf8ff0871fa74babaf9b879c68f210298b472
* More information in sensor bugreports.Aravind Akella2015-06-181-12/+25
| | | | | | | i) Log last 20 activations/deactivations of sensors. ii) Increase logging upto 50 events for accelerometer, step_counter and significant motion. Change-Id: I3966ed0abda8b705f3d16e94a9370fa1b97baa57
* Merge "Improve logging in SensorService dump output." into mnc-devAravind Akella2015-05-121-1/+50
|\
| * Improve logging in SensorService dump output.Aravind Akella2015-05-121-1/+50
| | | | | | | | | | | | | | 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
* | Add body sensors app op - framework nativeSvetoslav2015-05-011-8/+12
|/ | | | Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f
* Enable data injection mode in SensorService.Aravind Akella2015-04-231-8/+29
| | | | Change-Id: I0cd32a017235c31c54816e4a357ce3b988350ed6
* Support restricted mode in SensorService.Aravind Akella2015-03-241-3/+33
| | | | | | | 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
* am 46ca041f: Merge "Don\'t error out because SensorEventConnection::dump ↵Chih-hung Hsieh2014-11-251-0/+7
|\ | | | | | | | | | | | | overloads BBinder::dump" * commit '46ca041f43e3d80029782b12c994b232dc01b5d5': Don't error out because SensorEventConnection::dump overloads BBinder::dump
| * Don't error out because SensorEventConnection::dump overloads BBinder::dumpBernhard Rosenkränzer2014-11-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Add a timeout for releasing SensorService wake_lock.Aravind Akella2014-11-011-1/+20
|/ | | | | | | | | 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
* Fix sockfd leakage in SensorService.Aravind Akella2014-10-021-3/+26
| | | | | | | | | | | | 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
* SensorService fixes.Aravind Akella2014-09-151-3/+3
| | | | | | | | | | 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
* SensorService fixesAravind Akella2014-09-101-9/+6
| | | | | | | | | | | | | | | 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 threadLoop. Bug: 17412359 Change-Id: If3c3986197660cafef2d2e0b4dc7582e229cf1c4
* SensorService flush fixes.Aravind Akella2014-09-031-3/+10
| | | | | | | | | | 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
* SensorService fixesAravind Akella2014-08-221-0/+2
| | | | | | | | 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
* SensorService fixes.Aravind Akella2014-08-211-0/+1
| | | | | | | i) Add more debug stats (acks needed, acks received) ii) Comment out write failure message. Change-Id: Iac892a66530849a2dd023d6f5628cd070a79537d
* SensorService fixes.Aravind Akella2014-08-191-11/+25
| | | | | | | | | | | | | | | 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 order. 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
* SensorService performance improvements.Aravind Akella2014-07-241-7/+44
| | | | | | | | | 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
* Enable wakeup sensors.Aravind Akella2014-04-231-7/+24
| | | | | | | | 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
* Add stringType and requiredPermission to sensors, effectively adding ↵Aravind Akella2014-04-111-1/+3
| | | | | | | | permission checking for sensors This reverts commit 4369a4ebd5ae7567e7075bc82830b83178099ed5. Change-Id: Ifa8619cc6873470a07a987763d818d78d4232610
* Revert "Add stringType and requiredPermission to sensors, effectively adding ↵Etienne Le Grand2014-04-051-3/+1
| | | | | | | | permission checking for sensors" This reverts commit c57a019e117117c5a76c772970b26cd0f5db8c6a. Change-Id: I3540565bc3e56a32cf3b176a29216cf68bb763b2
* Add stringType and requiredPermission to sensors, effectively adding ↵Etienne Le Grand2014-04-041-1/+3
| | | | | | permission checking for sensors Change-Id: If0f3dbdb5d2e9378e1fed4614baee4e750d0c850
* Ignore flush complete events when recording last value for a sensor.Aravind Akella2014-03-061-1/+1
| | | | | Bug: 11822806 Change-Id: I1402d6684ed71ed413aef6a7be3aad945b331ec2
* Bug fixes for SensorServiceAravind Akella2013-10-251-0/+1
| | | | | | | | | 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
* SensorService Flush API bug fix.Aravind Akella2013-10-141-2/+1
| | | | | | SensorService is dead locking itself when flush is called on older devices which don't support batching. mConnectionLock is acquired twice. Change-Id: I5c25585bfb2b396df4b05826a9cba1da7997a3ee
* Change API from flush(handle) to flush(). Call flush on all active sensors ↵Aravind Akella2013-10-091-1/+1
| | | | | | in the given SensorEventConnection. Change-Id: I4ef2bec80406c517903ab9782dc9eaf3fa8b7f36
* Sensor Batching Bug fixes.Aravind Akella2013-09-161-3/+23
| | | | | | | | | 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
* Sensor batching. Changes to the native code.Aravind Akella2013-09-031-4/+7
| | | | | Bug: 10109508 Change-Id: I7333f3aac76125a8226a4c99c901fb904588df04
* resolved conflicts for merge of 00aea5c5 to masterMathias Agopian2013-07-121-2/+4
|\ | | | | | | Change-Id: Ie1769be863ee2d411eae451907a928db57882e14
| * fix a dead-lock in sensorserviceMathias Agopian2013-07-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | simplify some unnecessary complex codeMathias Agopian2013-07-081-1/+0
| | | | | | | | | | | | getSensorType() ran in O(n) instead of O(1). fix that. Change-Id: Idcf29e46fc34db32604a0d8e5a9156486783b74f
* | various fixes to the sensorserviceMathias Agopian2013-05-161-2/+2
| | | | | | | | | | | | | | | | 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
* | make all libsurfaceflinger and libsensorservice symbols's visibility hiddenMathias Agopian2013-05-091-8/+7
|/ | | | | | | we only export the main entry-point. this saves about 150KB. Change-Id: I55eb2b6705386fdfa43860deb62f9cdd2a0982aa
* Sensor changes.Jaikumar Ganesh2013-04-121-0/+6
| | | | | | | | | | 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
* track UID with connectionsMathias Agopian2012-09-181-1/+4
| | | | Change-Id: Id4865f3cd27a95acdbbfdff1f2bb4123f312a13b
* add a way to enable debugging sensors at runtimeMathias Agopian2012-06-281-0/+1
| | | | | | | | if debug.sensors is true, extra debugging sensors are enabled and HAL provided sensor fusion is disabled Change-Id: I9b093424edb8c5363d1337237cdf6abe4ab266f9
* Rename SensorChannel to BitTubeMathias Agopian2012-06-271-3/+3
|
* PermissionCache caches permission checksMathias Agopian2012-06-271-2/+0
| | | | | | | | | | | | | 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
* improve orientation sensor with gyro dataMathias Agopian2012-06-271-0/+1
| | | | | | | | | 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
* Fix a few issues with sensors reference-countingMathias Agopian2012-06-271-0/+2
|
* fix [3421350] Killing a game that uses the accelerometer renders the device ↵Mathias Agopian2012-06-271-1/+1
| | | | | | | | | | 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
* Add support for virtual sensors.Mathias Agopian2012-06-271-15/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* Fix a race condition in sensormanagerMathias Agopian2012-06-271-1/+2
| | | | | | | | | | | | 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
* record the last event received regardless of having clients or notMathias Agopian2012-06-271-0/+2
| | | | | | | | | | | | 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
* improve sensorservice dumpsys and increase the max sensor rate to 1 ms (1000Hz)Mathias Agopian2012-06-271-2/+2
| | | | | | | the increased maximum rate is needed for proper gyro integration, current gyro parts can sample at up to 800Hz Change-Id: Ide75f6d5bc7a0fdafeb2dafd72db39e7afb9e794
* SensorService handles last known state properlyMathias Agopian2012-06-271-1/+4
| | | | | | | | | | 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
* filter sensor event by connectionMathias Agopian2012-06-271-3/+2
| | | | | | | we now don't send events down to a connection that has not registered for this event. Change-Id: I3fe507974d3e99293749bfec2ef871e8a0ee9600
* propagate sensor event rate properly to the sensor HALMathias Agopian2012-06-271-8/+26
| | | | Change-Id: I1abe4c0fcce423caab79208353fded4d57398227
* SensorService doesn't crash if correct HAL is not presentMathias Agopian2012-06-271-0/+1
| | | | Change-Id: I83700b1a1b43390f5830e1056572bfb16e58e8e4
* Better dumpsys logsMathias Agopian2012-06-271-0/+1
| | | | Change-Id: Iae65a8547ee5815cc4c3b74d2c9ef17bed7f565d