summaryrefslogtreecommitdiff
path: root/libs/sensor/SensorManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* SensorManager doesn't need to ping the remote serviceShai Barack2024-01-291-0/+6
| | | | | | Change-Id: I3c964a497e2fcc9106fe469e71a7d61f0d089653 Bug: 322228259 Test: presubmit, and verified performance with stack samples
* Respect deviceId in SensorManager cache.Vladimir Komsiyski2023-12-271-34/+36
| | | | | | | | | | | | | | | | | | | | | | Do not use the cached SensorManager if the device association of the underlying package has changed. Since the SensorManager is cached per package, if the deviceId changes, then the native SensorManager will always return the wrong sensors. This is seen in the failing CTS. The most straight-forward solution is to refresh the cache when the device for that UID has changed. It would be better to have an API that takes a deviceId but that's a longer term fix - b/306575095 This change is effectively flagged by the read-only flag android.companion.virtual.flags.enable_native_vdm. When it is disabled, the deviceId will always be 0 (i.e. default device). Test: atest VirtualSensorNativeTest Bug: 306575095 Fix: 317495754 Change-Id: If02beb9f3eceec19c104ae03fcb0a8fefb46f85f
* Add SensorManager::getDefaultDeviceSensorListVladimir Komsiyski2023-12-081-0/+16
| | | | | | Fix: 315295201 Test: manual with the VDM test app Change-Id: I096a5af3f3476386e145c4aec23e25719dc78fec
* Merge "Device-aware native SensorManager." into mainTreehugger Robot2023-10-201-5/+53
|\
| * Device-aware native SensorManager.Vladimir Komsiyski2023-10-201-5/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add device id to SensorManager instances based on the devices this UID is present on. SensorManager queries the native VDM instance for the deviceId and the sensor policy of that device. If the UID is present only on a single virtual device and that device has custom sensors, then give it that device's sensors by default. If the UID is not on any virtual devices or is on more than one, then give it the default device's sensors. Fix: 303535376 Test: manual with streamed app using sensor NDK to a virtual device Change-Id: I275a010a7a70b34176deaf4c9dcd61188c83ac32
* | Add HAL Bypass Data Injection mode to Sensor ServiceMark Wheatley2023-10-111-0/+16
|/ | | | | | | | | | | | | | | | Add a new mode, HAL_BYPASS_REPLAY_DATA_INJECTION, which behaves similar to Replay Data Injection with the difference that injected sensor data is not injected into the HAL but simply passed back up to clients in the platform. Also, while I was in there, hook up the remaining bits and bobs to get Replay Data Injection working and accessible from APIs in SystemSensorManager in the platform. Bug: 287257057 Test: manual Change-Id: I9fc33a8bf5b67c02483089f849ba7ff0346d8097 (cherry picked from commit b0df44e2a6a40fb70a6e98a1e4e629945995a5f6)
* Allow sensors list to be emptyDevin Moore2023-04-261-5/+2
| | | | | | Test: atest VtsHalSensorManagerV1_0TargetTest Bug: 278013275 Change-Id: I091f57de9570b0ace3a8da76f16fe0e83f0aa624
* Native runtime sensors direct connection support.Vladimir Komsiyski2023-02-251-1/+7
| | | | | | | | | | | | | | When a direct channel is (un-)registered or configured, notify the runtime sensor callback instead of the HAL and pass the shared memory region to it. The SensorDirectConnection object is tied to a deviceId and may only be configured for sensors of that device. Only ashmem direct channel type is supported for runtime sensors. Bug: 266042170 Test: atest CtsSensorTestCases Change-Id: Ie1a628650bd94b6d81e95d3b9f8f25fcf445666c
* Add removeInstanceForPackageMethod to SensorManagerAnthony Stange2023-02-211-0/+10
| | | | | | | | | | | | In order to ensure that clients don't leak their sensor manager instance that we currently store in a static map, they need to be able to remove their instance. Otherwise, this instance is never removed from the list and will hang around until our SensorManage instance is destroyed. Bug: 269014004 Test: Run ./libsensorserviceaidl_fuzzer Change-Id: I52185f74ae8d28b379440235ca6f03c5089081f5
* Remove some new memory leaks from SensorManagerDevin Moore2023-02-211-0/+5
| | | | | | | | | | After catching an error in Sensor::unflatten, there are memory leaks caught by the fuzzer in the same test case. Test: libsensorserviceaidl_fuzzer with testcase from bug Bug: 269014004 Merged-In: I509cceb41f56ca117d9475f6f6674244560fe582 Change-Id: I509cceb41f56ca117d9475f6f6674244560fe582
* Virtual device sensor support in sensor service.Vladimir Komsiyski2022-11-291-0/+13
| | | | | | | | | | | | The virutal device sensors are runtime sensors, using handle range of [0x5F000000, 0x5FFFFFFFF]. As opposed to the HAL dynamic sensors, they do not rely on the existence of a SENSOR_TYPE_DYNAMIC_SENSOR_META. Instead of sensor events representing registration/unregistration of dynamic sensors, they are handled syncronously in the sensor service. The virtual dynamic sensors are not exposed via the dynamic sensors API. They are provided to SensorManager through a separate JNI call. Bug: 237278244 Test: atest cts/tests/sensor Change-Id: I09e5b089d1ae3bed7a25a5454a31aba9cf594a05
* Add ASensorManager_getDynamicSensorList.Erik Staats2022-02-081-0/+33
| | | | | | | Bug: 217890463 Test: Used uhid-sample to add a dynamic sensor and verified it can be used with sensor_test. Change-Id: Ida2ce53c3d94ed530ba4981d299fa4855c35e337
* Plumb attribution tag to Sensor ServiceArthur Ishiguro2021-02-191-3/+4
| | | | | | | | Also updates noteOp() to use the attribution tag. Bug: 171922082 Test: Flash, verify through logs that attribution tags are propagated Change-Id: I4601f6f8696e8cf1517d2401f8ddfffae4a29d04
* Add hinge angle sensor type to sensor NDKAnthony Stange2020-01-221-1/+1
| | | | | | Bug: 144139857 Test: N/A Change-Id: Id809a8f65b31143759978702d18e6ac944d62ac3
* Fix format-pedantiic warningYi Kong2019-09-201-1/+1
| | | | | | | C++ spec requires %p format specifier to correspond to a void pointer. Test: presubmit Change-Id: I98c72f94b6ea73607e84f32ddcc2149331e39978
* Fix race between SensorManager ctor and callbackBrian Duddie2019-07-011-1/+1
| | | | | | | | | Avoids potential invalid memory access if system server crashes during initialization. Bug: 132927376 Test: confirm sensors initialize Change-Id: If7421c452b5893ab2567323d265503a1ce304482
* [sensor] Modernize codebase by replacing NULL with nullptrYi Kong2018-07-171-8/+8
| | | | | | | | Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I82e6ef0f074571a9537fa2eeedf56975363ca601
* Hide some headers from libbinder to vendorsJiyong Park2018-04-171-0/+1
| | | | | | | | | | | | | | | | | The headers that are related to system services are now hidden to vendors. Note that this does not break anything because vendors have already been disallowed to talk to system services via sepolicy. Their use of binder is strictly limited within themselves (via /dev/vndbinder). The hidden headers are now guarded with __ANDROID_VNDK__ and including them from vendors (or vendor variants of other VNDK libraries) will trigger a build-time error. Bug: 78113963 Test: m -j Test: devices boots to the UI Change-Id: I19be5ca024fc4081b7861d908d75758c1d956a83
* sensors: pass sensor handle along with injected eventAlexey Polyudov2017-05-241-2/+3
| | | | Change-Id: Ifa5825b08d5b809865f9066c7a763202cebb987f
* Set sensor operation parameter implementationPeng Xu2017-04-041-0/+9
| | | | | | | | | | | | | 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
* Avoid locking global map during waiting for servicePeng Xu2017-03-171-19/+29
| | | | | | | | | Wait for service before attempting to get a SensorManager object. Bug: 36389997 Bug: 36404344 Test: system boots, sensors working with sensorlogger test Change-Id: Ib5d41bc58edb8f6be56f803324a79a99a50da45e
* Sensor direct report with HardwareBuffer channelPeng Xu2017-03-071-20/+17
| | | | | | | | | | | | | Implement creation of sensor direct channel in sensor service for sensor direct report feature. Bug: 30985702 Test: cts-tradefed run cts --module CtsSensorTestCases --test android.hardware.cts.SensorDirectReportTest Test: cts-tradefed run cts --module CtsSensorTestCases --test android.hardware.cts.SensorNativeTest Change-Id: I52350811df538986cea7f5e1fb336fad53234c86
* split libsensor our of libgui Mathias Agopian2017-03-071-0/+301
Test: compile & run Bug: treble cleanup Change-Id: I5b2c2a14f7d3b364d25695cf0901c5b08cfb0fc9