Commit graph

506 commits

Author SHA1 Message Date
Denis Ciocca
d3c27ec3f7 Include VtsHalSensorsV2_0TargetTest into the vts test suites
Without adding the test into vts test suite the testcases are not
available within the vts-tradefed.

Test: manual - build vts using 'make vts' with arm64 target selected,
               verifying that the test is then available under:
               out/host/linux-x86/vts/android-vts/testcases/VtsHalSensorsV2_0TargetTest

Signed-off-by: Denis Ciocca <denis.ciocca@gmail.com>
Change-Id: I34a89bef09832e5fa8295340f52dafd91fa33c96
Merged-In: I562b4dc50765e953800a814a8fd84a01c1b9352b
2020-04-23 10:24:43 -07:00
TreeHugger Robot
c57ee9e0a5 Merge "Add the missing unregisterCallback call" into rvc-dev am: eac1cdbba9
Change-Id: Ib273274fbd4e400ce14450da445e62487413f2c2
2020-04-15 19:22:12 +00:00
Roman Kiryanov
226761ce9d Add the missing unregisterCallback call
The sensor reading thread continues producing
event and refers to the already destroyed
callback object which causes a crash in
SensorsHidlEnvironmentBase::addEvent.

Bug: 153754380
Test: atest VtsHalSensorsV2_0TargetTest
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I3017afe670e5a53d0d7444b3d5b34ba34f3567e3
Merged-In: Id7fb72c42dc67f89ceef93d937241e1584b853e7
2020-04-15 12:12:46 -07:00
Roman Kiryanov
279a5ae37e Add the missing unregisterCallback call
The sensor reading thread continues producing
event and refers to the already destroyed
callback object which causes a crash in
SensorsHidlEnvironmentBase::addEvent.

Bug: 153754380
Test: atest VtsHalSensorsV2_0TargetTest
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: Id7fb72c42dc67f89ceef93d937241e1584b853e7
2020-04-15 10:34:11 -07:00
TreeHugger Robot
14725a36aa Merge "Don't modify -1 sensorHandle value" into rvc-dev am: 2adce34722
Change-Id: I7c346a31648c7f9d3aabd0d4a4c54ef174d84986
2020-04-09 17:39:12 +00:00
TreeHugger Robot
2adce34722 Merge "Don't modify -1 sensorHandle value" into rvc-dev 2020-04-09 17:14:38 +00:00
Anthony Stange
cd4d9abdcc Don't modify -1 sensorHandle value
A -1 sensorHandle value is used to denote all active sensors should be
stopped for a given channel. Make sure the multi-HAL code doesn't modify
handles of this value or it'll corrupt them before passing to the direct
channel sub-HAL.

Bug: 153413565
Test: atest VtsHalSensorsV2_0Target
Change-Id: I3fe9cbf4661aa3db4ff534765d5112a193b7bf4a
2020-04-09 11:07:56 -04:00
TreeHugger Robot
db79614a58 Merge "Adds context_hub group to sensors HAL" into rvc-dev am: ee01c9ec22
Change-Id: I4bc3a5aefe6eb65aca35ea62ed17fa7042f2b0ee
2020-04-09 12:10:21 +00:00
TreeHugger Robot
ee01c9ec22 Merge "Adds context_hub group to sensors HAL" into rvc-dev 2020-04-09 11:55:15 +00:00
Dan Shi
aad51fa000 Rename vts-core to vts
Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL update suite name vts-core to vts as
the suite name is updated. This CL won't change test logic or behavior.

Change-Id: I562b4dc50765e953800a814a8fd84a01c1b9352b
Merged-In: I562b4dc50765e953800a814a8fd84a01c1b9352b
2020-04-07 16:37:40 -07:00
Rick Chen
cdc9be8c7d Adds context_hub group to sensors HAL
Bug: 152005392
Bug: 152727489
Test: Compile pass. Verify sensor function.
Signed-off-by: Rick Chen <rickctchen@google.com>
Change-Id: Ifd7b9239a732619307bbb2e99d37791915fe7dc1
2020-04-07 22:51:13 +08:00
Anthony Stange
f1d431f634 Add SubHal header for Sensors HAL 2.1
Bug: 149758467
Test: compile
Change-Id: Id10d20e5d24571572565ac5d968f265ef7d7070f
2020-03-19 18:11:28 -04:00
TreeHugger Robot
d6f4acf514 Merge "Move Multi-HAL 2.0 to the common directory" into rvc-dev 2020-03-05 07:02:59 +00:00
TreeHugger Robot
0dad3a6381 Merge "HalProxy unit test to expose incorrect numEventsOnPendingQueue" into rvc-dev 2020-03-04 21:47:07 +00:00
TreeHugger Robot
89fe74560d Merge "Build HalProxy unit tests with a test library ScopedWakelock" into rvc-dev 2020-03-04 21:43:00 +00:00
Anthony Stange
05d7496e4c Move Multi-HAL 2.0 to the common directory
Sensors Multi-HAL 2.0 will soon have a shared implementation for both
Sensors HAL 2.0 and 2.1 and moving the files to the common directory
first will minimize the diff in upcoming CLs.

