Commit graph

260 commits

Author SHA1 Message Date
Brian Stack
f2aca3b487 Acquire and Release Wake Lock
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
2018-11-14 16:04:44 -08:00
Brian Stack
d23f200603 Data Injection Support for Default Sensors HAL 2.0
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
2018-11-13 17:32:10 -08:00
Brian Stack
9c1867eec8 Update member variables to use mNamingConvention
Bug: 115969174
Test: Builds
Change-Id: Id4334d9060a3110d13debcfaf1bebc9dddd321c5
2018-11-07 17:26:01 -08:00
Brian Stack
40525b145e Implement activate tests for Sensors HAL 2.0
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
2018-11-07 17:26:01 -08:00
Brian Stack
0a20036927 Implement batch test for Sensors 2.0
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
2018-11-07 13:48:20 -08:00
Brian Stack
1fdd1bb4db Implement VTS tests for Sensors 2.0 flush
Bug: 115969174
Test: Tests pass against default implementation
Change-Id: Icb8c3d7776b8460d502bfec251ded061f978bec9
2018-11-07 13:36:11 -08:00
TreeHugger Robot
a29f60d68a Merge "Only save newly received events during testing" 2018-11-06 03:54:28 +00:00
Arthur Ishiguro
e8f98ff983 Merge "Updates EventPayload documentation for (Geomag)-RV" am: 79189993ec am: d60adf2dd9
am: f81482a5f6

Change-Id: I8e3668e3da2c73b5265dfd4d8927692854f94216
2018-11-05 17:57:47 -08:00
Arthur Ishiguro
79189993ec Merge "Updates EventPayload documentation for (Geomag)-RV" 2018-11-06 01:28:23 +00:00
Arthur Ishiguro
d3881ea7fa Updates EventPayload documentation for (Geomag)-RV
The former HAL documentation incorrectly documented (Geomag)-RV
sensor data as Vec4, although an accuracy field is expected according
to the Android sensor docs. Former default HAL implementation has set
the accuracy value to zero, preventing apps from getting this value.

This change guides OEMs to use the Vec4 + accuracy when converting
(Geomag)-RV sensor events. The default HAL implementation passes
this extra data now (ag/5224072), but clients of the former
implementation will still get the data it needs if assuming
the Vec4 sensor data format.

Bug: 116874058
Test: Compile only
Change-Id: I6a5c8a48dd372c3d4682ed5329f7f87862746cb9
2018-11-05 11:01:57 -08:00
Arthur Ishiguro
fa2fcddb09 Adds conversion for quaternion data with accuracy
Also applies formatter.

Bug: 116874058
Test: Compile and verify apps can receive the accuracy
      field

Change-Id: I2535a5a9315ac3d343dcdf6010d3ae74288dfcd4
2018-11-01 17:33:22 -07:00
Brian Stack
9920e212f8 Only save newly received events during testing
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
2018-10-30 12:04:33 -07:00
Brian Stack
e4f74c77b1 Default flush implementation for Sensors 2.0
Bug: 111070257
Test: Builds, passes corresponding VTS tests
Change-Id: I5b46232ffb0dd2c85bccd9dad34dd04d29a5677d
2018-10-30 12:02:52 -07:00
TreeHugger Robot
4c1e30cebd Merge "Register default accelerometer sensor" 2018-10-27 02:02:19 +00:00
TreeHugger Robot
c7aa50238e Merge "Generate events for default Sensors 2.0" 2018-10-27 00:10:19 +00:00
TreeHugger Robot
cad117641a Merge "Add CallInitializeTwice Test" 2018-10-26 23:55:24 +00:00
Brian Stack
2927ab7ed7 Register default accelerometer sensor
Registers a default accelerometer with the Sensors HAL.

Bug: 111070257
Test: Builds, a_sns_test receives accel events
Change-Id: I2f016eb74b9b729854e771264f4c2f1adf025c09
2018-10-24 16:33:34 -07:00
Brian Stack
237abc6cf8 Generate events for default Sensors 2.0
Adds the ability for default Sensors 2.0 implementation to generate
sensor events.

Bug: 111070257
Test: Builds
Change-Id: I98f04dbac5370cc6fc3be43468ba43b6476b4515
2018-10-24 16:33:34 -07:00
Brian Stack
897528dd53 Implement activate and batch functions
Implements the activate and batch functions for the default Sensors
2.0 implementation.

Bug: 111070257
Test: Builds
Change-Id: I5987ab722cdd97c7cd7ff466d6d989794171b851
2018-10-24 16:33:26 -07:00
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
TreeHugger Robot
6624eeeff5 Merge "Adds conversion for quaternion data with accuracy" 2018-10-10 23:54:25 +00:00
Arthur Ishiguro
41c5b89b24 Adds conversion for quaternion data with accuracy
Also applies formatter.

Bug: 116874058
Test: Compile and verify apps can receive the accuracy
      field

Change-Id: I2535a5a9315ac3d343dcdf6010d3ae74288dfcd4
2018-10-10 15:31:59 -07:00
Brian Stack
085f505014 Extract SensorsHidlTestBase and reformat
Bug: 111070257
Test: Builds
Change-Id: I35956b9dab56e97d716aa6605dab328cdd5446d3
2018-10-09 11:44:10 -07:00
Brian Stack
0c102a998f Refactor SensorsTestSharedMemory
Extracts SensorsTestSharedMemory so that it can be used by other
versions of the sensors tests.

