If multiple config are found, each will be validated before failing the
test.
Also add a missing new line before dumping libxml2 errors.
Test: run the following script to check for regressions and test that
invalid config make the test fail.
runTest() {(
set -xu
local readonly MODULE=$1
local readonly TEST=$2
local readonly XML=$3
runVTS() { vts-tradefed run commandAndExit vts \
--skip-all-system-status-check --primary-abi-only \
--skip-preconditions --module $MODULE -t $TEST |
awk '/FAILED: 0/{e=1} {print} END {exit !e}'; }
local FAIL=0 # used instead of return if clean up is needed
echo "# Test valid config"
runVTS || return 1
echo "# Test multiple invalid match"
adb shell touch /system/etc/$XML
runVTS && FAIL=2
adb shell rm /system/etc/$XML
echo "# Test multiple valid match (not supported if xinclude)"
if !adb shell grep -q xi:include /vendor/etc/$XML; then
adb shell cp /{vendor,system}/etc/$XML
runVTS || FAIL=3
adb shell rm /system/etc/$XML
fi
echo "# Test invalid config"
adb shell sed -i "'2i<fuu/>'" /vendor/etc/$XML
runVTS && FAIL=4
adb shell sed -i 2d /vendor/etc/$XML
echo "#Test no config"
adb shell mv /vendor/etc/$XML{,.hide}
runVTS && FAIL=5
adb shell mv /vendor/etc/$XML{.hide,}
echo "# Test that the test did not break the config"
runVTS || FAIL=6
return $FAIL
)}
runTest VtsHalAudioV2_0Target CheckConfig.audioPolicyConfigurationValidation audio_policy_configuration.xml &&
runTest VtsHalAudioEffectV2_0Target CheckConfig.audioEffectsConfigurationValidation audio_effects.xml &&
echo TEST PASSED
Bug: 64881365
Change-Id: If0443f85e0d687eed04819337519e4d9f09f5ca9
Signed-off-by: Kevin Rocard <krocard@google.com>
This patch only modifies the VTS tests.
O generic policy configuration fallback is incorrect
(see I2a39606cd820b5cd27a640248bf692204ec2cd71 for the fix).
Nevertheless, has no impact on products because this fallback
is only used in aosp builds and GSI.
Unfortunatly, this break the VTS test when run agains GSI.
Because it is too late to change GSI for Oc and DR,
relax the test to support current O GSI.
For P, ihis patch will not be part of VTS
and the fallback config will be fixed.
Bug: 65535343
Merged-In: I2a39606cd820b5cd27a640248bf692204ec2cd71
Test: Following script:
setup() {
BUILD_ID=$1
TARGET_PRODUCT=$2
TARGET_BUILD_TYPE=${3:-userdebug}
TARGET_ARCH=${4:-arm64}
set +x
echo "The following three variables can be overridden" \
"by setting the corresponding environment variable"
set -x
TEST_SUITES_TARGET=${VTS_TEST_SUITES_TARGET:-test_suites_${TARGET_ARCH}}
BASE_TARGET=${VTS_BASE_TARGET:-${TARGET_PRODUCT}-${TARGET_BUILD_TYPE}}
AOSP_TARGET=${VTS_AOSP_TARGET:-aosp_${TARGET_ARCH}_ab-${TARGET_BUILD_TYPE}}
set +x
download() {
local target=$1
local file=$2
test -f $file ||
/google/data/ro/projects/android/fetch_artifact --bid $BUILD_ID --target $target $file ||
{ local r=$?; rm $file; return $r; }
}
echo "Downloading"
download $TEST_SUITES_TARGET 'android-vts.zip'
download $BASE_TARGET "${TARGET_PRODUCT}-img-${BUILD_ID}.zip"
download $AOSP_TARGET "aosp_${TARGET_ARCH}_ab-img-${BUILD_ID}.zip"
echo "Unzipping"
rm -r system.img android-vts
unzip aosp_${TARGET_ARCH}_ab-img-$BUILD_ID.zip system.img
unzip android-vts.zip
echo "Building vbmeta without verity"
avbtool make_vbmeta_image --flag 2 --output vbmeta.img
set -x
adb reboot bootloader
fastboot update ${TARGET_PRODUCT}-img-$BUILD_ID.zip --skip-reboot
fastboot flash vbmeta vbmeta.img || echo "Warning: Device does not support vbmeta"
fastboot erase system
fastboot flash system system.img
fastboot erase metadata
fastboot -w
fastboot reboot
echo "Board setup"
echo "You may now start vts-tradefed with:"
echo '$ ANDROID_BUILD_TOP= PATH="$PWD:$PATH" vts-tradefed'
}
VTS_TEST_SUITES_TARGET=test_suites_arm64_fastbuild3d_linux setup 4327646 sailfish
vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Change-Id: Ibe1feed41325a3e4fb25e959bd254156348aa584
Signed-off-by: Kevin Rocard <krocard@google.com>
To prevent property name collisions between properties of system and
vendor, 'vendor.' prefix must be added to a vendor HAL service name.
You can see the details in http://go/treble-sysprop-compatibility.
Test: succeeded building and tested on a walleye device
Bug: 36796459
Change-Id: I4e8fbee791ec917a8f627a1366f4d44ec7e6febc
The XML audio policy configuration is expected to be located in /vendor.
Additionally for AOSP builds (no vendor) and as a fallback in case of
missing vendor configuration, the system supports loading the XML from
/system.
This fallback config is not guaranty to be compatible with the phone HAL,
but probably does for a wide range of android phones
(at least for basic use cases).
In each of those cases, there is only one configuration file, either in
/vendor or /system.
As a result, the audio policy configuration VTS test was asserting that
only one audio_policy_configuration.xml could be found.
If multiple were found, one was useless and the platform integrator
should remove it.
But VTS are now run on phone with a /system partition from an AOSP
build and a /vendor partition from a device build.
In such scenario two audio policy config are now present on the device,
thus breaking the VTS expectation.
This is not a problem for the framework because it does not look for a /system
config if one was found in /vendor.
In the future, the /system XML might be removed as boards
specific config should be found in /vendor only as per treble
requirements.
Test: Compile
Bug: 65482614
Change-Id: I7cd7eb7284c0aa52782aa591411f8a9bf2a87a76
Signed-off-by: Kevin Rocard <krocard@google.com>
The audio policy configuration deserializer supports fully dynamic
profiles by not setting a profile in a port.
It also supports partially dynamic profile by
not setting @format, @samplingRates or @channelMasks
Nevertheless this last feature of partial dynamic profile
was mistakenly not allowed by the configuration xsd.
Bug: 63541622
Change-Id: I78f77a77a3c62bba28a7da5a0e3c8c608b5a01d9
Merged-In: I78f77a77a3c62bba28a7da5a0e3c8c608b5a01d9
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit 43d25f2f26)
The audio policy configuration deserializer supports fully dynamic
profiles by not setting a profile in a port.
It also supports partially dynamic profile by
not setting @format, @samplingRates or @channelMasks
Nevertheless this last feature of partial dynamic profile
was mistakenly not allowed by the configuration xsd.
Bug: 63541622
Change-Id: I78f77a77a3c62bba28a7da5a0e3c8c608b5a01d9
Signed-off-by: Kevin Rocard <krocard@google.com>
audio_policy_configuration.xml can be loaded from the following places:
- /system/etc/
- /vendor/etc
- /odm/etc
Nevertheless the config validation test was expecting it to be in
/vendor/etc exclusively.
This patch changes the test logic to:
- look for the config files in all 3 folders
- make sure the config is unique
Test: run the following script to check for regressions and test that
invalid config make the test fail.
(
set -xe
runVTS() { vts-tradefed run commandAndExit vts \
--skip-all-system-status-check --primary-abi-only \
--skip-preconditions --module VtsHalAudioV2_0Target \
-t CheckConfig.audioPolicyConfigurationValidation; }
echo "# Test valid config"
runVTS
echo "# Test multiple invalid match"
adb shell touch /system/etc/audio_policy_configuration.xml
! runVTS
adb shell rm /system/etc/audio_policy_configuration.xml
echo "# Test multiple valid match"
adb shell cp /{vendor,system}/etc/audio_policy_configuration.xml
! runVTS
adb shell rm /system/etc/audio_policy_configuration.xml
echo "# Test invalid config"
adb shell sed -i /defaultOutputDevice/p /vendor/etc/audio_policy_configuration.xml
! runVTS
adb shell sed -i '"/defaultOutputDevice/{p;N;d}"' /vendor/etc/audio_policy_configuration.xml
echo "# Test that the test did not break the config"
runVTS
)
Bug: 64881365
Change-Id: I9db5e6f727d19fd654a3cc543a2aaab196682001
Signed-off-by: Kevin Rocard <krocard@google.com>
This test now statically links to libs not guaranteed to be on the
device.
Bug: 64040096
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check
--primary-abi-only --skip-preconditions
--module VtsHalAudioEffectV2_0Target
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check
--primary-abi-only --skip-preconditions
--module VtsHalAudioV2_0Target
Change-Id: I331d7e4abdf7e520df6d508a8059b6358ad4398f
As a VNDK module, Android.bp must have 'vndk' tag as well as
'vendor_available: true'.
The 'vndk' tag for VNDK module is formated as below:
vndk: {
enabled: true,
},
VNDK modules will be installed both in system/lib(64) as normal and
in system/lib(64)/vndk as a vendor variant.
Bug: 63866913
Test: build and boot with BOARD_VNDK_VERSION=current
Change-Id: If0eb0c1bddfa5bdc7ea0ca4635d4e53b59836582
Update the Android.bp generated with hidl-gen.
Test: build with and without BOARD_VNDK_VERSION=current
Bug: 63866913
Change-Id: I1a9db1df49e0f13c5790da2b118ae9ec63ba34a7
Allow HAL definition libs to be static.
Bug: 32920003
Bug: 64040096
Test: update-all-google-makefiles.sh
Change-Id: I1483d572bea6799717d1614fb7d52fe225e31104
No nexus/pixel device uses port gains and their configuration were taken
as reference for the xsd creation.
Gains in mixPort and devicePort are supported by the code and use by
oem. As a result the xsd should allow them.
For validation of this path, the xsd was run against the example xml in
the audiopolicy source. Several other misalignment were found. They will
be fix in an other patch.
The address is also an optional field that was forgotten for the same
reason.
Bug: b/63827061
Test: -noout xmllint --schema hardware/interfaces/audio/2.0/config/audio_policy_configuration.xsd frameworks/av/services/audiopolicy/config/audio_policy_configuration.xml
Test: the above command fails for some other xml node unrelated to this bug
Test: this is tracked by b/38184704
Change-Id: I8dae15eb85a6a6d43c87aa747daf92a88d3fdcc0
Signed-off-by: Kevin Rocard <krocard@google.com>
Bug: 63801053
In order to avoid having to instruct vts-tradefed to push the test
utility library on the target before runing the audio VTS,
duplicating the makefile declaration,
make the library static.
Test: make vts
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Change-Id: I7a98b2aaf0e0f6f91a92b7f01df1c630540ad697
Merged-In: I7a98b2aaf0e0f6f91a92b7f01df1c630540ad697
(cherry picked from commit 921d12ea6d)
Signed-off-by: Kevin Rocard <krocard@google.com>
Bug: 63801053
In order to avoid having to instruct vts-tradefed to push the test
utility library on the target before runing the audio VTS,
duplicating the makefile declaration,
make the library static.
Test: make vts
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Change-Id: I7a98b2aaf0e0f6f91a92b7f01df1c630540ad697
Merged-In: I7a98b2aaf0e0f6f91a92b7f01df1c630540ad697
Signed-off-by: Kevin Rocard <krocard@google.com>
Also, remove a warning for 1.1 interface, as the hidl freeze mechanism
is now in place.
Bug: b/34348946
Test: VTS, instrumentalization
Change-Id: I82025a7de8abd0758ba8b196bbbfc48b9322ac3b
If the device contains /vendor/etc/audio_effects.xml (the new XML
format for the audio effects configuration), the test validates
this config against the schema contained in
audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
(pushed to the device by the VTS test runner)
Change-Id: Ib57d30e3c1e32ce5d74f906a216f9bb8f635a28c
Test: this is a test
Bug: 37492580
The default stream is an alias to an other stream.
One can not allocate effects for it in the configuration
as it could conflict with the stream it aliases.
Test: run xmllint against all audio effect configs
Bug: 37492580
Change-Id: Ia2bbc13b5cf2a0a40e5eeff7ee22a7423ec16767
Signed-off-by: Kevin Rocard <krocard@google.com>
audio effects.conf legacy format had the libraries specified
in absolute path.
Nevertheless those libraries must be in specific folders.
The .conf loader used to strip the prefix of the paths then
try to load the libraries in those specific folders.
With new xml format the user only has to specify the name of the library
and the loader will load it from the known folders.
Test: run xmllint against a config with absolute paths
Bug: 37492580
Change-Id: I2863e04b3cdf0c6758d9f7be33796621fee527ed
Signed-off-by: Kevin Rocard <krocard@google.com>
Effect and effect proxy do not have the same xml structure.
As they had the same xml tag, it was impossible to discriminate them in
the xsd. Leading to xsd validating incorrect xml.
This patch changes the xsd to force proxy effect to have the type
<effectProxy> instead of <element>.
With this patch, effects have to be explicit about being a proxy and
they are forced to have a hw *and* a sw library.
Bug: 37492580
Test: validated xsd against converted effects.conf
Test: vendor/box/user/mnaganov/audio-effects-conf/test.sh
Change-Id: Idf8a1040feccbfd6a346ab9bc892f3b7e87df530
Signed-off-by: Kevin Rocard <krocard@google.com>
Add the configuration back on the master development branch.
This reverts commit d5196af814.
Bug: 37492580
Change-Id: Ie2d3218d942a995aec4d6b73fb7813e76604066b
Test: not needed
Validate the audio_policy_configuration.xml supplied in /vendor against
the format schema.
Test: Run the VTS test on target
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Bug: 35700978
Change-Id: I800e692a6ff4f64655007c33af7e34d879ee1132
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit 06a2a40309)
Move code that can be reuse between audio tests of the HIDL interface in
an utility library.
Test: run vts tests
Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Bug: 35700978
Change-Id: Ia930ad2b0a3ca31628b2cb767b265d54b210756b
Signed-off-by: Kevin Rocard <krocard@google.com>
Validate the audio_policy_configuration.xml supplied in /vendor against
the format schema.
Test: Run the VTS test on target
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Bug: 35700978
Change-Id: I800e692a6ff4f64655007c33af7e34d879ee1132
Signed-off-by: Kevin Rocard <krocard@google.com>
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>
Validate the audio_policy_configuration.xml supplied in /vendor against
the format schema.
Test: Run the VTS test on target
Test: vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Bug: 35700978
Change-Id: I800e692a6ff4f64655007c33af7e34d879ee1132
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
get_presentation_position can return ENODATA if the stream
has stopped but the write is still querying the position.
Bug: 38376424
Change-Id: I9d516a19fb347843a8ec8e8e9a0f5eab0b0798e6
Test: no log messages from StreamHAL about get_presentation_position
(cherry picked from commit 96a3a19bed)
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
This commit was never intended to be merged in master but it could not
be avoided due to an automerger limitation.
This reverts commit fd297c6f8e.
Test: Run VTS
Bug: 36311550
Change-Id: I6ee23a6282c29b125e53cced0cfcc6b697754ce0
The schema describes the new XML format for audio effects
configuration.
Bug: 37492580
Test: schema is parsed with xmllint with no errors
Change-Id: I5dd33c6806cace5cb66457e1a072bda51ee11294
get_presentation_position can return ENODATA if the stream
has stopped but the write is still querying the position.
Bug: 38376424
Change-Id: I9d516a19fb347843a8ec8e8e9a0f5eab0b0798e6
Test: no log messages from StreamHAL about get_presentation_position
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
android.hidl.base@1.0 and android.hidl.manager@1.0 are built into libhidltransport.
Test: links
Bug: 33276472
Merged-In: I08aaad80f7e2fc262aa3a8b66fe932e8133a928d
Change-Id: I08aaad80f7e2fc262aa3a8b66fe932e8133a928d
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>
If the requested buffer was too big, memory allocation would fail,
resulting if a audio hal crash (uncatch exception thrown by new).
Properly hadle the failure by retuning INVALID_PARAMETERS in such case.
Bug: 36311550
Test: Run test on target
Change-Id: Ib4170eb6a9f88f9352d0912083b43d600771bb8e
Signed-off-by: Kevin Rocard <krocard@google.com>
The result status was not checked.
Test: Run test on target
Bug: 36311550
Change-Id: I197b52d0b5a1276d3e3beba105bb91639f89e060
Signed-off-by: Kevin Rocard <krocard@google.com>
Some test did not have any documentation
Test: compile & run
Bug: 36311550
Change-Id: I37c40f6f17993a275e5c40b9a835ac04acf4f8e6
Signed-off-by: Kevin Rocard <krocard@google.com>
Stream objects used to hold a pointer to underlying HAL device
object which they didn't own. Since destruction of server side
objects is asynchronous, it was possible that a Device object
gets destroyed before Stream objects, making all the HAL device
object pointer to become stale.
Fixed by adding a strong reference to Device objects into Stream
objects.
Bug: 36702804
Change-Id: I3da3611afbb91d6fd6410ac5b8af2a2eebfa6dac
Test: ran Loopback app and HAL VTS tests
(cherry picked from commit 96d3573cda)
For methods that can't be meaningfully tested, add tests
verifying that they at least don't crash.
Bug: 32022706
Change-Id: I234c2ae4b6bc173450cf50e8749ea966cbc2d2a2
Test: this is a test
commit e6653b5d failed to include devices (IN|OUT)_USB_HEADSET
in (IN|OUT)_ALL and (IN|OUT)_ALL_USB masks
Test: audio playback and capture regression tests on marlin
Change-Id: I218b0c3ff868f3e1434e93a9e2fb07b3e16a2df8
Return are movable only, thus the fact that assertResult took a copy of
the value meant that the callee had to provide an rvalue.
This was not needed as the Result was not modified. Change it to a const
reference.
Test: run test on board
Bug: 34170075
Signed-off-by: Kevin Rocard <krocard@google.com>
Added tests covering IEffect, IEqualizerEffect, and
ILoudnessEnhancer interfaces.
Minor corrections in the interface definitions and implementations:
- fixed descriptions and @callflow annotations in IEffect;
- fixed type used for band levels in IEqualizerEffect;
- fixed specification of frequencies in IEqualizerEffect;
- fixed some bugs in previously non-execrices Effects code;
- warning messages changed to error messages.
Test: this is a test
Bug: 32022706
Change-Id: I0e0bc111b07d944ad8a0321e8b1ec703f8d1a73e
For now most tests are negative.
Test: run test on board
Bug: 34170075
Change-Id: Id207ae310e0fa5a3ab4db49122249594cd2c2703
Signed-off-by: Kevin Rocard <krocard@google.com>
Add negative test for the remaining methods of IStream
and positive one for most.
Test: run test on board
Bug: 34170075
Change-Id: Ib18c6d2e4d0a14ee4517f31319ddecf5e23ac8de
Signed-off-by: Kevin Rocard <krocard@google.com>
As some part of this big test were failing, it was difficult to actually
track on the dashboard what was wrong.
Split it in small independent equivalent tests.
Test: mm & run on target
Bug: 34170075
Change-Id: I03686e55ec112f0f0c0ef2683c5dc1ae79ff8d5e
Signed-off-by: Kevin Rocard <krocard@google.com>
This eases the debuging of failing tests.
Also print hex value of the enums as well of their literal values.
Test: run the test on target
Bug: 34170075
Change-Id: Iea1d7d2269e0e5b413240aaa905daae755846e74
Signed-off-by: Kevin Rocard <krocard@google.com>
ASSERT_INVALID_ARGUMENTS was a macro that asserted that a given Result
or Return contained INVALID_ARGUMENT. The problem was that a result can
have lots of other values like INVALID_STATE or NOT_SUPPORTED.
Additionally not all test expect only one possible result.
Introduce two overload of ASSERT_RESULT()
The first one takes an expected Result value and compare it to the
obtained one.
The second take a list and expect the obtained one to be in this list.
Test: run the test on target
Bug: 34170075
Change-Id: I798729f27f723c98292610bfb43dbdb2724ec2ca
Signed-off-by: Kevin Rocard <krocard@google.com>
The gtest dashboard only shows test names, not their parameters.
This mean that parametrized tests are names 0,1,2...
Thus when one test fails, the dashboard info is not very useful.
This patch appends the audio config to the test name.
Test: run the test on target
Bug: 34170075
Change-Id: I77090a3a17e4a3e97ecb72a8a89ad2d88626d96f
Signed-off-by: Kevin Rocard <krocard@google.com>
Master volume was the first pair of getter/setter tested
and did not use the generic test*Accessor function.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I77080a3a17e4a3e97ecb72a8a89ad2d88626d96f
Signed-off-by: Kevin Rocard <krocard@google.com>
The IDevice::debugDump method dumps debug info in a file descriptor.
Such file descriptor was previously the writing end of a pipe.
As the test is not multithreaded, if the dump was bigger than the pipe
buffer, a deadlock would occur.
With this patch, the test uses a file instead of a pipe. Thus write
will never block infinitely.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I928cae712a1cb4411f907b3a9583014ba6486abc
Signed-off-by: Kevin Rocard <krocard@google.com>
Its base class was tested but not the primary
device getters and setters.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: Ic451761c7b8b29fd302a62aba83be6ce7be35f64
Signed-off-by: Kevin Rocard <krocard@google.com>
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I0652f1bf748de99a8a2594630daf5ea2acec8934
Signed-off-by: Kevin Rocard <krocard@google.com>
Previously failing tests were commented because I thought
our implementation had to pass all tests.
As a mater of facts, it is not the case and tests are allowed to fail.
Bugs will be raised for those failure.
This is much better way to track the fixes that FIXMEs.
Test: run the corresponding vts test
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I928cae712a1cb4411f907b3a9583014ba6487abd
Signed-off-by: Kevin Rocard <krocard@google.com>
Do not close the native fd for shared memory passed by
the legacy HAL as it is owned by tinyalsa implementation.
Test: test MMAP NO IRQ playback and capture streams
Bug: 31458351
Change-Id: Ie0c2a38574e5ac5c13fdb8a5c81fd02cf7d0e47a
Add missing devices for USB headset to allow distinction
between USB sound cards and simple USB headsets.
Add output and input flags indicating special output
and input profiles to used for VoIP streams.
Test: make.
Change-Id: I7967866e15991dbf2f4349daa3ff3baa87c1c062
Test: run the vts test on target
Test: vts-tradefed r vts-hal-hidl -m VtsHalAudioV2_0Target
Bug: 34170075
Change-Id: I4bd6cb0aa5b7cc628537cd7c024542c4db8b592d
Signed-off-by: Kevin Rocard <krocard@google.com>
Diagnostic logging can be removed now as we have figured out that the problem isn't with the legacy hal.
This reverts commit 8d391c8eed.
Change-Id: I70a3454c05a0f49f3a3bed06e5a11616ed90ddf3
Temporary change for investigating b/35813113. Need to test
the hypothesis that sometimes either legacy HAL, or the wrapper
reports more bytes written than being asked for.
Bug: 35813113
Change-Id: I6596403e0ddcdcc8b061d1977e329f67670f30db
Test: make
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds
Bug: 33844934
Change-Id: I49622132d25c15597f46c19330a9d0b8dbffa704
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds; VTS HalAudioEffectHidlTargetBasicTest passes
Bug: 33844934
Change-Id: I7796982c4cad976aeeabf7708ec0104505332cad
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds
Bug: 33844934
Change-Id: I7ccbf802fcded790b4be325f36a34a3af6b42052
We need google shims on the vendor partition because they are providing
an implementation of a vendor defined interface. They were written by
google just as a courtesy/to make the transition easier. They're
basically a set for vendors to assemble their hal implementations
from.
Bug: 34135607
Test: marlin persist.hal.binderization on/off
Change-Id: I2e2af5af39264cf290259755bb9b2eb9827a21f5
This fixes a power regression caused by periodic wakeups of
the driver threads even when the device is idle.
The timeout is really not needed, it used to be there to ensure that
the thread exits its loop, but then an explicit wake-up call before
closing the thread had been added for this purpose.
Bug: 34682579
Test: Follow repro steps from the bug, compare power consumption
to the legacy version of the audio HAL.
Change-Id: I0bfc2079a449894c5d0bd6ef19b53ca425795a9e
Java intermediates are now created in the common rather than the device-
specific generated sources subdirectory.
Bug: 33842609
Test: make
Change-Id: I16af4cd19bf0b24baa0ad9ebfdb86b4d959c8672
Make sure the server aborts if it can't register the main audio
service and the effects service.
Soundtrigger and FM radio are optional, thus their failure to
register is only logged.
Bug: 34634573
Change-Id: If96e3238fe4d986e91581cc1ea0d9b36c24a8b9c
Test: restart audio service
HALs are prohibited from using framework binder, and there is
no equivalent scheduling policy service in hwbinder. Thus, in order
to match priorities of FastCapture / Mixer threads with their
counterparts in the HAL, it is needed to request the priority boost
from audioflinger on behalf of the HAL.
Bug: 34131400
Change-Id: I7c8db9d520b4cf272d2896ad875752b109b57ab7
Test: check priority match between audioflinger's and hal's threads
When outputting audio, the framework issues several HAL calls
from the same thread that writes into data FMQ. These calls
also need to be served on the same thread that writes audio data
to HAL. The same thing happens when audio input is commenced.
Add a command FMQ for passing different commands to the HAL thread.
This way, depending on the calling thread, the same call may go
either via hwbinder or via the command queue.
This dramatically reduces jitter in RTT measurements (although
doesn't improve the latency).
Bug: 30222631
Test: scripted RTT app
Change-Id: I04c826e2479d8210fd9c99756241156cda3143b6
There were two problems:
1. Joining of reader / writer / process threads (the threads that
interact with HAL) was taking up to 1 second because the thread
was usually waiting for an event flag to be toggled, or a 1s
timeout.
2. Calling IStream.close or IEffect.close shouldn't tax the caller.
Changed the code so a call to close only signals the thread that
it's time to exit, and then the thread is only joined in the
effect or stream destructor.
Bug: 34800063
Bug: 34499806
Test: see repro steps in the bugs
Change-Id: Ife20524a1eba4ec9a78152e89862526e8cd5c960
Legacy BT A2DP implementation of Audio HAL may be returning EAGAIN
from get_presentation_position, this is normal and shouldn't be
logged. Otherwise we create logspam as this HAL function is called
often.
Bug: 30222631
Change-Id: I9394dbc1d53c1f4136c2d538fccd519964ff1697
Test: play music via BT A2DP
Some legacy implementations of the effects HAL use the condition
of the reply buffer being NULL as an indication that they shouldn't
apply attenuation to the input audio data. Therefore, separate
methods are needed to distinguish the use cases of delegating the
volume control to the effect, and just informing the effect of the
volume changes.
A new method added to IEffect: volumeChangeNotification that implements
the second use case. The contract of setAndGetVolume method has been
updated to indicate that it is only called in the first use case.
Also updated the wrapper for a generic IEffect commands to pass NULL
pointers to the command and reply buffers in case when the size
of the input or output data is 0, to preserve compatibility with
direct calls from the framework.
Bug: 34368451
Test: volume control works when both Bass Boost and Equalizer are
enabled in the NXP implementation of the effects
Change-Id: I3c9a5bbdff561802bc94080c51703385a8903282
Fixed broken functionality for some devices relying on
a stub HAL module to be present (e.g Fugu).
Bug: 34360879
Test: make and check stub HAL is loaded in HIDL passthrough mode
Change-Id: Ibad050d63827c4e49604273efd76ac8074bb00d2
The combo call to stream_out->write + get_presentation_position
wasn't delivering the results of these calls entirely
correctly. Since the 'WriteResult' struct was lacking the field
for returning the status of the call to
'get_presentation_position', the client could erroneously update
the presentation position to bogus values if the call to the
legacy HAL had failed.
Updated IStreamOut.WriteStatus to include the missing field,
and updated the code to fill it out.
Also fixed logspam resulting from calling a stubbed
stream_in->get_capture_position.
Bug: 30222631
Test: Loopback RTT, media CTS
Change-Id: I38ac3b01beb095e176b54608e11e71ae5d5eafb6
Remove converage from test configs or entire config if not used
to define other test params. Tested each one individually to ensure
coverage still works.
Test: run vts -m (each test affected)
Change-Id: Ic1495a38ae9d1b32e851bc646f9c8e778eee2df1
Result: no hwbinder calls due music processing.
Added IEffect.close method for explicitly freeing up of resources
consumed by the effect before automatic server objects reaping
gets to it.
Added IEffect.setProcessBuffers method for updating the input /
output buffers on the go.
Test: make, use Play Music with effects, check traces
Bug: 30222631
Change-Id: Ia1e1bc7098fab59aa970e0ce4acdb48007409644
Result: no hwbinder calls due read / write session.
Added IStream.close method for explicitly freeing up of resources
consumed by the stream before automatic server objects reaping
gets to it.
Test: make, perform Loopback RTT, check traces
Bug: 30222631
Change-Id: I678559f6ef30026685df787cd2ba7c2ee449ed27
Threadpool can now be configured/joined if needed with
configureRpcThreadpool() / joinRpcThreadpool().
Bug: 31226656
Test: mma
Change-Id: I0d7d9924cc8c8851cc2b61ebdae906204909890e
Used hardware/interfaces/update-base-files.sh to update
file system/media/audio/include/system/audio-base.h
Test: make
Bug: 30947943
Change-Id: Id1f6971a1e40ab963c19f42a95516e6d8a26fc60