Commit graph

211 commits

Author SHA1 Message Date
Brian Stack
9a407f23a6 Implement default functions for direct channel
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
2018-10-24 16:26:33 -07:00
Brian Stack
475d4d4d5e Default implementation for initialize()
Implements the default initialize() function for Sensors HAL 2.0

Bug: 111070257
Test: Builds
Change-Id: I1d1f0d732d931adaf12ae40167eea484887fb140
2018-10-24 16:26:27 -07:00
Brian Stack
60fcdcf635 Create Sensors HAL 2.0 Default Implementation
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
2018-10-24 16:15:59 -07:00
Brian Stack
1d329e633a Add CallInitializeTwice Test
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
2018-10-19 15:18:28 -07:00
Brian Stack
85c8b31945 Initialize Sensors Test Environment
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
2018-10-17 16:49:46 -07:00
Brian Stack
b6962f6e7d Copy Sensors VTS 1.0 into 2.0
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
2018-10-15 15:19:03 -07:00
Brian Stack
7ff9564b20 Require consistent getSensorsList
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
2018-10-02 21:29:53 +00:00
Brian Stack
78aa4fc9dd Define the ISensorsCallback
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
2018-09-24 21:33:11 +00:00
Brian Stack
1f0c5ea652 Define EventQueueFlagBits
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
2018-09-20 13:11:46 -07:00
Brian Stack
28c675fd86 Replace poll with initializeMessageQueues
Replaces poll with the new initializeMessageQueues call in
ISensors::2.0.

Bug: 111070257
Test: Build succeeds
Change-Id: I99f951fe5f1d93d267bee6734534993b1088baeb
2018-09-13 14:18:50 -07:00
Brian Stack
ee3f720115 Copy ISensors 1.0 into 2.0 directory
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
2018-09-13 11:02:27 -07:00