Bug: 149758467
Test: compile
Change-Id: I15f84a7aaa302d83d4f4b1ffe357f515e36d6382
2020-03-04 15:09:58 -05:00
Stan Rokita
14499028cf HalProxy unit test to expose incorrect numEventsOnPendingQueue
Bug: 147912609
Test: run unit test
Merged-In: Ia6fe3cafc1c2adb02463c28481bcf4c723551860
Change-Id: Ia6fe3cafc1c2adb02463c28481bcf4c723551860
2020-03-04 14:56:07 -05:00
Stan Rokita
d5d021b380 Build HalProxy unit tests with a test library ScopedWakelock
Unit tests do not currently build because they cannot find the
ScopedWakelock shared object. Make a test library version of
ScopedWakelock for them.

Bug: 147912609
Test: Build and run atest android.hardware.sensors@2.0-halproxy-unit-tests
Merged-In: Ie8d3eb606ccba3825be2c8102b9a7bc6ea033f65
Change-Id: Ie8d3eb606ccba3825be2c8102b9a7bc6ea033f65
2020-03-04 14:55:59 -05:00
Anthony Stange
e969e81bee Fix Sensors HAL 1.0 VTS tests
HAL 1.0 VTS tests need to detach the polling thread or it will never
exit on its own. Additionally, the poll() methods return status needs to
be checked or HIDL will assert and cause the program to crash.

Bug: 150475314
Test: atest VtsHalSensorsV1_0TargetTest VtsHalSensorsV2_0TargetTest
Change-Id: I626b7aa064a1f258c968d1787872b9c67786dede
2020-03-04 18:44:06 +00:00
Anthony Stange
72992c7bea Merge "Move common tests into SensorsV2_0 VTS only" into rvc-dev 2020-03-02 22:45:29 +00:00
Anthony Stange
e49ee681b0 Move common tests into SensorsV2_0 VTS only
Since Sensors HAL 2.1 implementations need to run VTS for both HAL 2.0
and 2.1, move tests that don't differ in logic between the two HAL
implementations to the VTS for 2.0 only to minimize the total run time
for both suites.

Bug: 149927057
Test: atest VtsHalSensorsV2_0Target VtsHalSensorsV2_1Target
Change-Id: I5213cdf05bafb2d4014078a03b22d98b96b7c5ee
2020-03-02 15:25:12 -05:00
Automerger Merge Worker
e1d8fbe4fd Merge "HalProxy unit test to expose incorrect numEventsOnPendingQueue" am: 4ce37f131d
Change-Id: I88f427ba574f7e2349dc20d979ba698b00edc438
2020-02-27 20:53:20 +00:00
Automerger Merge Worker
3e2dc4396a Merge "Build HalProxy unit tests with a test library ScopedWakelock" am: 43e05713c5
Change-Id: I3bb1cc38cc9761b3b0c9f31e3f817b5347c834b6
2020-02-27 20:53:12 +00:00
Stan Rokita
2f4ac1599a HalProxy unit test to expose incorrect numEventsOnPendingQueue
Bug: 147912609
Test: run unit test
Change-Id: Ia6fe3cafc1c2adb02463c28481bcf4c723551860
2020-02-26 15:19:17 -08:00
Stan Rokita
8c51fca223 Build HalProxy unit tests with a test library ScopedWakelock
Unit tests do not currently build because they cannot find the
ScopedWakelock shared object. Make a test library version of
ScopedWakelock for them.

Test: Build and run atest android.hardware.sensors@2.0-halproxy-unit-tests
Change-Id: Ie8d3eb606ccba3825be2c8102b9a7bc6ea033f65
2020-02-26 10:42:14 -08:00
Arthur Ishiguro
85c4ad2351 Starts default Context Hub HAL in context_hub group
Also adds group to default sensors HAL.

Bug: 149981913
Test: Compile
Change-Id: Ib9178dd9ad0a92821cfebe82f09e8819b42a42f7
2020-02-25 18:01:37 -08:00
Anthony Stange
aef69c9538 Create separate VTS target for Sensors HAL 2.1
Dependencies don't use cflags set by code that depends on them so the
VTS test for HAL 2.1 wasn't properly pulling the 2.1 interface when
present on the device (it was using the 2.0 interface). Modify the
Android.bp files to define the right flags depending on whether we're
testing HAL 2.0 or 2.1.

