summaryrefslogtreecommitdiffstats
path: root/sensors
Commit message (Collapse)AuthorAgeFilesLines
* Add sensors 1.0 default HAL to uhid groupBrian Duddie2019-10-071-1/+1
| | | | | | | | Ensures it can access /dev/uinput in Android Q, sepolicy permitting. Bug: 142105193 Test: confirm hall sensor works again on marlin Change-Id: I585c32d4da4bdc0917068e4d81adeca43d257e56
* Merge changes from topic "c2f2_sensors_vts" into qt-r1-devTreeHugger Robot2019-08-037-248/+303
|\ | | | | | | | | | | | | * changes: Fix handling of reportToken when stopping Change expected return type in direct report VTS Add support for new gralloc HAL versions
| * Fix handling of reportToken when stoppingBrian Duddie2019-08-021-1/+3
| | | | | | | | | | | | | | | | | | VTS should ignore the reportToken returned by configDirectReport when it passes in RateLevel::STOP. Bug: 138758242 Test: run direct channel tests on device using 2.0 HAL Change-Id: I07e789157e051ceab488a61e856f17d50f435072
| * Change expected return type in direct report VTSAnthony Stange2019-08-021-26/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a sensor doesn't support a particular memory type for direct reporting, then registerChannel will return an invalid channel handle. When this handle is used in configureDirectReport, it will return BAD_VALUE and when used in unregisterDirectReport, it will return OK. Currently, the VTS tests assert it will return INVALID_OPERATION, but that will only happen if the entire HAL doesn't support direct reporting instead of a single sensor not supporting a certain memory type. Bug: 138758242 Test: Run VTS and verify DirectChannel* tests now pass Change-Id: Ifba4262b68ec0c4ca6921dad40a03e0a52088d28
| * Add support for new gralloc HAL versionsBrian Duddie2019-08-026-221/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As VTS connects to the IMapper and IAllocator HALs directly, it needs to handle the case where the device only supports the newer HAL versions, which includes IMapper 2.1 & 3.0 and IAllocator 3.0. Since sensors VTS uses the same functionality from the different HAL versions, condense the code into a common interface with HAL version-specific template instantiation. Also remove the unused code that came along with copying from the gralloc VTS reference source. Bug: 138758242 Test: run gralloc-related sensors VTS on Pixel 2+ Change-Id: I1646d8f92546623594af8541bc8ac02955370694
* | Merge "VTS Sensor HAL 2.0: Fix Batch for One Shot sensors" into qt-r1-devTreeHugger Robot2019-08-031-1/+6
|\ \
| * | VTS Sensor HAL 2.0: Fix Batch for One Shot sensorsVishal Agarwal2019-08-021-1/+6
| |/ | | | | | | | | | | | | | | | | One Shot sensors have minDelay set to -1. Force the minDelay to be 0 in the VTS test to avoid errors from invalid parameter Bug: 138758242 Test: Run Batch test manually VtsHalSensorsV2_0TargetTest --gtest_filter=SensorsHidlTest.Batch Change-Id: Ib2287f6f11502c10d346f5e7216c5f31d585edf9
* / Fix assumptions in SensorsHidlTest.NoStaleEventsAndrew Lehmer2019-08-021-5/+32
|/ | | | | | | | | | | | | | This test was making a couple of false assumptions which were causing it to fail. The fixes are related to the following assertions: 1. One-shot sensors do not report an initial event. 2. Special sensors may not report an initial event. 2. Some on-change sensors may not report an initial event. The test now only checks for a stale event if the sensor reports an initial event consistently. Bug: 138758242 Test: ran on C2 DVT; only fails due to an improperly configured sensor Change-Id: I83f0cb2f6e878244f3d94ae77f64bb8ed2f78e0b
* Fix wait_for timestamps in Sensors VTSAnthony Stange2019-07-291-18/+22
| | | | | | | | | | | | | | | Previously, NoStaleEvents was treating any timestamps it dealt with as if they were in microseconds, but sensors.minDelay is in microseconds and Event timestamps are in nanoseconds. This uses std::chrono helpers to ensure the correct time is used when deciding how long to sleep during the test so that if waitForEvents never passes, the test doesn't time out. Bug: 136736906 Test: Run VTS and verify VtsHalSensorsV2_0Target doesn't finish as an incomplete module. Change-Id: Ibba59dbf9312f97d7275e5aa8cd36547ab09e328
* Verify mPollThread is joinable before detachingAnthony Stange2019-07-151-1/+3
|\ | | | | | | | | | | am: 65945cfb15 Change-Id: Iee183865223aa993241c19924245177b3462d4da
| * Verify mPollThread is joinable before detachingAnthony Stange2019-07-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If HidlSetUp() bails before startPollingThread() is called (which can happen if the HAL isn't implemented on the given device), mPollThread will initialize with the default constructor resulting in joinable() returning false which means calling detach() throws an exception. Checking joinable() before detaching allows the test suite to be skipped successfully. Fixes: 136736906 Test: Run vts-tradefed on VtsHalSensorsV1_0Target and verify that it is skipped successfully on a device that doesn't support HAL 1.0 Change-Id: Ie685ae2dc314edb8df2f3cc7112141a2f5e46008
* | Merge "Deactivate sensors after flush events are received" into qt-devAnthony Stange2019-07-021-1/+6
|\| | | | | | | | | | | am: 8913d1df2c Change-Id: Ie32a5d1c5f1308060af6ae8c3b7d4c25ebdc9301
| * Merge "Deactivate sensors after flush events are received" into qt-devTreeHugger Robot2019-07-021-1/+6
| |\
| | * Deactivate sensors after flush events are receivedAnthony Stange2019-07-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VTS flush test case was previously deactivating sensors before waiting for flush events to be received causing any pending flush events to be discarded per the HAL contract. Bug: 136472044 Test: Run test and ensure it passes Change-Id: I23b94e650c6dbbc33640768bee356a49565ba753
* | | Avoid NPD when re-initializing HAL failsBrian Duddie2019-06-203-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the sensors HAL crashes or errors out during a test where we manually re-run the environment setup function (e.g. CleanupConnectionsOnInitialize), the pointer to the interface will become null. Avoid dereferencing it by checking for nullness in the per-test setup function and after each manual setup call. Also add a death recipient to help identify instances where the HAL crashes during a test. Bug: 135638664 Test: run VTS on device where HAL crashes during above mentioned test Change-Id: Iff7aa159c6b859272cfd18e7efb3ca431ea214fc
* | | Fix NPD in GrallocWrapperBrian Duddie2019-06-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Avoid dereferencing null if mapper service is not available. Bug: 135638664 Test: run VtsHalSensorsV2_0TargetTest Change-Id: I3cf2a9f152d8f1737cb5a94356e252d54156c716
* | | Fix log tag for sensors VTS testsBrian Duddie2019-06-206-6/+3
|/ / | | | | | | | | | | | | | | | | Define log tag at build level to ensure all libraries have a tag defined. Bug: 135638664 Test: run VtsHalSensorsV2_0TargetTest Change-Id: I593055b59238e9fa8dead00a3dafa84c00e90ec4
* | Notify HAL when events are readBrian Duddie2019-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | As defined in the HAL specification, the client of the HAL (framework or VTS) needs to set the EVENTS_READ flag when it fetches samples out of the FMQ, to support blocking write mode. Bug: 135442877 Test: run VTS on a device supporting HAL 2.0 Change-Id: Ic7755e869b999b638086275e4e579a84600be314
* | Add guidance for avoiding race in Sensors HAL 2.0Brian Duddie2019-06-151-1/+5
| | | | | | | | | | | | Bug: 135216821 Test: n/a, comment change only Change-Id: Iad491c5e221c86a2724d4074ac645b8ee6e9af6f
* | Fix null deref in sensors 2.0 VTS teardownBrian Duddie2019-06-111-4/+8
| | | | | | | | | | | | | | | | | | Avoid attempting to clean up resources that were never initialized, e.g. if the target device doesn't support the version of the HAL in question. Fixes: 134911861 Test: run VtsHalSensorsV2_0Target on device that only supports HAL v1.0 Change-Id: I6b529fae13b1347d533a19e04f1c7748bcda961b
* | Clarify documentation for AINFO_SENSOR_PLACEMENTPierre Fite-Georgel2019-05-291-4/+34
|/ | | | | | | | | | Specify units of location vector and define the direction of the rotation matrix translation as Android device frame to local sensor frame. Fixes: 133264933 Test: n/a, comment update only Change-Id: I76dae7a6fae3c8f44a4dcd1fcc6b790abff86420
* Rename init script for Sensors 2.0 Mock ServiceBrian Stack2019-03-292-1/+1
| | | | | | Bug: 129562840 Test: Builds Change-Id: I4744a8e00657f39010d5e2a39fe38d13813e6439
* Merge "Update makefies: no 'types' internal"Steven Moreland2019-03-051-5/+0
|\
| * Update makefies: no 'types' internalSteven Moreland2019-03-041-5/+0
| | | | | | | | | | | | Bug: 123976090 Test: N/A Change-Id: I84b659b163b63d39535b462a3df8a9c19f680976
* | Merge "Update makefies: no 'types'" am: 4ee5ec1469 am: bab622f6a6Steven Moreland2019-03-041-25/+0
|\ \ | |/ |/| | | | | | | am: 7224bc9bcf Change-Id: I434939e0770afa436c532a945542fce30a71ef7d
| * Update makefies: no 'types'Steven Moreland2019-03-041-25/+0
| | | | | | | | | | | | Bug: 123976090 Test: N/A Change-Id: I30fb04c81889b62775e1b764b965fdb0f893de17
| * pack VTS cc_test binaries as general-testsKeun Soo YIM2018-12-071-0/+1
| | | | | | | | | | | | | | Test: make general-tests Bug: 120093339 Merged-In: I363450d205868f900e4925ccff1430e2a569f2a4 Change-Id: I363450d205868f900e4925ccff1430e2a569f2a4
* | Update makefiles.Steven Moreland2019-02-111-0/+1
| | | | | | | | | | | | Bug: 123976090 Test: N/A Change-Id: I5fb6c126a090a3fe0fa4829ea9224564133dc1ae
* | Rename Sensors 2.0 Default ImplementationBrian Stack2019-02-072-2/+2
| | | | | | | | | | | | | | | | | | | | Rename the default implementation to include ".mock" to indicate that the default implementation is a mock service and not intended to be used on production devices. Bug: 124020028 Test: Builds, cuttlefish loads sensors Change-Id: I28c29f23615324cb2ae1dbe1767f18d40cf8d8e1
* | Merge "Properly append META_DATA event on flush"TreeHugger Robot2019-01-302-2/+2
|\ \
| * | Properly append META_DATA event on flushBrian Stack2019-01-292-2/+2
| | | | | | | | | | | | | | | | | | | | | Bug: 123597380 Test: atest VtsHalSensorsV2_0TargetTest:SensorsHidlTest#FlushSensor Test: Framework properly receives and handles flush complete events Change-Id: I09d2b52555c27602e1fd2ee2282f8ad700a1be18
* | | Use more realistic values for sensorsBrian Stack2019-01-301-26/+30
|/ / | | | | | | | | | | Bug: 123597515 Test: Builds, cuttlefish device health checks pass Change-Id: Ifddf16761a218788ac7174e16b2d9f7ebb9685a9
* | Add missing sensors to Sensors 2.0Brian Stack2019-01-284-8/+261
| | | | | | | | | | | | | | Bug: 123380869 Test: atest com.android.devicehealthchecks.SensorsBootCheck#checkSensors passes on Cuttlefish Change-Id: I08a8406b3932469878da981add61f60b7774a377
* | Add VINTF Fragment to Sensors HAL 2.0Brian Stack2019-01-232-0/+12
| | | | | | | | | | | | Bug: 122267378 Test: Built Cuttlefish, Sensors HAL 2.0 requested on boot Change-Id: Ibe1eaa277852db1b8346caee172632f0951daefc
* | Verify stale requests are removedBrian Stack2019-01-151-21/+115
| | | | | | | | | | | | | | | | | | Add tests to verify that sensor requests and direct connections are invalidated after initialize is called on the Sensors HAL. Bug: 120857563 Test: Builds, tests pass against default implementation Change-Id: I690bc5168dfa9adb7b5e08fd6ddac49f68366846
* | Merge "Stop Wake Lock thread if it is running"TreeHugger Robot2019-01-121-0/+11
|\ \
| * | Stop Wake Lock thread if it is runningBrian Stack2019-01-091-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the Wake Lock thread is running, stop it whenever initialize() is called in order to prevent an invalid Wake Lock Queue from being read. Also disable all sensors whenever initialize() is called to ensure that stale sensor registrations are properly cleaned up. Bug: 122468928 Test: Sensors HAL 2.0 tests run without crashing Change-Id: I5fb55628545adbb481da6fcda157c78cff834134
* | | Merge "Add WakeLockQueueFlagBits to Sensors 2.0"TreeHugger Robot2019-01-113-6/+21
|\ \ \ | |/ / |/| |
| * | Add WakeLockQueueFlagBits to Sensors 2.0Brian Stack2019-01-103-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WakeLockQueueFlagBits is used to signal between the framework and the HAL whenever events are available on the Wake Lock FMQ. The introduction of this type allows for the HAL to utilize blocking calls when reading the Wake Lock FMQ, if desired. Also removes stale reference to WakeLockEvent. Bug: 122528664 Test: Builds, verified Sensors 2.0 default implementation reads events when they become available on the Wake Lock FMQ Change-Id: Ia83bd1642b8f6aa8ea86da05e83f4040c6e593bb
* | | Initialize callback for Sensors HAL 2.0 VTS testsBrian Stack2019-01-071-1/+13
|/ / | | | | | | | | | | Bug: 122468928 Test: Sensors HAL 2.0 tests successfully run Change-Id: Ic34c47548ea45e9a49392e2fa94e2d787f3c6a0f
* | Update documentation for initialize()Brian Stack2018-12-181-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Updates the documentation for the initialize() function and defines the requirements for using the Event FMQ's writeBlocking function which requires both a read and write notification. Also adds requirement for the Sensors HAL to cleanup active sensor requests and direct connections whenever initialize is called. Bug: 120857563 Test: Builds Change-Id: I11c8f7404d27e9ab21f9314523faebc1970b9f0c
* | Merge "Add support for writeBlocking"TreeHugger Robot2018-12-071-0/+10
|\ \
| * | Add support for writeBlockingBrian Stack2018-11-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for the Sensors HAL to use writeBlocking when sending sensor events to the framework. Bug: 111070257 Test: Builds, verified that if the default implementation is modified to use a writeBlocking call, the framework receives events, and the HAL blocks if the Event FMQ is full. Change-Id: I62fc654513afe98901b1e65bdf422af276d22663
* | | pack VTS cc_test binaries as general-testsKeun Soo YIM2018-11-271-0/+1
| | | | | | | | | | | | | | | | | | Test: make general-tests Bug: 120093339 Change-Id: I363450d205868f900e4925ccff1430e2a569f2a4
* | | Merge "Implement Direct Channel Tests"TreeHugger Robot2018-11-154-1/+141
|\ \ \
| * | | Implement Direct Channel TestsBrian Stack2018-11-144-1/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements Direct Channel tests for Sensors HAL 2.0. The tests verify that the interface has been implemented correctly and that expected values are returned. These tests are not intended to verify that the rate at which sensor events are generated is correct. Also, correctly return -1 as the channel handle if direct report is not supported. Bug: 115969174 Test: Tests pass against default implementation Change-Id: I31b3211268701665757b03d5ee4ba2316f461282
* | | | Merge "Data Injection Tests for Sensors HAL 2.0"TreeHugger Robot2018-11-151-46/+65
|\| | |
| * | | Data Injection Tests for Sensors HAL 2.0Brian Stack2018-11-141-46/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements VTS tests for Sensors HAL 2.0 DATA_INJECTION mode. Ensures that if a sensor reports that it supports data injection, events that are injected while in data injection mode are written back to the Event FMQ. Ensures that AdditionalInfo events not written to the Event FMQ. Bug: 115969174 Test: Data injection tests pass against default Sensors HAL 2.0 Change-Id: I350956b759e14abfff73de4e20384524bbc00a0f
* | | | Acquire and Release Wake LockBrian Stack2018-11-145-15/+133
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Acquire a wake lock in the Sensors 2.0 Default implementation whenever there are outstanding WAKE_UP events. Release the wake lock whenever the number of oustanding WAKE_UP events is zero or at least SensorTimeout::WAKE_LOCK_SECONDS seconds have elapsed since the previous WAKE_UP event was written to the Event FMQ. Bug: 111070257 Test: Builds, wake lock is acquired and released as expected. Change-Id: I7c57724430144fd4022646d1fef1b1fa8bc4235d
* / / Data Injection Support for Default Sensors HAL 2.0Brian Stack2018-11-133-12/+63
|/ / | | | | | | | | | | | | | | | | | | Implements data injection support for the default Sensors HAL 2.0. Allows events to be injected into the Sensors HAL and these events be written back to the Event FMQ. Bug: 111070257 Test: Passes data injection VTS tests Change-Id: If652417ec0df4148ffb5be3d5dd8bc6f0be65467