summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.cpp
Commit message (Collapse)AuthorAgeFilesLines
* sensorservice: fix an invalid format stringKhalid Zubair2016-04-201-1/+1
| | | | Change-Id: Ib41bca95e6be7831c5ce77bceaf6a3d9f8b37d41
* sensorservice: add power usage to dumpsysKhalid Zubair2016-04-201-0/+2
| | | | | | | Include each sensor's power usage info in the per-sensor dumpsys info section. Change-Id: If10535d1e7fe6a35d9385ce2e6083a4c5188a06d
* Merge tag 'android-6.0.1_r3' of ↵Steve Kondik2015-12-071-4/+9
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/native into cm-13.0 Android 6.0.1 release 3 Change-Id: I437aaf148d440a8144afe1454948980fc3b40cca
| * Avoiding flush on-change sensors at subscriptionPeng Xu2015-10-271-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial sensor flush at subscription is a mechanism to avoid sensors to get stale samples before subscription happens. However, there is a slight chance that a most recent sample will be lost during the flush process. This is OK for continuous sensors but problematic in on-change sensor as on-change event does not come continuously and a lost event can cause inconsistent state in client. Flush at subscription of on-change sensor is disabled in this CL to avoid new important on-change event to be discarded during the initial flush process. Bugs: b/24647069 b/25241873 b/24804819 Change-Id: Ibda099c6b9f5fb6e200f13cf13a850b0026e9e7c
* | sensorservice: Don't replace HAL orientation sensorEthan Chen2015-11-071-4/+0
| | | | | | | | | | | | | | | | | | * Previously HAL orientation sensor would always be replaced if the HAL did not provide a rotation vector sensor as well. Practically no HAL does, so the virtual sensor would always replace it. * Add the virtual sensor only if the HAL does not provide it. Change-Id: I50ad2cd6c60b53eddc4c6854997ec2e3dbff0d1a
* | sensorservice: Register orientation sensor if HAL doesn't provide itArne Coucheron2015-11-071-3/+8
| | | | | | | | | | | | | | | | | | * In KitKat and on most Samsung devices, the orientation sensor is not getting registered, and makes the compass non-working in a lot of apps. This patch enables the sensor for such devices. Change-Id: I0ebba72ec4aa2cfa02c21a6daff0c356c6793fd0 (cherry picked from commit 98fa6f1152da759ef3eaf36cb16e0aaf2013376a)
* | sensorservice: Fix init sequence for pre-1.1 API sensor HALsRicardo Cerqueira2015-11-071-7/+15
|/ | | | | | | | | | | | | | | | | | | The sensors API introduced a new flush() method that older binaries won't have. For those, replace the firstFlush invocation with a setDelay call since a lot of implementations interpreted that as the initialization step. We also don't want any kind of call to flush() to happen when it isn't there, since it'll either hit a random OEM extension or a memory address we really don't want to execute. Change-Id: I26ce923fe385751fed7d1c483a53c074249f0620 sensorservice: Set the rate for pre-1.1 HALs _after_ activation We want to be sure these are applied in the same sequence they used to be... Change-Id: Ied2ba08ed3c4bed3a80bac6ab5471fcea9ba2c09
* Check for the presence of accel and magnetometer sensors before adding AOSP ↵Aravind Akella2015-07-201-2/+8
| | | | | | | fusion sensors. Bug: 22502485 Change-Id: I3d9018649302b98004e4e216b2173e8411a08501
* Rename wakelock held internally by SensorService.Aravind Akella2015-07-101-2/+2
| | | | | Bug: 22076400 Change-Id: I62129549b0681f200f40da01f53140245309ed88
* Enable sensor data injection mode through adb.Aravind Akella2015-06-301-49/+40
| | | | Change-Id: I415cf8ff0871fa74babaf9b879c68f210298b472
* Merge "Fix crash in SensorService. Ignore devices with no sensors." into mnc-devAravind Akella2015-06-241-0/+2
|\
| * Fix crash in SensorService. Ignore devices with no sensors.Aravind Akella2015-06-241-0/+2
| | | | | | | | Change-Id: I1491740baa6348f97c336b6883b11ad2ab93cf73
* | More information in sensor bugreports.Aravind Akella2015-06-181-21/+110
|/ | | | | | | i) Log last 20 activations/deactivations of sensors. ii) Increase logging upto 50 events for accelerometer, step_counter and significant motion. Change-Id: I3966ed0abda8b705f3d16e94a9370fa1b97baa57
* Use LOCATION_HARDWARE permission for data injection.Aravind Akella2015-06-101-1/+1
| | | | Change-Id: Ie81cb0d5f537d5431f2127891cca1d39c969ee7b
* Merge "Improve logging in SensorService dump output." into mnc-devAravind Akella2015-05-121-137/+228
|\
| * Improve logging in SensorService dump output.Aravind Akella2015-05-121-137/+228
| | | | | | | | | | | | | | 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
* | Merge "Fix the arguments to memcpy." into mnc-devAravind Akella2015-05-091-1/+1
|\ \
| * | Fix the arguments to memcpy.Aravind Akella2015-05-081-1/+1
| |/ | | | | | | Change-Id: Ieaee26f46f43a9d412537047566178985370198b
* | Add body sensors app op - framework nativeSvetoslav2015-05-011-35/+64
|/ | | | Change-Id: I727a2bb1e28ae9158f2df9c74dd0aee977dfd47f
* Enable data injection mode in SensorService.Aravind Akella2015-04-231-29/+135
| | | | Change-Id: I0cd32a017235c31c54816e4a357ce3b988350ed6
* Support restricted mode in SensorService.Aravind Akella2015-03-241-11/+58
| | | | | | | 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 45aa0227: Merge "Fix potential format string vulnerability"chh2014-11-251-6/+3
|\ | | | | | | | | * commit '45aa022710165c321cdec9a475f269d6932fe1f3': Fix potential format string vulnerability
| * Fix potential format string vulnerabilityBernhard Rosenkränzer2014-11-241-6/+3
| | | | | | | | | | | | | | | | A sensor name containing a format string could have interesting side effects... Change-Id: If7f1378aa68572d9716c339728eab18faa6b9f2a Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
* | Add a timeout for releasing SensorService wake_lock.Aravind Akella2014-11-011-29/+82
|/ | | | | | | | | 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
* Add version number to SensorService dump output.Aravind Akella2014-10-191-1/+2
| | | | Change-Id: I64f9482ade523ec3fafe14bff14db7196e32413f
* Change ordering of memory allocation and calling Thread::run().Aravind Akella2014-10-071-2/+2
| | | | | | | | In some cases this is causing a crash as device.poll is called with NULL. Bug: 17896339 Change-Id: Id431599f2c661338c355c7081b6602f8449a9198
* Fix sockfd leakage in SensorService.Aravind Akella2014-10-021-28/+102
| | | | | | | | | | | | 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
* Merge "Fix a possible SensorService deadlock." into lmp-devAravind Akella2014-09-291-11/+25
|\
| * Fix a possible SensorService deadlock.Aravind Akella2014-09-281-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | If the destructor of SensorEventConnection gets called when the main sendEvents loop of SensorService is executing it may result in a deadlock. The loop promotes each connection to a strong_pointer, calls sendEvents and cleans up the connection if necessary. It is possible that the sp's destructor may delete SensorEventConnection which will call the dtor ~SensorEventConnection(). This dtor again needs SensorService mLock to execute which may result in a deadlock. Bug: 17617897 Change-Id: I76c244dbe85fadb591c0bd1a9a5eb01d93f56505
* | Revert "Fix sockfd leakage in SensorService. Remove sockfd from Looper when ↵Aravind Akella2014-09-271-2/+0
|/ | | | | | | | the connection is removed from mActiveConnections." This reverts commit 5105960d49bfa86efeeea8f87c87aa96b5771c37. Change-Id: I4d39ded2e50ef8a8e0aac27e438876203385a1f0
* Fix sockfd leakage in SensorService. Remove sockfd from Looper Aravind Akella2014-09-231-0/+2
| | | | | | | when the connection is removed from mActiveConnections. Bug: 17472228 Change-Id: Iaabe0968bd2104ef961ff5e8659bf91712e2e1db
* SensorService fixes.Aravind Akella2014-09-151-25/+30
| | | | | | | | | | 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-54/+78
| | | | | | | | | | | | | | | 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-50/+53
| | | | | | | | | | 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-21/+40
| | | | | | | | 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-4/+23
| | | | | | | i) Add more debug stats (acks needed, acks received) ii) Comment out write failure message. Change-Id: Iac892a66530849a2dd023d6f5628cd070a79537d
* SensorService fixes.Aravind Akella2014-08-191-89/+188
| | | | | | | | | | | | | | | 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-65/+270
| | | | | | | | | 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
* CW on L: Fix a SIGSEGV crash in sensor service.Sean Wan2014-07-151-2/+6
| | | | | | | This is to fix b/16189080. BUG: 16189080 Change-Id: I78d44e82f797c0808891acde609040c46745a0bb
* Merge "Surface reportingMode for Sensors."Aravind Akella2014-06-121-17/+24
|\
| * Surface reportingMode for Sensors.Aravind Akella2014-06-121-17/+24
| | | | | | | | Change-Id: Iac8dd3408c90eb7d285a2e8043131fab3a7e58fa
* | am 20914f0a: am a4e345e1: Merge "sensorservice: 64-bit compile issues"Mark Salyzyn2014-06-121-6/+6
|\ \ | |/ |/| | | | | * commit '20914f0ad3691d977f61f1d4b92b49535e8f6f33': sensorservice: 64-bit compile issues
| * am a4e345e1: Merge "sensorservice: 64-bit compile issues"Mark Salyzyn2014-06-121-6/+6
| |\ | | | | | | | | | | | | * commit 'a4e345e169fd9101011e358abdfb9308bc065bdb': sensorservice: 64-bit compile issues
| | * sensorservice: 64-bit compile issuesMark Salyzyn2014-06-101-6/+6
| | | | | | | | | | | | Change-Id: Ied7b779f39e71d041791729f7355b052b63903c5
| | * am cdbf28b3: Merge "native frameworks: 64-bit compile issues"Mark Salyzyn2014-03-131-8/+9
| | |\ | | | | | | | | | | | | | | | | * commit 'cdbf28b3f7f5327f4cb0eb95b8326bf4c24c87ba': native frameworks: 64-bit compile issues
* | | | Surface maxDelay and isWakeUpSensor flag in Sensor.java.Aravind Akella2014-05-231-1/+0
| | | | | | | | | | | | | | | | Change-Id: Idd1e9045190beeca87b086b272e8cbf0bed05bae
* | | | Enable wakeup sensors.Aravind Akella2014-04-231-54/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | am ef89f763: am cf818ebb: Merge "Add stringType and requiredPermission to ↵Aravind Akella2014-04-111-18/+77
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | | | | | sensors, effectively adding permission checking for sensors" into klp-modular-dev * commit 'ef89f7638c43ce5f73e32d487bf65c3375995e3b': Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
| * | | am cf818ebb: Merge "Add stringType and requiredPermission to sensors, ↵Aravind Akella2014-04-111-18/+77
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | effectively adding permission checking for sensors" into klp-modular-dev * commit 'cf818ebbf07c6a20ef48d71bf82f8d4bdf3a398c': Add stringType and requiredPermission to sensors, effectively adding permission checking for sensors
| | * | | Add stringType and requiredPermission to sensors, effectively adding ↵Aravind Akella2014-04-111-18/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | permission checking for sensors This reverts commit 4369a4ebd5ae7567e7075bc82830b83178099ed5. Change-Id: Ifa8619cc6873470a07a987763d818d78d4232610