Bug: 149759782
Test: atest VtsHalSensorsV2_0TargetTest VtsHalSensorsV2_1TargetTest
Change-Id: I3533b6c244e767a8defe0a44a14025fdeb8eeeba
2020-02-19 12:47:50 -05:00
Anthony Stange
32895908b9 Prep ISensorsWrapper to be used by the framework
Bug: 144139857
Test: Load sensors framework and verify it can receive data
Change-Id: I08bdb23779a1ec716cd99e3bc9ded4371fe9c89a
2020-02-18 17:45:04 -05:00
Anthony Stange
a9a5eb411e Add VTS tests for Sensors HAL 2.1
Bug: 144139857
Test: atest VtsHalSensorsV2_0TargetTest VtsHalSensorsV2_1TargetTest
Change-Id: If2b751929b8d89c9d381032f5e8424a24719b6bd
2020-02-18 17:45:02 -05:00
Anthony Stange
535c63e672 Add Hinge Angle Sensor to default impl for HAL 2.1
Bug: 144139857
Test: Verify this type is exposed when VTS is run
Change-Id: I994f1b4c77729b76760b7cafc19b825c98ca97ca
2020-02-18 15:24:38 -05:00
Anthony Stange
1d71acc129 Add default impl of Sensors HAL 2.1
Create a default implementation of HAL 2.1 that shares 90% of the
underlying code with HAL 2.0 since the interfaces are very similar.

Bug: 144139857
Test: compile
Change-Id: Ic6b139df98ddb1f92833b1f2d65e1cecc297fd41
2020-02-18 15:24:35 -05:00
Anthony Stange
c002dd9eca Create wrapper for 2.0/2.1 sensor HALs
Creates a wrapper that makes a 2.0 sensor HAL appear to look like a 2.1
sensor HAL so that various pieces of code can be shared between the two
implementations.

Bug: 144139857
Test: Run VTS
Change-Id: I4ee4fd2b900e5d4ca744f420f69e150ba38f7949
2020-02-18 13:34:56 -05:00
Anthony Stange
d8cafdbdfd Add Sensors HAL 2.1
Creates Sensors HAL 2.1 to support the addition of a new sensor type for
hinge angle sensors.

Bug: 144139857
Test: mma
Change-Id: Id78fb16324d28f2291b3ad1950197bfd2632d6f4
2020-02-18 13:34:56 -05:00
Automerger Merge Worker
f20dd169e2 Merge "Fix formatting errors in sensors MH2 bp files" am: 30fc7d4ba3 am: 59c1adabc7 am: 217167bf87
Change-Id: I55b5eebb64c27f3559de3badf139f0efdf35e458
2020-02-05 01:08:52 +00:00
Automerger Merge Worker
59c1adabc7 Merge "Fix formatting errors in sensors MH2 bp files" am: 30fc7d4ba3
Change-Id: Idc0c3ec90157f917bca3f1ed5750dde690b0d210
2020-02-05 00:38:34 +00:00
Automerger Merge Worker
14edbe86dd Merge "Remove reference of VtsHalHidlTargetTestBase" am: badb75e309 am: 88b5b44f89 am: 4eaa7205f8
Change-Id: Ie3eb4abb16005f5a8d137ce800dcc8e21e32b5e8
2020-02-05 00:23:34 +00:00
Treehugger Robot
30fc7d4ba3 Merge "Fix formatting errors in sensors MH2 bp files" 2020-02-05 00:23:26 +00:00
Stan Rokita
4820138e21 Fix formatting errors in sensors MH2 bp files
Test: build

Change-Id: Idb00ed68c9805a055bf87560f02605920c4149e5
2020-02-04 16:01:44 -08:00
Automerger Merge Worker
88b5b44f89 Merge "Remove reference of VtsHalHidlTargetTestBase" am: badb75e309
Change-Id: Ia1b74f69ff92f57117e5e9510896b6c4b6730548
2020-02-04 23:54:32 +00:00
Dan Shi
badb75e309 Merge "Remove reference of VtsHalHidlTargetTestBase" 2020-02-04 23:44:04 +00:00
Dan Shi
9910d38aa7 Remove reference of VtsHalHidlTargetTestBase
Bug: 147894326
Test: m -j VtsHalWifiHostapdV1_0TargetTestUtil \
  VtsHalSensorsTargetTestUtils
