If an assert fails while a callback is registered and some data
is delivered that attempts to invoke the callback, it'll cause a
segfault since the callback is allocated on a part of the stack
that's no longer valid.
Bug: 183362725
Change-Id: I3a1f8fbf15c24e344fde8e5b44bb93681ef47d38
Test: Run VTS
If an assert fails while a callback is registered and some data
is delivered that attempts to invoke the callback, it'll cause a
segfault since the callback is allocated on a part of the stack
that's no longer valid.
Bug: 183362725
Change-Id: I3a1f8fbf15c24e344fde8e5b44bb93681ef47d38
Test: Run VTS
For an object to be managed by std smart pointer, its base class should NOT be "RefBase". It is not only unnecessary but also risking the object being owned by android smart pointer as well, which may destroy the object two times.
This issue may be detected by the destructor of class RefBase, with the log complaint "RefBase: Explicit destruction,..."
Test: monkey test for one day and one night
Signed-off-by: Jintao Zhu <zhujtcsieee@gmail.com>
Change-Id: If7736770983e17f5a4125b19dfbd1745ee5a9589
The gyro sensor is simulated by CPU. The min delay was too short in
comparison with CPU time slice, which might result in CTS failure.
This commit increases the min delay so as to decrease the relative error
of time intervals.
Test: atest CtsSensorTestCases:android.hardware.cts.SingleSensorTests#testGyroscope_fastest
Bug: 177871363
Change-Id: I58bc08d30633250cacc5f7dddc6cd836c796475b
VTS ensures that 2.0 HALs don't expose the hinge angle sensor,
but the 2.1 HALs must run 2.0 VTS tests. This CL ensures that
we don't expose the hinge angle sensor on the 2.0 HAL, to avoid
failing those VTS tests.
Bug: 173135479
Test: run vts -a x86 -m VtsHalSensorsV2_0TargetTest
Change-Id: I944bfb0b01be0831e45cfd3d6ed7dab6770d1b80
(cherry picked from commit c8fd7b31e0)
VTS ensures that 2.0 HALs don't expose the hinge angle sensor,
but the 2.1 HALs must run 2.0 VTS tests. This CL ensures that
we don't expose the hinge angle sensor on the 2.0 HAL, to avoid
failing those VTS tests.
Bug: 173135479
Test: run vts -a x86 -m VtsHalSensorsV2_0TargetTest
Change-Id: I944bfb0b01be0831e45cfd3d6ed7dab6770d1b80
This CL fixes test failures by:
- Remove the deprecated 'Device Temperature' sensor from
the sensor list
- Ignoring the deprecated 'Device Temperature' sensor type
for tests
- Only accessing shared memory buffer if the shared memory
type is supported
- Return a default z-axis data value for the accel sensor type.
- Update the batch() functions argument to take an int64 timestamp
to adhere to the interface
Bug: 171940270
Test: run vts -a x86 -m VtsHalSensorsV2_0TargetTest
Change-Id: I88fe8746030f42edd620f9891aa44bc228a73426
- add utility function to select non one-shot, non on-change and
non special-report sensors
- apply to NoStaleEvents test case
- remove unnecessary checks related to on-change sensors
b/170315229
Change-Id: I349fe8be35fd1fa6f9ff1e0844b09815006a18b8
- add utility function to select non one-shot, non on-change and
non special-report sensors
- apply to NoStaleEvents test case
- remove unnecessary checks related to on-change sensors
Bug: 170315229
Change-Id: I349fe8be35fd1fa6f9ff1e0844b09815006a18b8
Today, when a ScopedWakelock is moved, the default move constructor
doesn't unlock the old wakelock instance. This results in the moved
ScopedWakelock instance decrementing the wakelock ref count which leaves
the multi-HAL out of sync from the sensor service.
Fix this by adding a custom move constructor / operator to ensure old
state is cleared on the moved instance.
Bug: 163468874
Test: Load multi-HAL and verify that it properly waits to release the
wakelock until the sensor service notifies that it has a lock held.
Test: Run unit tests
Change-Id: Ifd5a3c7596f78d7a756c4472f30efb625d670791
Also, pull in the static libs associated with the graphics HALs to
VtsHalSensorsTargetTestUtils so that the VTS binaries that depend on it
don't need to all pull them in themselves.
Fixes: 158018963
Test: VtsHalSensorsV2_0TargetTest on a device supporting the v4.0 HALs
Change-Id: Idc47ffb8cacd1ac84d45b979cd45fe630b6808f6
SCOPED_TRACE enables the error message contains enough detail to
easily narrow down the root cause
Bug: 154357354
Test: atest VtsHalSensorsV2_0Target VtsHalSensorsV2_1Target
Change-Id: Id6dbbe8bd8617776efec383d5276e9e12006f27d
Private sensors are the only sensor types that must define a type
string. For public sensors, a type string can be left empty as it will
be overridden by the sensors frameork.
Bug: 155514483
Test: atest VtsHalSensorsV2_0Target
Change-Id: Ib5f8fd513313670e88c2b973c1ff724658914eb2
Fixes: 154634207
Test: Load onto flame and confirm that subhal .so
android.hardware.sensors@2.X-fakesubhal-config3.so loads when it is
living in the /vendor/lib64/hw directory using
adb shell lshal debug android.hardware.sensors@2.0::ISensors/default
Change-Id: I8a676b97f6f6992e8937ecf31c3b7af06e676ebb
Updates tests and fake subhals to support Multi-HAL 2.1 to make
on-device testing feasible.
Bug: 149758467
Test: Verify that the new unit tests and subhals in this topic load and
run on a Pixel device
Change-Id: I7a9d7c1678826bb1956119e8b76f591c7bc213e1
Bug: 149758467
Test: Load onto device and verify VTS passes
Test: Verify new fake subhals load properly and that unit tests pass
that have been updated in this topic
Change-Id: Ie73458b3447dab80f6b692e55832ef562636bfdb
Revert submission 10501254-multihal_2_1
Reason for revert: Droidcop: Potential culprit for b/155328660 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Bug: 155328660
Reverted Changes:
I2be51568b:Update tests for multihal to test HAL 2.1
Id5ab7b606:Create Multi-HAL 2.1 service
Icefae8c12:Set up Multi-HAL for Sensors HAL 2.1
Change-Id: I21176759d45972cde3221cb462934fc1d7bd88c2
Revert submission 10501254-multihal_2_1
Reason for revert: Droidcop: Potential culprit for b/155328660 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Bug: 155328660
Reverted Changes:
I2be51568b:Update tests for multihal to test HAL 2.1
Id5ab7b606:Create Multi-HAL 2.1 service
Icefae8c12:Set up Multi-HAL for Sensors HAL 2.1
Change-Id: I8b97eb29633cf24f464d742770256791108c27dd
Updates tests and fake subhals to support Multi-HAL 2.1 to make
on-device testing feasible.
Bug: 149758467
Test: Verify that the new unit tests and subhals in this topic load and
run on a Pixel device
Change-Id: I2be51568ba8dd99aa0588b8945d3d41bda7d9941
Unit tests were depending on a non test library unecesarrily and it was
causing unit test build failure.
Fixes: 155239061
Test: atest android.hardware.sensors@2.0-halproxy-unit-tests
Change-Id: I057a432fdbef93680a67558c27ed7adc7fedfbbc
Bug: 149758467
Test: Load onto device and verify VTS passes
Test: Verify new fake subhals load properly and that unit tests pass
that have been updated in this topic
Change-Id: Icefae8c1261b29d704beedd51de5b3f53b374cc4
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
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
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
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
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
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
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
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
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.
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>
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>
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>
As VTS connects to the IMapper and IAllocator HALs directly, it needs to
handle the case where the device only supports the newer HAL versions,
which includes IMapper 2.1 & 3.0 and IAllocator 3.0.
Since sensors VTS uses the same functionality from the different HAL
versions, condense the code into a common interface with HAL
version-specific template instantiation. Also remove the unused code
that came along with copying from the gralloc VTS reference source.
Bug: 138758242
Test: run gralloc-related sensors VTS on Pixel 2+
Change-Id: I1646d8f92546623594af8541bc8ac02955370694
If HidlSetUp() bails before startPollingThread() is called (which can
happen if the HAL isn't implemented on the given device), mPollThread
will initialize with the default constructor resulting in joinable()
returning false which means calling detach() throws an exception.
Checking joinable() before detaching allows the test suite to be skipped
successfully.
Fixes: 136736906
Test: Run vts-tradefed on VtsHalSensorsV1_0Target and verify that it is
skipped successfully on a device that doesn't support HAL 1.0
Change-Id: Ie685ae2dc314edb8df2f3cc7112141a2f5e46008
Avoid dereferencing null if mapper service is not available.
Bug: 135638664
Test: run VtsHalSensorsV2_0TargetTest
Change-Id: I3cf2a9f152d8f1737cb5a94356e252d54156c716
Define log tag at build level to ensure all libraries have a tag
defined.
Bug: 135638664
Test: run VtsHalSensorsV2_0TargetTest
Change-Id: I593055b59238e9fa8dead00a3dafa84c00e90ec4
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
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
Extracts SensorsTestSharedMemory so that it can be used by other
versions of the sensors tests.
Bug: 111070257
Test: Build
Change-Id: I03df7462302d4ab0ea647e0d7688a46bf0e06dc1
Move SensorEventsChecker and derived classes into their own file.
Bug: 111070257
Test: Builds and passes VtsHalSensorsV1_0Target tests
Change-Id: I1d41c6edd71e6970ee0599ae21667c88dd5f1c4e
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
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