To validate the audio_policy_configuration.xml against a schema,
libxml2 is used.
Unfortunately, libxml2 uses Android.mk in oc-dev thus can not be used
from the tests which uses Android.bp.
It has been deemed safer to transform the tests to use Android.mk rather
than backporting the Android.bp patch from master.
Test: Compile
Bug: 35700978
Merged-In: I800e692a6ff4f64655007c33af7e34d879ee1132
Change-Id: Ie3f2069d60be369b4c37c27e9c1cf9372323a19c
Signed-off-by: Kevin Rocard <krocard@google.com>
HAL may not support offloading, and a call to IEffect::offload
is allowed to return an error code.
Update the test to only check that the call to the method doesn't
crash.
Bug: 38437110
Test: still passes
Change-Id: I6cfd25998edb9c68d2e585e572ba8ba3a3427e98
The schema describes the XML format for audio policy
configuration.
It will be enforced in a follow up vts test.
Bug: 35700978
Test: schema is parsed with xmllint with no errors
Test: xmllint --xinclude --noout --schema audio_policy_configuration.xsd out/target/product/sailfish/vendor/etc/audio_policy_configuration.xml
Change-Id: Ic6830446b54b3e02e4bca9b0a392523a8fb359e1
Signed-off-by: Kevin Rocard <krocard@google.com>
This reverts commit 6c0f76a684.
Since the root cause of the crash has been established, there is no need to keep this code around.
Bug: 36225019
Change-Id: I74e570e863a0cdec5d9029f1672e2e8066c246b5
HAL may not support offloading, and a call to IEffect::offload
is allowed to return an error code.
Update the test to accept either OK or NOT_SUPPORTED.
Bug: 38437110
Test: still passes
Change-Id: I1822010eed73f61bb0e0ae1852739b47fa72eade
Those tests are failing because their fix
(I0ea1a4bf952527ac0711ed3cdd31c6aa53db4d2e) is dangerous to merge in O
so close to the final release.
The fix implements a rejection feature for unsupported audio format.
This rejection is required by the hal interface
but was only partially implemented in the hal.
The problem is that the framework was never tested with a hal supporting
this behavior nor some calls implemented with this requirement.
As a result I do not feel confident in merging it in oc-dev,
it might complex, hard to detect bugs.
The fix will be merged in master thus will be part of mr1.
The current patch will be reverted in master after the fix is merged.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia9e1dcec5442e2755f0bcb13d8d502663f507dbe
Signed-off-by: Kevin Rocard <krocard@google.com>
Hals are supposed to received normalized volumes, between 0 and 1.
Previously volumes outside [0,1] were clamp to this range.
This clamping has the capability to hide bugs thus return an error if
such volume is received.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Iab70f9c651540ea2434d10939d28c1c842db19e0
Signed-off-by: Kevin Rocard <krocard@google.com>
Some mandatory methods were allowed to return NOT_SUPPORTED
although their implementations is mandatory.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ibe4b3cf73257309975ed11269a38315051fa9064
Signed-off-by: Kevin Rocard <krocard@google.com>
* changes:
Audio HAL: A volume/gain outside of [0,1] is an error
Audio HAL VTS: Log test unexpected behaviour
Audio HAL VTS: Improve ASSERT of Result and Return
Audio HAL VTS: stopped stream state getters may return INVALID_STATE
Audio HAL VTS: setGain allow -0.0
Audio HAL VTS: Some methods are optional
Audio HAL VTS: GetPresentationPosition may return 0 on stop stream
Audio HAL VTS: getDevice() == NONE => not supported
Audio HAL VTS: Getter test assert logic was incorrect
Audio HAL VTS: debugDump can only test for crash
Audio HAL VTS: Sanitize prepareFor{Writing,Reading} input size
Audio HAL VTS: refactor prepareFor{Reading,Writing}
Audio HAL VTS: Sanitize setMode input
Audio HAL VTS: Allow OK when setting a non existing parameter
Audio HAL VTS: differentiate getParam success/failure/not_implemented
Audio HAL VTS: Fix style on modified files
Hals are supposed to received normalized volumes, between 0 and 1.
Previously volumes outside [0,1] were clamp to this range.
This clamping has the capability to hide bugs thus return an error if
such volume is received.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia4880bdff6111cbcdae6a4ebee921eddae141ee4
Signed-off-by: Kevin Rocard <krocard@google.com>
Some test output infos that are useful to understand how they run.
Unfortunately the xml report does not seem to be saved by VTS tradefed.
Thus output them in logcat.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I9a2cc10160c3b1c8f81db0464efbc6b26600cadc
Signed-off-by: Kevin Rocard <krocard@google.com>
Previously tests on Result and Return were using ASSERT_NO_FATAL_FAILURE
and helper methods.
This leaded to complex error messages were the error did not pointed to
the helper methods instead of the ASSERT_RESULT call.
Additionally SCOPE_TRACE messages are repeated
for each ASSERT_NO_FATAL_FAILURE level.
Use ::testing::AssertionResult to improve drastically the error messages.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If705502546606d678df3f1966b0cd9f3ef8c2529
Signed-off-by: Kevin Rocard <krocard@google.com>
A never started stream should have its render position and next write
timestamp at 0 or indicate that the state is invalid.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I62e16066bb22101ee8f75154fc6c85a66be2f402
Signed-off-by: Kevin Rocard <krocard@google.com>
Previously -0.0 was consider an invalid value as not in the range [0,1].
But it is quite difficult in C++ to differentiate -0.0 and 0.0 as -0.0 == 0.0
and such difference has no impact in practice.
Thus leave the implementation support or not -0.0.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Ia0ebcb325f77adcf8471620f418da1cbe8995e36
Signed-off-by: Kevin Rocard <krocard@google.com>
Although the method documentation does not say it,
some HIDL interface methods are optional.
Update the tests to allow NOT_SUPPORTED to be returned.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If31acc2dbdb6d1d563910e85c99401c48f4f3f86
Signed-off-by: Kevin Rocard <krocard@google.com>
GetPresentationPosition returns the last time a sample was written to
the hardware.
Calling it on a stop stream should return 0 sample written, but the
timestamps of that measure is of little importance.
Thus allow this timestamp to be 0 indicating that the measure was never
actually made.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3c33b60f98e8cbea269a7739cc1889af932dcff5
Signed-off-by: Kevin Rocard <krocard@google.com>
getDevice does not return a Result, thus it can not return NOT_SUPPORTED.
Consider NONE as not supported.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I3b6f7a1fbc1d1535faf549f5b031461cb39d1722
Signed-off-by: Kevin Rocard <krocard@google.com>
DebugDump does not return an error code, thus the implementation can not
return not implemented.
As a result, the test can not expect any output from the function.
Only test that the call does not crash and add a log if the function is
probably not implemented in the test.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I2c18958bceb1eb638491f9afce9d8e8025ccd3ec
Signed-off-by: Kevin Rocard <krocard@google.com>
Return an error if framesCount or frameSize are null to avoid a division
by zero when calculating the buffer size.
The message queues are allocated with a buffer size but if two big they will
assert not return an error.
Thus take some margin on the buffer size check.
Note that both function should be refactored as 99% identical.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I0576e9016ef2e567c8d4e171c6237883d9865db9
Signed-off-by: Kevin Rocard <krocard@google.com>
Those functions had lots of copy paste on errors and
the following patch will even add more error detections.
Refactor the hidl_cb call to avoid all duplication.
Note that both function should be refactored as 99% identical.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: I40d6926b4f9f5e3aba51e878f55fb013f4ca09c1
Signed-off-by: Kevin Rocard <krocard@google.com>
Some values of AudioMode are exposed although implementation detail.
Make sure the client can not use them.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: If513c2a06efa8a92459f0af80c63232fc63302b0
Signed-off-by: Kevin Rocard <krocard@google.com>
setHwAvSync and setParameters were implemented in the pre-hidl interface
as set_parameters.
Unfortunately set_parameters did not return an error if a key was not
implemented.
As most HIDL implementation will be a wrapper around the pre-hidl
interface, allow those functions to return OK on not implemented key.
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Icfcaa02b7d63e03375fddc90dc5a803754c1874f
Signed-off-by: Kevin Rocard <krocard@google.com>
When sending parameters to the HAL (and some getters are implemented
with getParameters), the client expect a status consistent
with the other HIDL methods. Ie: not implemented or success and failure.
Unfortunately, the legacy get_parameter interface, which currently most
Audio HIDL implementation are a wrapper around, do not return such error
code.
Get parameters return a list of key values.
- If a requested key does not return a key value pair, consider it not
implemented
- If a requested key returns a key not followed by a correct value,
consider it a failure
- otherwise it is a success
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Id6711e9c1974fe5a336b6de83a9b6d14f74437c9
Signed-off-by: Kevin Rocard <krocard@google.com>
In order to avoid style inconsistency as well as non functional
modification in following patches,
fix the style of all files modified for the fix of the VTS tests.
Patch generated with:
$ clang-format -i --style file -- <file list>
Bug: 36311550
Test: compile
Change-Id: I53dbcdabf959a6100e34a2ee4d0f951d525049cb
This is intended to clarify whether surprising zeroing out of HAL
control structures happens to a particular HAL module, or to any
HAL module at random.
Unfortunately, the crash itself can't be prevented as
audioflinger can't work around a HAL outage, and needs to be
restarted anyway.
Bug: 36225019
Test: verified that the logged string contains the information
Change-Id: I5843d89b4e5385b4ce269f72b5891ccb646daeba
This reverts commit e4228e7aa6.
Further analysis of the bug has shown that the problem is not related
to the use of multiple inheritance.
Bug: 36225019
Change-Id: Icdcaf84061c0ecf29f891521bd961c3ee89f1cfc
We still not sure what causes crashes in Device::get|setParam*,
but it seems that it is somehow caused by the fact that the parameters
code is in a separate class with virtual methods, from which
Device class inherits along with IDevice interface.
The workaround is to substitute multiple inheritance with
delegation in Device class. Hopefully this will either eliminate
crashes or make the underlying reasons more clear.
Some of the code got reformatted by clang-format as a presubmit
requirement.
Bug: 36225019
Test: make
Change-Id: Id785c3565bbebd5acc26ca46472961698d9c6208
Fraunhofer's downmixer has additional buffering, this is incompatible
with how DownmixerBufferProvider used to process incomplete buffers.
Now the effects HIDL wrapper delivers frameCount updates in
audiobuffers to the server side. This fixes playback of multichannel
sound streams.
Bug: 36181621
Test: play 5.1 track from Play Music
Change-Id: Iffe3327c6eedef85151eec2b41e0aedfb7ffa6dc
Add checks for validity of the passed in native handle.
Bug: 37590777
Change-Id: If906f0086c3442819e1844cc521215d5b74af015
Test: VTS
(cherry picked from commit 7bae6a0b63)
Initialize audio patch handle to avoid
uninitialized value causing validation
failure in vendor hal audio patch.
Bug: 36994757
Test: Initiate voice call, no audio heard from other end
Change-Id: I4cf57210432430af89109f605813645ff332bfbb
prepare for write was refactor by Ib4170eb6a9f88f9352d0912083b43d600771bb8e
to use temporary variable in a rai pattern.
Nevertheless the member variable was still used too early in
prepareForRead resulting in a crash for capture.
Test: assistant, camcorder
Bug: 37492059
Change-Id: I08140834959c440798cd40700dd089adca2f3e40
Signed-off-by: Kevin Rocard <krocard@google.com>
"default" implies using "primary" legacy device module.
This doesn't change anything for binderized mode, because
the server was only registering itself as "sound_trigger.primary",
so it was the only possibility anyways.
Usage of "stub" (debugging) module is still possible
if audioflinger and corresponding services are built with
USE_LEGACY_LOCAL_AUDIO_HAL=true (added makefile check to ensure
that).
Test: "Ok Google" from screen off state on sailfish
Bug: 36570720
Change-Id: I88f1ebd4c1efd0f91e37458746c336a4beef33ae
vendor_available: separate copy built on the vendor partition for
BOARD_VNDK_VERSION := current devices.
**************************************************
See full implications + warning on:
https://android-review.googlesource.com/#/c/369995/
(Ia4eb5378d941033b07673daf682e66051cd3c075)
***************************************************
Test: (sanity) audio works on internal marlin
Test: (sanity) hangouts call on internal marlin
Test: warnings don't show up on BOARD_VNDK_VERSION := current devices.
Bug: 33241851
Change-Id: I2de1b789a44d238e31108312b4ec0dd5d404b1e6
If prepareToWrite or prepareToRead fails after EventFlag is created, it
is not destroyed. This lead to strange random crashes (double free it seems).
Use the RAII pattern to manage the EventFlag life cycle.
Test: Run test on target
Bug: 36311550
Change-Id: I53a04a62b7d12fdcc94afd8ced3e547aa6edff50
Signed-off-by: Kevin Rocard <krocard@google.com>
The audio buffer size is not provided by the client, it is computed from
the sample size and the number of sample.
No check was done as if the multiplication of these two numbers would
produce an overflow. This leaded to erroneous memory access crashing the
media server.
Test: Run on target
Bug: 36311550
Change-Id: I3436800ab6ac1b5e6a6aa4d03d6b96910eb54652
Signed-off-by: Kevin Rocard <krocard@google.com>