Change-Id: If11f23db93333ddd702ce5ebf7c5c0b9583c57fa
2020-02-04 03:29:50 +00:00
Automerger Merge Worker
11b3d6ecdf Merge "[Sensors MH2] Keep track of most events seen on pending queue" am: b2e4c01a76 am: ec3f43a767 am: dd2b347ca0
Change-Id: I48beab8e0bb822cc7e97328bd36a76b9d676803c
2020-02-04 00:01:30 +00:00
Automerger Merge Worker
ec3f43a767 Merge "[Sensors MH2] Keep track of most events seen on pending queue" am: b2e4c01a76
Change-Id: I9f5e18c4538d7aea4f6d2f0af0b9a1df67d4df7d
2020-02-03 23:40:07 +00:00
Stan Rokita
e7f293621e [Sensors MH2] Keep track of most events seen on pending queue
Bug: 148243746
Test: Load onto device and run
'adb shell lshal debug android.hardware.sensors@2.0::ISensors/default'
to observe correct output

Change-Id: I8f7d87e86860bbca229051fec35b7048c4b3268b
2020-02-03 13:41:56 -08:00
Automerger Merge Worker
c56cf74d72 Merge "Fix the format specifier in assert log statements" am: ddc10d848a am: 1ffb992d29 am: 7ab599b97c
Change-Id: I2dff3d4a75f8f8f7c6f5ba3074f9324cd6307a3d
2020-01-25 01:15:04 +00:00
Stan Rokita
1ffb992d29 Merge "Fix the format specifier in assert log statements"
am: ddc10d848a

Change-Id: I79f81bbd4c0b4ff22496a0ade4e6cec155965a6a
2020-01-24 16:48:50 -08:00
Treehugger Robot
ddc10d848a Merge "Fix the format specifier in assert log statements" 2020-01-24 23:21:11 +00:00
Stan Rokita
010c36d22d Fix the format specifier in assert log statements
There are two ALOG_ASSERT calls in the HalProxyCallback::postEvents
method that do not have the correct format specifier types. This causes
a build error if you try to build with debug logs.

Test: Build and load onto device
Change-Id: I793b6fcd72dd13b07422af0e292a373a66b2c200
2020-01-21 15:38:36 -08:00
Automerger Merge Worker
e91b85631f Merge "Decrement size of pending write queue by correct amount" am: 79fc8d0212 am: b492ac69b5 am: 0cf13f7ded
Change-Id: I555d97575c9f4780bc4edcd46ba4cad0b2ff64ef
2020-01-17 21:38:00 +00:00
Anthony Stange
b492ac69b5 Merge "Decrement size of pending write queue by correct amount"
am: 79fc8d0212

Change-Id: I4d8f3d5bac10dd7192788cccf47ddcfa6231d7c8
2020-01-17 12:55:11 -08:00
Stan Rokita
bc0b20ad1f Decrement size of pending write queue by correct amount
The pending write events vector is destructed before using its size to
decrement the number of events on the pending write events queue which
may cause the value decrement by 0 instead of the actual number of
events removed.

Bug: 147686560
Test: Build and load onto device with fake subhals
Change-Id: I7b6c6231eacfa89b0dd55bc405b235d34be5ff46
2020-01-15 08:29:17 -08:00
Automerger Merge Worker
467d0220e4 Merge "Convert VtsHalSensorsV*_0TargetTest to be parameterized." am: c81f9c9958 am: 6887dc320d am: 6d3e344091
Change-Id: Icbdcf15a369e4263e622c08c8427ac100c6e1c0c
2019-12-11 00:44:35 +00:00
Automerger Merge Worker
6d3e344091 Merge "Convert VtsHalSensorsV*_0TargetTest to be parameterized." am: c81f9c9958 am: 6887dc320d
Change-Id: I5b2714ffdb54d43634a0a2b361a239d26d26656b
2019-12-11 00:29:56 +00:00
Dan Shi
395288173d Convert VtsHalSensorsV*_0TargetTest to be parameterized.
Bug: 142397658
Test: atest VtsHalSensorsV1_0TargetTest VtsHalSensorsV2_0TargetTest
Change-Id: I76bf0b68abf8c8a1c79afabbc26242e33778bd25
2019-12-09 10:10:44 -08:00
Stan Rokita
655675db00 Make ScopedWakelock a shared library am: 1d53f9563b am: 1e9bac4b58
am: b0af4f5a25

Change-Id: I641b4d611e8b9637f07fda2592d3d078dc82a677
2019-11-25 14:37:40 -08:00
Stan Rokita
b0af4f5a25 Make ScopedWakelock a shared library am: 1d53f9563b
am: 1e9bac4b58

Change-Id: I68ece185c348668aa5da86e6b3802f5db167af0d
2019-11-25 14:34:48 -08:00
Stan Rokita
1d53f9563b Make ScopedWakelock a shared library
Change the build configuration of multihal and its tests to make the
ScopedWakelock.cpp file and its associated headers available as a
library to be included by the fake subhals and the multihal binary
seperately.

Bug: 144722764
Test: Compiled and loaded onto device without issue
Change-Id: Ide83b6761302c5df6c72bc3202727341361b36ed
2019-11-25 12:36:10 -08:00
Stan Rokita
dda3a5c7c4 Merge "Change instance name to default in multihal 2 xml" am: 724b7471e0 am: c3f2745aae
am: eba6d2429a

