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
Resize the event queue before starting the polling thread to avoid
potential concurrent access.
Test: run VtsHalSensorsV2_0TargetTest
Change-Id: I71af46169e7731df4135639644665365b3714e1f
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
Define log tag at build level to ensure all libraries have a tag
defined.
Bug: 135638664
Test: run VtsHalSensorsV2_0TargetTest
Change-Id: I593055b59238e9fa8dead00a3dafa84c00e90ec4
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
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
hidl-generated makefiles are now generated such that bpfmt(file) == file.
Bug: 67417008
Test: enable bpfmt hook
Change-Id: I53e5bf67a0d314e1b10c0ba0c7172a7af358ddcc
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
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
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
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
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
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
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
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
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
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
Implements new VTS tests to verify that Sensors HAL 2.0 activate
function behaves as expected and returns the correct values.
Bug: 115969174
Test: Tests pass against default implementation
Change-Id: I3dbc86b0c9df3958f11bae4eff925d1869319738
Verify that the batch function is correctly implemented for Sensors
HAL 2.0. This test ensures that the interface is properly implemented,
not that sensors generate events at the requested rate.
Bug: 115969174
Test: Builds, new test passes against default implementation
Change-Id: I607ff18f59d1ba73aa972ed46b04332892772355
All events in the temporary event buffer were being saved during
testing. This caused some events to be saved multiple times. This
patch ensures that only new events are saved.
Bug: 115969174
Test: Verified duplicate events are not received
Change-Id: Ia2c7df7273456700e0da2ddd927f7daf42e69334
Implements the activate and batch functions for the default Sensors
2.0 implementation.
Bug: 111070257
Test: Builds
Change-Id: I5987ab722cdd97c7cd7ff466d6d989794171b851
Implements default functions for a Sensors 2.0 HAL that does not
support direct channel operation.
Although Sensors 2.0 supports direct channel operation, it is not a
requirement unless a device supports High Fidelity Sensors. A direct
channel implementation is vendor-specific, and therefore, the default
implementation does not provide a reference implementation.
A default implementation is able to be found in Sensors 1.0 since
direct channel operation has not changed between Sensors 1.0 and 2.0.
Bug: 111070257
Test: Builds
Change-Id: I1c4ef0cd9d4bd4b7ae3212358f9493c28c2798f4
Auto-generated default implementation for Sensors HAL 2.0 via
hidl-gen and cleaned up formatting.
Modifies Android.bp for binderized HAL implementation which includes:
- Adding service.cpp
- Adding android.hardware.sensors@2.0-service.rc
android.hardware.sensors@2.0-service.rc was copied and updated from
the sensors@1.0 default implementation.
Bug: 111070257
Test: Builds
Change-Id: I6a939511ff6b4011cfe95bd26c3093ad18f26f5a
Adds a test to Sensors 2.0 to ensure that if the initialize function
is called twice, then the FMQs used in the second call receive events.
Bug: 115969174
Test: New test passes (SensorsHidlTest#CallInitializeTwice)
Change-Id: I21a9307397eca1f2be93a826db89d24002e848c0
Properly initialize the test environment for Sensors HAL 2.0 by
constructing and reading from FMQs.
Bug: 115969174
Test: Builds, VTS tests run (some pass) against locally modified
sensors HAL
Change-Id: Id959e50c18b643d2693c90bac15710ed6f34b1b4
Copy the VTS tests for Sensors 1.0 into the 2.0 directory to provide a
starting point for 2.0 tests. Updates references to 2.0 from 1.0 where
necessary.
Bug: 115969174
Test: Builds
Change-Id: Ia385552c208087175272627c65b9096cdb8f4afa
Require that the values returned from getSensorsList do not change
before the entire system reboots. The values must be stable even
across Sensors HAL restarts. This allows for the framework to
automatically re-establish connections if the Sensors HAL crashes.
Bug: 111070257
Test: Compiles
Change-Id: I0e4b7d6ef8f89f6780c6a14d67465fd3692cd482
The ISensorsCallback will be used to push notifications into the
sensors framework, such as when dynamic sensors are connected.
Bug: 111070257
Test: Compiles
Change-Id: I681e6de341a80016983a3ab7fa45284ee9104918
The EventQueueFlagBits is used to notify the other end of an FMQ when
an action should be taken. For instance, the read end of the queue is
able to wait on a particular mask bit to be set by the write end of
the queue before reading events.
This is necessary because the number of events to read must be
specified when calling the FMQ's read() or readBlocking() functions.
read() will fail if the specified number of events is not available.
readBlocking() will not perform a partial read, so if the number of
events to read is not known ahead of time, the function may block for
an extended period of time until enough events are queued up. By
utilizing the EventFlag, the reading of events is able to wait until
events are ready to be read, and then the availableToRead() function
provides the number of events to read when calling read() or
readBlocking().
Bug: 111070257
Test: Compiles
Change-Id: I20e9e566efc58196e27e50dae3fc13518ce605fc
Replaces poll with the new initializeMessageQueues call in
ISensors::2.0.
Bug: 111070257
Test: Build succeeds
Change-Id: I99f951fe5f1d93d267bee6734534993b1088baeb
Copy the current version of the Sensors HAL into the 2.0 directory to
provide a starting point to replace the polling function. Update
version and headers. Import types from version 1.0 of Sensors HAL.
Bug: 111070257
Test: Build succeeds
Change-Id: Ibd00d83016dedc06e583579a0d76c7baa8fbcd05