summaryrefslogtreecommitdiffstats
path: root/services/sensorservice
Commit message (Collapse)AuthorAgeFilesLines
* native: add flag to disable legacy sensors fusionDaniel Hillenbrand2013-05-012-0/+9
| | | | | | | Causes problems on all p31xx devices. http://pastebin.com/PabjFVWP Change-Id: Iac9a913e0984d7e9e419772215d3fb3d1a0cb5e8
* sensorservice: Add legacy sensors fusion.Rudolf Tammekivi2013-02-0210-0/+690
| | | | | | | | This change allows devices with accelerometer & magnetometer but without gyroscope to still get virtual sensors such as Gravity, Linear Acceleration and Rotation Vector. Change-Id: Ibb90b70845c766ab52c843557446e34649a7d6d9
* sensordevice: Dummy ALS: Solve fortified libc warningRicardo Cerqueira2013-01-021-1/+1
| | | | | | convert sprint to snprintf, the size of the writes is always known Change-Id: I53ee36b67544ac25de7e5c05ce90b6817c8a9c92
* sensors: Add dummy light sensorRicardo Cerqueira2013-01-022-1/+52
| | | | | | | | | | | | | | | | | | | | Some devices have a sysfs toggle for the lightsensor instead of passing the LUX values for userspace processing; for those, use BOARD_SYSFS_LIGHT_SENSOR:=<sysfs path> This is necessary for the rest of userspace to recognize its existence and toggle it for auto-brightness. It doesn't generate actual light values, though; all backlight adjustments are made in-kernel. Change-Id: I0e546b4740720bd34d1e1d85a96b295fcc697106 sensors: dummy ls: set unique handle handles and types are usually the same, but it's not mandatory. Sony DASH use custom handles, and the previous assumption broke Proximity sensor on Sony devices. Change-Id: I954e13765f42341e6b5393a12556f6a007c4e494
* Sensor: Add RotationVectorSensor2Pawit Pornkitprasan2012-12-054-0/+203
| | | | | | | | | | | | | | | | | (ported from 4.1) Some ICS apps (namely, Google Maps) expects a rotation vector to be available. Newer devices, this is provided by either Android's sensor fusion (requires Gyro) or by hardware sensor fusion (MPL). Older devices will lack this virtual sensor and compass in Google Maps will not work. To fix this, we can provide our own rotation vector sensor by converting the values from the orientation sensor. (They are basically the same information in different formats.) Thanks to Unhelpful for the help with related math. Change-Id: I39489b3a5ce7c7d890768614357f32cc491bd6d9
* Revert "improve sensor fusion" -- DO NOT MERGEMathias Agopian2012-10-011-56/+9
| | | | | | | | | | | This reverts commit bdf277355dcd647bd5d27b38fc107243a2247a02. This reverts commit dc5b63e40ee697324d39fe105d6f12c2bb031fc6. it might be responsible for a regression that makes the rotation vector spin. Bug: 7267330 Change-Id: Ifb10e933537e70c1d85a7ba73a7e3ae59002fe62
* improve sensor battery usage trackingMathias Agopian2012-09-185-73/+207
| | | | | | | | | | | | | | | | | | | | until now we were tracking when a sensors was physically enabled or disabled and we were reporting that to the BattaryService. this wasn incorrect because we could have several different apps enabling the same sensor, so the accounting by the battery service would be incorrect in that case (depending on the order in which these apps disabled said sensor). BatteryService tracks sensors per uid, however SensorService does this per binder connection, so we could have several binder connections for the same uid, to solve this we keep a list of sensor/uid -> count, which is the bulk of this change. Bug: 6661604 Change-Id: I561c198c42ba1736a8671bdacda4c76d72b9dd6f
* track UID with connectionsMathias Agopian2012-09-182-4/+8
| | | | Change-Id: Id4865f3cd27a95acdbbfdff1f2bb4123f312a13b
* fix a typo in SensorServiceMathias Agopian2012-09-181-1/+4
| | | | | | | | It shouldn't have caused much harm though. Also log a warning when enabling a sensor for a connection that is already enabled. Change-Id: Ia4a052381e79183cd4cb1bedc7ba08e5228d7a38
* add a way to enable debugging sensors at runtimeMathias Agopian2012-06-282-7/+28
| | | | | | | | if debug.sensors is true, extra debugging sensors are enabled and HAL provided sensor fusion is disabled Change-Id: I9b093424edb8c5363d1337237cdf6abe4ab266f9
* improve sensor fusionMathias Agopian2012-06-281-2/+23
| | | | | | | we now use a better quaternion propagation equation this is especially beneficial for lower gyroscope rates Change-Id: Ifbf273c8a092a8849ca4fe4b9bca30787e924018
* add some commentsMathias Agopian2012-06-281-2/+14
| | | | Change-Id: Ia2e2c9531715fc2bd5b51c4dc58389e01abfe7e6
* small improvement to sensor fusionMathias Agopian2012-06-271-7/+33
| | | | | | | | | | | | | | 1) there was a typo when computing the system covariance a term in dT^3 was ommitted; the impact was was very limited because of how small this term is. 2) initialize the system covariance matrix with non-zero values for the gyro-bias part. this improves the initial bias estimation speed significantly. 3) added comments here and there Change-Id: I4328c9cca73e089889d5e74b9fda99d7831762dc
* fix a potential buffer overflow in sensorserviceMathias Agopian2012-06-271-1/+1
| | | | | Bug: 6580560 Change-Id: Icf6cafbca09174515a964a7cd69d8cc589ad52de
* Fix a stack corruption in sensorserviceMathias Agopian2012-06-271-5/+13
| | | | | Bug: 6576732 Change-Id: If0f2fb0d0c35b932fb77cd262e676042145b28f9
* fix a typo causing sensor event to be sorted in reverse chronological orderMathias Agopian2012-06-271-1/+1
| | | | Change-Id: I041c64616d88ed1abb5efc90ed9eb0d9baeb4832
* usea socketpair instead of a pipe in BitTubeMathias Agopian2012-06-271-7/+4
| | | | | Bug: 6252830 Change-Id: I363cc7e9f73a5b7d8bbccee312c6d8938c84e99a
* Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-06-272-8/+8
| | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
* Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGESteve Block2012-06-272-3/+3
| | | | | | | See https://android-git.corp.google.com/g/157065 Bug: 5449033 Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
* Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGESteve Block2012-06-271-1/+1
| | | | | | | See https://android-git.corp.google.com/g/156801 Bug: 5449033 Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-06-273-12/+12
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* handle EINTR when calling sensor HAL's poll functionMathias Agopian2012-06-272-2/+7
| | | | | | | | | | | | some sensor HALs don't handle EINTR, make sure to catch it in the sensorservice. also if we ever encounter an error that we can't handle, we abort which will restart us (or the whole system process if we're running in it) Bug: 5511741 Change-Id: I7051882b06980f778736b53d6cd021a99b5ca8d2
* SensorService now always clamps the requested rateMathias Agopian2012-06-271-2/+3
| | | | | | | | | | | | Requested rate will be clamped to the minimum rate and then to 1ms. Previously we would return an error if a lower rate was asked. The SensorManager documentation wording allows this change. We do this to get more consistancy between all the sensor drivers / HALs Change-Id: I199f76486fb76ccbb11e7280460a03726c767e84
* fix an issue where SensorService could request an invalid sensor delayMathias Agopian2012-06-271-2/+8
| | | | | | | | | When the app requests "fastest", the java layer encodes this as a delay of 0. SensorService was passing this unchanged to the HAL. However the HAL is required to reject delays lower that the advertised lower delay. Change-Id: I92be77acd3af62ffeb49e4b31e24ddcd203510e2
* Rename SensorChannel to BitTubeMathias Agopian2012-06-272-5/+5
|
* improve sensorservice dumpsysMathias Agopian2012-06-273-29/+51
| | | | Change-Id: I8b53d5cab884c3aca16d95df5fbf288368d52e8b
* improve sensorservice_test outputMathias Agopian2012-06-271-13/+12
| | | | Change-Id: I6248b6f1f001fedec1bddcddfcd2b381d9bb4bf4
* Fix a few style issues and remove LOG spamMathias Agopian2012-06-271-22/+28
| | | | Change-Id: I6b6f75373f4ac28f98dea6a6f1c2567a6aa02243
* More error checks to avoid div by zero.Michael Johnson2012-06-272-4/+64
| | | | Change-Id: I18e5b72d02bf5420c14334d3a03f18fa40572d31
* Fix occasional fusion divergence by detecting it and resetting the fusion.Max Braun2012-06-273-13/+41
| | | | Change-Id: I51186e12fb9b2316e3671e3908174f4495df89a0
* have the sensorsevice test print the delay of the first received eventMathias Agopian2012-06-271-4/+12
| | | | Change-Id: I89d63122574c3f8790f00512c76d59b463acf18f
* silence sensorservice when it's dropping eventsMathias Agopian2012-06-271-3/+3
| | | | Change-Id: Ib05862e545aa780821aa605e45ab189f530494b7
* sensorservice: be more robust when there are no sensor h/wMathias Agopian2012-06-272-75/+80
| | | | | Bug: 5030108 Change-Id: I45b85b3c492b9268cb0ae44d2e5fc8c708b6e66e
* Remove the simulator target from all makefiles. Bug: 5010576Jeff Brown2012-06-271-7/+0
| | | | Change-Id: I04d722f258951a3078fe07899f5bbe8aac02a8e8
* PermissionCache caches permission checksMathias Agopian2012-06-272-5/+5
| | | | | | | | | | | | | 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
* cleanup Kalman filter parameters, add/fix comments/unitsMathias Agopian2012-06-271-14/+43
| | | | Change-Id: Iedcae7164af8f7ea0e048ea7c72d0f35d16d739f
* improve orientation sensor with gyro dataMathias Agopian2012-06-272-4/+20
| | | | | | | | | 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
* use quaternions instead of MRPsMathias Agopian2012-06-2716-552/+370
| | | | | | | | also use correct time propagation equation disable the fused sensors when gyro is not present since they were unusable in practice. Change-Id: Iad797425784e67dc6c5690e97c71c583418cc5b5
* 9-axis sensor fusion with Kalman filterMathias Agopian2012-06-2723-190/+2158
| | | | | | | Add support for 9-axis gravity and linear-acceleration sensors virtual orientation sensor using 9-axis fusion Change-Id: I6717539373fce781c10e97b6fa59f68a831a592f
* Fix a few issues with sensors reference-countingMathias Agopian2012-06-273-2/+32
|
* Fix a crasher in SensorServiceMathias Agopian2012-06-271-2/+1
| | | | | | | | 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
* frameworks/base: remove LOCAL_PRELINK_MODULEIliyan Malchev2012-06-271-1/+1
| | | | | Change-Id: I54dd62ebef47e7690afa5a858f3cad941b135481 Signed-off-by: Iliyan Malchev <malchev@google.com>
* fix [4025681] continuous sensors should not try to send an event as soon as ↵Mathias Agopian2012-06-271-5/+8
| | | | | | | | | | they're activated 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
* fix [3421350] Killing a game that uses the accelerometer renders the device ↵Mathias Agopian2012-06-272-6/+9
| | | | | | | | | | 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
* fix [3369027] Sensor.TYPE_ROTATION_VECTOR is unstable and returns NaNs when ↵Mathias Agopian2012-06-272-4/+4
| | | | | | | | | | | | running slowly 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
* fix [3237242] sensormanager sensor active count gets out of syncMathias Agopian2012-06-2710-54/+22
| | | | | | | | | | | | | | | | | | 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
* Uses 4-th order low-pass for extracting gravity.Mathias Agopian2012-06-274-2/+33
| | | | | | | | 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
* allow rotation-vector to have 4 componentsMathias Agopian2012-06-271-0/+1
| | | | | | | | | | | | - 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
* don't attempt to normalize the rotation vectorMathias Agopian2012-06-271-4/+6
| | | | | | | | | | | 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
* Add support for virtual sensors.Mathias Agopian2012-06-2715-204/+1296
| | | | | | | | | | | | | | | | | | | | | | 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