Change-Id: Ifbbabaee01f39c79f395408c2d29764541ce8e46
2019-11-19 08:30:03 -08:00
Stan Rokita
eba6d2429a Merge "Change instance name to default in multihal 2 xml" am: 724b7471e0
am: c3f2745aae

Change-Id: I2553def9c40ab1494be28b2659685f86a3601ceb
2019-11-19 08:25:58 -08:00
Treehugger Robot
724b7471e0 Merge "Change instance name to default in multihal 2 xml" 2019-11-19 16:15:08 +00:00
Stan Rokita
a1ed22e34f Change instance name to default in multihal 2 xml
Bug: 144722764
Test: N/A
Change-Id: Ic6b4a4f5ccb8df11ac8ed819fd750841373bc11f
2019-11-18 15:09:00 -08:00
Nick Desaulniers
6f4a232928 hardware: interfaces: sensors: fix -Wreorder-init-list
C++20 is stricter about member ordering in designated initializers than
C99.

Bug: 139945549
Test: mm
Change-Id: I22179dfb829c328462c9b31caf543692d3cf57d9
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-12 13:48:58 -08:00
Nick Desaulniers
69871db874 Merge changes I8a7ff4b0,Id121ecd4,I23375d73 am: 944e640e16
am: d770f4c628

Change-Id: Ie2a0a0dad8d32f7eb2a07784bd0f60bf666b61a1
2019-11-06 09:58:31 -08:00
Nick Desaulniers
8cb3c9b326 [hardware][interfaces][sensors] fix -Wreorder-init-list
C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: mm
Merged-In: I78d64ea2b7df3f2bd3b8503aa553a0523b20d711
Change-Id: I8a7ff4b025ac693398b79ad5f16687afe3a4c5a9
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-05 14:58:13 -08:00
Nick Desaulniers
890faa2ac5 [hardware][interfaces][sensors] fix -Wreorder-init-list again
C++20 will require members in a designated initializer to be in order
unlike C99.

This snuck in because I haven't upgraded the platform toolchain yet.

Bug: 139945549
Test: mm
Change-Id: Id121ecd46b7e53f5dd7b4a32daae0594d851d0e5
Merged-in: Ica2844a213467e41d9b6a8955f1750692da8b444
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-05 14:55:47 -08:00
TreeHugger Robot
7ac81273de Merge "[hardware][interfaces][sensors] fix -Wreorder-init-list again" 2019-11-05 22:14:27 +00:00
Stan Rokita
57ed4c98c3 Merge "Bound pending write events queue to avoid OOM" am: 6cbd36f357 am: 797b06e220
am: ac564f2899

Change-Id: I09b08508fd3cf53381d524613dad63621eb63595
2019-11-05 11:11:16 -08:00
Stan Rokita
ac564f2899 Merge "Bound pending write events queue to avoid OOM" am: 6cbd36f357
am: 797b06e220

Change-Id: Ie8121004cc113714e4a9ad6085a551f832fc847a
2019-11-05 01:35:34 -08:00
Stan Rokita
5098f0a9ca Bound pending write events queue to avoid OOM
Bound the pending write events queue to a large amount of events in
total (100,000) so that we do not have out of memory crashes when the
sensors framework locks up. Events are 80B of memory each. So this
change caps are pending writes event queue to 8MB of memory.

Bug: 143302327
Test: atest android.hardware.sensors@2.0-halproxy-unit-tests &&
vts-tradefed run commandAndExit vts --skip-all-system-status-check
--primary-abi-only --skip-preconditions --module VtsHalSensorsV2_0Target

Change-Id: I5d0a7f382e3f61fbbe2c74b5c9cf13560432b84c
2019-11-04 14:33:06 -08:00
Nick Desaulniers
65d03e4d8f [hardware][interfaces][sensors] fix -Wreorder-init-list again
C++20 will require members in a designated initializer to be in order
unlike C99.

This snuck in because I haven't upgraded the platform toolchain yet.

Bug: 139945549
Test: mm
Change-Id: Ica2844a213467e41d9b6a8955f1750692da8b444
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-04 12:55:30 -08:00
Stan Rokita
e210b0b012 Merge "Add Sensors Multihal support for Hal 2.0" am: 2f27f7137e am: 2d399b5af0
am: 4950a9dc21

Change-Id: I87376735901a4477d901ef87bcecc3b6146f12b4
2019-10-31 09:15:20 -07:00
Stan Rokita
4950a9dc21 Merge "Add Sensors Multihal support for Hal 2.0" am: 2f27f7137e
am: 2d399b5af0

