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
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
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>
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>
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>
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
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>
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
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
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
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
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>
Bug: 136511617
Test: Unit tests cannot be written for this change. Integration testing
will be performed later.
Change-Id: I651b5fde77c6017b3270413de896a947d95ff5f8
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
Ensures it can access /dev/uinput in Android Q, sepolicy permitting.
Bug: 142105193
Test: confirm hall sensor works again on marlin
Change-Id: I585c32d4da4bdc0917068e4d81adeca43d257e56
Since these were combined into libhidlbase.
Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I878a4d04e65ef13f3a0ebaf64177f673958d213c
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
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
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