Bug: 111070257
Test: Build
Change-Id: I03df7462302d4ab0ea647e0d7688a46bf0e06dc1
2018-10-09 11:43:24 -07:00
TreeHugger Robot
18f3701543 Merge changes I1d41c6ed,I1e04e734,I4c2a968a
* changes:
  Refactor SensorEventsChecker
  Create SensorsHidlEnvironmentBase
  Extract SensorsHidlEnvironment
2018-10-09 17:40:43 +00:00
TreeHugger Robot
d126a2fb42 Merge "Move GrallocWrapper to common directory" 2018-10-08 17:27:35 +00:00
Brian Stack
a60a6ae08f Refactor SensorEventsChecker
Move SensorEventsChecker and derived classes into their own file.

Bug: 111070257
Test: Builds and passes VtsHalSensorsV1_0Target tests
Change-Id: I1d41c6edd71e6970ee0599ae21667c88dd5f1c4e
2018-10-05 10:03:43 -07:00
Brian Stack
bc5a39bd24 Create SensorsHidlEnvironmentBase
Move common parts of SensorsHidlEnvironment into a base class so they
can be reused with other versions of sensors tests.

Bug: 111070257
Test: Builds
Change-Id: I1e04e734d00308adff35b9c16de1499573a84b03
2018-10-05 10:03:43 -07:00
Brian Stack
f0dbf813b2 Extract SensorsHidlEnvironment
Extract SensorsHidlEnvironment from VtsHalSensorsV1_0TargetTest to
allow it to be used with multiple versions of testing

Bug: 111070257
Test: Builds and passes VtsHalSensorsV1_0Target tests
Change-Id: I4c2a968a7817d2a9783c358abe4066574add4e72
2018-10-05 10:03:43 -07:00
Brian Stack
eb755f55bb Move GrallocWrapper to common directory
Moves GrallocWrapper to a common directory so that it is able to be
used by different versions of Sensors HAL VTS testing.

Bug: 111070257
Test: Builds
Change-Id: I3b110a8b45a870d762c9ed09063115afa31e6ce3
2018-10-05 10:03:32 -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
Brian Duddie
70c148b739 Update sensors OWNERS files
Reflect changes in team membership.

Fixes: 74439746
Test: n/a
Change-Id: I936b9dd9229024989bc6100a4fe396e822d53369
2018-08-09 19:56:18 +00:00
Peng Xu
f183230f46 Merge "Ignore meta sensor events when checking values" into oreo-vts-dev am: d09fdd6ca1 am: bfc5b817e7
am: 5b2f3f3c7c

Change-Id: Ic1d04b1a252274715b4f9a7168ffaf141e305c5b
2018-04-10 14:41:34 -07:00
Peng Xu
bfc5b817e7 Merge "Ignore meta sensor events when checking values" into oreo-vts-dev
am: d09fdd6ca1

Change-Id: I4623dce53e1cc5102d943c21944820c108466157
2018-04-10 14:21:57 -07:00
Peng Xu
23c91a2b54 Ignore meta sensor events when checking values
Bug: 68729931
Test: verified by vendor, see b/68729931#comment5
Change-Id: I0f729c33409e409f0a64d9d4f609215cffde71f5
2018-03-21 17:58:41 -07:00
Zhuoyao Zhang
b6371e782d Merge "Convert sensors HAL test to use VtsHalHidlTargetTestEnvBase" am: edf1e2f589 am: a4b6a6da27
am: 2ec4182501

Change-Id: I339d8312c2321a56e263d8b9a6836639762c58ad
2018-01-24 23:00:08 +00:00
Zhuoyao Zhang
733ee1654e Convert sensors HAL test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181
Test: make vts
      vts-tradefed run vts -m VtsHalSensorsV1_0Target

Change-Id: I1f7e3a8adf58bbeeb0928185a61f16610dd76223
2018-01-24 09:35:55 -08:00
Peng Xu
c9c4ba222b Skip direct report test if sensor is not available
Skip SensorsHidlTest.*AshmemDirectReportOperation* tests if sensor
is not available on device.

Bug: 64230704
Test: compiles and test pass for a pixel device with mag sensor
      masked in hal.

Merged-In: I9bfbea6301891eaa2b272bd3d15b0e237799b5d6
Change-Id: I9bfbea6301891eaa2b272bd3d15b0e237799b5d6
(cherry picked from commit 31e5bf8d93)
2018-01-23 22:21:04 +00:00
Steven Moreland
e5c6548346 Remove subdirs
Removing whenever I see these in code reviews.

Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
2017-11-28 14:23:43 -08:00
Steven Moreland
fcca4e23b7 Remove subdirs
Removing whenever I see these in code reviews.

Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
2017-11-28 14:22:43 -08:00
Xin Li
bb9e38fef9 Merge commit '1a06284b24f5eb7bb9c1fea0817da8898b3b1bff' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: I2a044eb8c9981d0a8198ffe2df55559afbd76341
Merged-In: I4fb9f18884f7ef21162015a0032c4431444f7025
2017-11-14 12:08:38 -08:00