Change-Id: Iad679b84b91e62c03d8466a98fdff11163317578
2019-10-31 09:09:04 -07:00
Treehugger Robot
2f27f7137e Merge "Add Sensors Multihal support for Hal 2.0" 2019-10-31 15:32:44 +00:00
Stan Rokita
94e44b5764 Revert sensors multihal 2.0 changes temporarily.
Revert the changes that added multihal support to sensors HAL 2.0 while
waiting for merge from the same changes added to AOSP.

07b442e96 (refs/published/mh2_2) MH2 | Write processedEvents instead of
original events.
b38f2e251 Merge "MH2 | Check that subhal index is in range"
d38f99474 Merge "MH2 | Implement debug method of HalProxy"
bf46132fe (refs/published/mh2_4, mh2_4) MH2 | Implement debug method of
HalProxy
1de5bb334 MH2 | Fix wakelock name
e07215347 (refs/published/mh2_3, mh2_3) MH2 | Check that subhal index is
in range
336c1c71e MH2 | Add restart logic in HalProxy::initialize method.
731d7125b MH2 | Change rc file to more appropriate settings
f09465d11 MH2 | Add makeFMQ helpers to HalProxy_test
75cc7bf2f MH2 | Implement wakelock processing thread
e93fdf9a4 MH2 | Implement dynamic sensors callbacks on HalProxy
82b84148c Remove libhwbinder/libhidltransport deps
d45e49b4b Merge "MH2 | Implement pending writes thread"
597142692 MH2 | Implement pending writes thread
db23aa825 MH2 | Implement direct channel and direct report methods
83e4370ae MH2 | Implement injectSensorData method of HalProxy
d0cd57d4c MH2 | Implement ScopeWakelock ctor and dtor
537c0274b MH2 | Add rough proxy callback postEvents method
f97a3f357 Multihal 2.0 - Small tweaks to sensorHandle handling
7a7235461 MultiHal 2.0 - setOperationMode and init direct channel flags
dc7a8e789 MultiHal 2.0 - Get sensors list from subhals
4b4c7b744 MultiHal 2.0 - activate, batch, flush methods of HalProxy
1638531df MultiHal 2.0 - proxying api calls helper methods
aacbf9485 Set up shell to use for unit tests
2879067dd Multihal 2.0 - Implement SubHal discovery
c34e6683b Add a sub-HAL implementation for testing multi-HAL
a689f8a65 Add skeleton for multihal 2.0

Bug: 136511617
Test: N/A
Change-Id: Ic3588f42cf60aee6ca915be19b834462aeb7a95c
2019-10-29 13:59:50 -07:00
Stan Rokita
2e37ec4475 Add Sensors Multihal support for Hal 2.0
The multihal framework is a HAL interface for the sensors framework that
allows multiple vendors to package their HAL implementation into a
subHAL dynamic library that will be loaded and used to pass on method
calls to the appropriate subHAL. The HalProxy object, that will act as
the main proxy sensors wrapper for the multiHAL handles writing sensor
events to the event FMQ and wakelock acquisition and releasing via a
callback object it passes to the subHALs.

In order to turn your HAL 2.0 executable into a subHAL to be used by the
multiHAL, implement the Return<Result> initialize(sp<HalProxyCallback>&
callback) method of the ISensorsSubHal derived class. Implement the
ISensorsSubHal* sensorsHalGetSubHal(uint32_t* version)method and have it
return a pointer to your subHAL object. Build this into a dynamic
library and list its filename under /vendor/etc/sensors/hals.conf.

Squashed commits:

07b442e96 (refs/published/mh2_2) MH2 | Write processedEvents instead of
original events.
b38f2e251 Merge "MH2 | Check that subhal index is in range"
d38f99474 Merge "MH2 | Implement debug method of HalProxy"
bf46132fe (refs/published/mh2_4, mh2_4) MH2 | Implement debug method of
HalProxy
1de5bb334 MH2 | Fix wakelock name
e07215347 (refs/published/mh2_3, mh2_3) MH2 | Check that subhal index is
in range
336c1c71e MH2 | Add restart logic in HalProxy::initialize method.
731d7125b MH2 | Change rc file to more appropriate settings
f09465d11 MH2 | Add makeFMQ helpers to HalProxy_test
75cc7bf2f MH2 | Implement wakelock processing thread
e93fdf9a4 MH2 | Implement dynamic sensors callbacks on HalProxy
82b84148c Remove libhwbinder/libhidltransport deps
d45e49b4b Merge "MH2 | Implement pending writes thread"
597142692 MH2 | Implement pending writes thread
db23aa825 MH2 | Implement direct channel and direct report methods
83e4370ae MH2 | Implement injectSensorData method of HalProxy
d0cd57d4c MH2 | Implement ScopeWakelock ctor and dtor
537c0274b MH2 | Add rough proxy callback postEvents method
f97a3f357 Multihal 2.0 - Small tweaks to sensorHandle handling
7a7235461 MultiHal 2.0 - setOperationMode and init direct channel flags
dc7a8e789 MultiHal 2.0 - Get sensors list from subhals
4b4c7b744 MultiHal 2.0 - activate, batch, flush methods of HalProxy
1638531df MultiHal 2.0 - proxying api calls helper methods
aacbf9485 Set up shell to use for unit tests
2879067dd Multihal 2.0 - Implement SubHal discovery
c34e6683b Add a sub-HAL implementation for testing multi-HAL
a689f8a65 Add skeleton for multihal 2.0

Bug: 136511617
Test: atest android.hardware.sensors@2.0-halproxy-unit-tests &&
vts-tradefed run commandAndExit vts --skip-all-system-status-check
--primary-abi-only --skip-preconditions --module VtsHalSensorsV2_0Target

Change-Id: Ibe92d40c92b70848526b0e941bbcffbaf81ffaf2
2019-10-29 11:08:38 -07:00
Stan Rokita
07b442e96c MH2 | Write processedEvents instead of original events.
Fix bug where the HalProxyCallback::postEvents method was passing the
unaltered events vector to HalProxy::postEventsToMessageQueue instead of
the processedEvents with altered sensorHandles. Add a unit test to test
that the proper sensorHandles are seen compared to the event posted from
subhal.

Additionally, fix problems with fake subhals and their dummy sensors
that allows VTS tests to pass all tests.

Bug: 136511617
Test: New unit tests pass and VTS tests under module
VtsHalSensorsV2_0Target passing.
Change-Id: If30da03a2399666700844523cd1104b07f6b65d2
2019-10-24 13:31:19 -07:00
TreeHugger Robot
b38f2e2513 Merge "MH2 | Check that subhal index is in range" 2019-10-21 20:06:21 +00:00
TreeHugger Robot
d38f994742 Merge "MH2 | Implement debug method of HalProxy" 2019-10-19 00:06:01 +00:00
Stan Rokita
bf46132fe5 MH2 | Implement debug method of HalProxy
Bug: 9569382
Test: Observed debug output from
$ adb shell lshal debug android.hardware.sensors@2.0::ISensors/default
Change-Id: I9f2627a05d37bd8407a22e263b7557834a9677b8
2019-10-18 14:50:36 -07:00
Stan Rokita
1de5bb334c MH2 | Fix wakelock name
Name is supposed to be "SensorsHAL_WAKEUP".

Bug: 142505817
Test: N/A
Change-Id: I79f01509bffba499678fa519d038db37e2a9efbd
2019-10-18 14:23:16 -07:00
Stan Rokita
e072153474 MH2 | Check that subhal index is in range
For each HalProxy method that takes in a sensorHandle, the code now
checks that the subhal index byte (first byte) of the handle is the
range of subhals in list before indexing into mSubHalList so that are
crash does not occur and returns Result::BAD_VALUE if that is the case.
Add unit tests to assert that error is returned. Also change the methods
that accept sensorHandles to int32_t type since that is the actual type
defined in the HAL spec.

Bug: 136511617
Test: Passing new unit tests.

Change-Id: I5489e999bc5eaef1a21698bdbc0a0341bc88194c
2019-10-18 12:12:47 -07:00
TreeHugger Robot
e53b23b6ad Merge "MH2 | Add restart logic in HalProxy::initialize method." 2019-10-17 23:42:24 +00:00
Stan Rokita
336c1c71e2 MH2 | Add restart logic in HalProxy::initialize method.
Bug: 136511617
Test: None yet

Change-Id: I389a7243d3612586aae4e8a802afda92af8dcc6d
2019-10-17 14:59:47 -07:00
Nick Desaulniers
0e2911ebe0 [hardware][interfaces][sensors] fix -Wreorder-init-list
C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: mm
Change-Id: I78d64ea2b7df3f2bd3b8503aa553a0523b20d711
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-10-17 11:15:36 -07:00
Stan Rokita
731d7125bf MH2 | Change rc file to more appropriate settings
Bug: 136511617
Test: N/A
Change-Id: I23db5a299e5419156c3cb59fad9ea086ac2f393d
2019-10-16 09:39:50 -07:00
Stan Rokita
f09465d111 MH2 | Add makeFMQ helpers to HalProxy_test
Bug: 136511617
Test: Ran the tests with success.
Change-Id: Ide35e39529193696f3fb8d5898e9a3daf15b1630
2019-10-16 09:39:50 -07:00
Stan Rokita
75cc7bf2fe MH2 | Implement wakelock processing thread
Bug: 136511617
Test: Unit tests cannot be written for this change. Integration testing
will be performed later.

Change-Id: I651b5fde77c6017b3270413de896a947d95ff5f8
2019-10-16 09:39:47 -07:00
Stan Rokita
801ff068ff Merge "MH2 | Implement dynamic sensors callbacks on HalProxy" 2019-10-11 23:18:41 +00:00
Stan Rokita
e93fdf9a4a MH2 | Implement dynamic sensors callbacks on HalProxy
Additionally, have HalProxyCallback::processEvents use
HalProxy::setSubHalIndex static method instead of its own helper.
Add unit tests to test the dynamic sensor methods.

Bug: 136511617
Test: New unit tests are passing.
Change-Id: Ib903291a83df2fafa480082f9305c594bd325f79
2019-10-10 16:56:21 -07:00
Brian Duddie
e38c678515 Add sensors 1.0 default HAL to uhid group am: 82299438b5
am: f4a503a101

Change-Id: Ib04587185e36c4f7bc7820b2cd7c155b76443f7f
2019-10-08 13:07:04 -07:00
Brian Duddie
f4a503a101 Add sensors 1.0 default HAL to uhid group
am: 82299438b5

Change-Id: I4b9fbba3e85873763211b1bb36a2bf5d80fb39a1
2019-10-08 12:54:21 -07:00
Brian Duddie
82299438b5 Add sensors 1.0 default HAL to uhid group
Ensures it can access /dev/uinput in Android Q, sepolicy permitting.

Bug: 142105193
Test: confirm hall sensor works again on marlin
Change-Id: I585c32d4da4bdc0917068e4d81adeca43d257e56
2019-10-07 15:53:27 -07:00
Steven Moreland
82b84148c7 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I878a4d04e65ef13f3a0ebaf64177f673958d213c
2019-10-02 12:50:29 -07:00
Stan Rokita
d45e49b4b3 Merge "MH2 | Implement pending writes thread" 2019-09-26 15:15:19 +00:00
Stan Rokita
5971426925 MH2 | Implement pending writes thread
Spin up a background thread inside the hal proxy that is responsible for
writing events to the event fmq if a previous write failed on the normal
postEvents thread. Create several new unit tests that help test the new
functionality.

Bug: 136511617
Test: Unit tests passing.
Change-Id: Ic35c9736fc0402297ab50072c195f66c9feb887d
2019-09-25 16:40:53 -07:00
Stan Rokita
db23aa825b MH2 | Implement direct channel and direct report methods
Implement registerDirectChannel, unregisterDirectChannel, and
configDirectReport methods of HalProxy.

Bug: 136511617
Test: Compiles successfully. Simple enough change to ignore unit tests
for now.

Change-Id: I7e1e6a4da6ba2fc070836084210c83bd9b53aabe
2019-09-24 14:46:49 -07:00
Stan Rokita
83e4370aec MH2 | Implement injectSensorData method of HalProxy
Bug: 136511617
Test: Compiles. No unit tests needed right now for such simple change.
Change-Id: Iaaf74579c26393ef8854ae717f01bb7a451de496
2019-09-24 10:44:53 -07:00
Stan Rokita
d0cd57d4cb MH2 | Implement ScopeWakelock ctor and dtor
Put the ScopedWakelock class into its own header and its implementation
into its own cpp. Implement the refcounting of the wakelocks. However,
do not incorporate the wakelock handling into post events in halproxy
yet.

Bug: 136511617
Test: No new tests yet. Will add more in a later patchset once more
fleshed out and integrated with postEvents.
Change-Id: I0815c6a6659ec5933b799294956595b11e7bf1b3
2019-09-23 08:55:28 -07:00
Stan Rokita
537c0274b8 MH2 | Add rough proxy callback postEvents method
Add post events method to HalProxyCallback without fully implementing
the wakeup events handling and pending blocking writes. Also change
mSensorList of the halProxy to mSensors which is a map from sensorHandle
to sensorInfo so that getNumWakeupEvents method of callback can find
sensorinfo info from sensorhandle of event type. Instantiate
halproxycallback vector in HalProxy for each subhal in the ctor as well.
Add very simple test for the postEvents method of callback.

Bug: 136511617
Test: New unit test passes.
Change-Id: I39c861cff286f24992bfcfcaa6bb468b4544b0e0
2019-09-23 08:55:17 -07:00
Stan Rokita
f97a3f3579 Multihal 2.0 - Small tweaks to sensorHandle handling
Add the sensor handle to subhal index bitmask as a constant. Change the
name of zeroOutFirstByte method to clearSubHalIndex and use the constant
there. Also use the constant in initSensorsList method.

Bug: 136511617
Test: Tested compilation success.
Change-Id: I3983850827697ff77c484e7b8d33e7722a7fb52a
2019-09-13 10:04:44 -07:00