In O, the Audio effect V2 HAL allows not to have an audio effect XML
configuration but to use a .conf format.
In P, before this patch, the Audio effect V2 HAL _requires_ to have an
audio effect XML configuration and forbids the use of a .conf format.
This is discouraged by Treble as it means that an unchanged HAL V2
implementation that was compatible with O VTS will not be with P VTS.
As a result, revert to the Oreo behavior for Audio Effect V2 VTS.
Note that the audio effect V4 VTS is not changed by this patch and
still requires an audio effect XML configuration.
Aka device _updating_ to P will not have to upgrade to XML but new
devices lunching on P are still required to have an audio effect
XML configuration.
This commit only changes VTS code.
Test: cd hardware/interfaces/audio/effect/
mmm 2.0/vts/functional 4.0/vts/functional && adb sync data
adb push *.0/xml/audio_effects_conf_V*.xsd /data/local/tmp/
adb shell
cd /data/nativetest64
OPS=--gtest_filter=CheckConfig.audioEffectsConfigurationValidation
VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS
VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS
rm /{odm,vendor,system}/etc/audio_effects.xml || true
VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS
! VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS
Bug: 111421676
Change-Id: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc
Merged-In: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit b41b575475)
The test was testing a uninitialized variable instead of testing
the result of the tested method.
Bug: 110963314
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Merged-In: I9a212eef690ae627fd7f7dbfaf4a0b4047c491b3
Change-Id: I9a212eef690ae627fd7f7dbfaf4a0b4047c491b3
Signed-off-by: Kevin Rocard <krocard@google.com>
(cherry picked from commit 72641e7ad0)
Before this patch the default microphone was required to have characteristics
although it is not always an attached device, thus its characteristics can not
be known by the HAL. Additionally, the HAL might not know the active
microphone info of a input stream if it has not been started yet.
This patch only tests microphones which characteristics are reported by the HAL
and start the input stream before requesting active microphones.
Bug: 109787938
Test: vts-tradefed run vts --module VtsHalAudioV4_0Target
Change-Id: If55bfc8210d4f9443d34951f717c6772b46dde04
hidl_memory size is not used on the framework side but is checked by the
hidl framework to be a sensible value.
Due to a hack in O and P, the value can be negative, this leads to
errors in HIDL.
This patch make sure the hidl_memory size is always positive and thus
not affected by the hack.
Test: adb shell data/nativetest64/write_sine/write_sine -pl -m3 -x
Bug: 38118159
Change-Id: Ie53c46c558e8042d74ee32b55219195da82e4bcc
Signed-off-by: Kevin Rocard <krocard@google.com>
In O, the Audio effect V2 HAL allows not to have an audio effect XML
configuration but to use a .conf format.
In P, before this patch, the Audio effect V2 HAL _requires_ to have an
audio effect XML configuration and forbids the use of a .conf format.
This is discouraged by Treble as it means that an unchanged HAL V2
implementation that was compatible with O VTS will not be with P VTS.
As a result, revert to the Oreo behavior for Audio Effect V2 VTS.
Note that the audio effect V4 VTS is not changed by this patch and
still requires an audio effect XML configuration.
Aka device _updating_ to P will not have to upgrade to XML but new
devices lunching on P are still required to have an audio effect
XML configuration.
This commit only changes VTS code.
Test: cd hardware/interfaces/audio/effect/
mmm 2.0/vts/functional 4.0/vts/functional && adb sync data
adb push *.0/xml/audio_effects_conf_V*.xsd /data/local/tmp/
adb shell
cd /data/nativetest64
OPS=--gtest_filter=CheckConfig.audioEffectsConfigurationValidation
VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS
VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS
rm /{odm,vendor,system}/etc/audio_effects.xml || true
VtsHalAudioEffectV2_0TargetTest/VtsHalAudioEffectV2_0TargetTest $OPS
! VtsHalAudioEffectV4_0TargetTest/VtsHalAudioEffectV4_0TargetTest $OPS
Bug: 111421676
Change-Id: Ifb15d65ae4aa65759c8ebaa91cbc8c02234030dc
Signed-off-by: Kevin Rocard <krocard@google.com>
Effect proxy were previously mistakenly forbidden as post
or pre processing effects.
An effect being a proxy or not should not affect where
it can be use in the effect framework.
Bug: 111421676
Test: xmllint --noout --schema hardware/interfaces/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd $(find -name audio_effects.xml)
Change-Id: Iad1c1467226b86a2935a36dd90cf2e32f7f753b0
Signed-off-by: Kevin Rocard <krocard@google.com>
'usecase.source' field is used for AUDIO_PORT_ROLE_SINK,
'usecase.stream' field is used for AUDIO_PORT_ROLE_SOURCE.
The HIDL<->legacy conversion code was doing it opposite.
Test: make
Change-Id: I93722f422a8f226f11a6be97215453af3234029c
The audio tests use a static cache of some HAL objects for
performance reasons (speed up by 10x on Pixel).
Those object are destroy during the test environment tear-down.
This tear-down was destroying the objects in a FIFO instead of LIFO
order. Thus the DeficesFactory was destroyed before the Device it
created.
Bug: 79889318
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
check that the device destructor is called before the
devicesFactory one.
Change-Id: I1b4345158139ba14a8779a9508f7ebdc41129d1d
Signed-off-by: Kevin Rocard <krocard@google.com>
The test was testing a uninitialized variable instead of testing
the result of the tested method.
Bug: 110963314
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Change-Id: I9a212eef690ae627fd7f7dbfaf4a0b4047c491b3
Signed-off-by: Kevin Rocard <krocard@google.com>
For device supporting getCapturePosition,
VTS only allowed unprepared stream to return INVALID_STATE.
Now also allow for the stream to return 0 frames similarly to the other
non started states.
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Bug: 110367728
Cherry-piked from: d01dc3edac9e92981e7ae419d0e7622f753acf94
Change-Id: Ibdf8df8cb8809e98c40a50035371df6893fe4da4
Signed-off-by: Kevin Rocard <krocard@google.com>
The HAL has a negotiation mechanism where if an open output/input
stream is made with unsupported parameters, it will return
a valid config and UNSUPPORTED_PARAMETRS.
This negotiation was confusingly logged as error.
Test: "adb logcat -s DeviceHAL" show no error on successful
playback/capture
Change-Id: I5383cdcfdf8a0ca66768ffc106a1b651b9d8b2d1
Signed-off-by: Kevin Rocard <krocard@google.com>
As there could be no mic on the device, the active microphones may not
always exist. With currently implementation in qcom hal, we need to
start the stream to have active microphones. In that case, just check
the return value of the call.
Bug: 109787938
Test: vts-tradefed run vts --module VtsHalAudioV4_0Target
Change-Id: Ia9f5160a278d6c788f8f5eb17b8b276fe1d66076
Declaring the interfaces allows HIDL hwservicemanager to start
the HAL service in case it has crashed before audioserver
has called 'getService'.
Bug: 80227481
Test: use the repro case from the bug
Change-Id: Ibb46beb714b3985ab373d56d92da1105cfda28c6
VTS tests can only depend on NDK shared libraries,
they are pushed and run on older desert version.
In theory the VTS tests should be built against the NDK,
but this is not possible due to all the system dependencies.
Bug: 78871270
Test: compile
Change-Id: I48fbffd0316efc151917071c54aa19e533c615df
Signed-off-by: Kevin Rocard <krocard@google.com>
The TTYMode enum numeric value was converted to a char* instead of its
literal value and vice versa.
Instead convert it to/from its literal value.
Eg: TTYMode::FULL -> "FULL" instead of "3"
"FULL" -> 0 as atoi conversion would fail
Test: atest VtsHalAudioV4_0TargetTest
Bug: 71486871
Change-Id: I29bbf6bf3b5532269afcc5d39ea10eff2871bdea
Signed-off-by: Kevin Rocard <krocard@google.com>
Signed-off-by: Jungyee Yoo <jungyee.yoo@lge.corp-partner.google.com>
Previously, the setter of optional properties were not tested
if the getter was not supported.
This was an issue as the framework rarely gets, most
often only sets as it consider having the ownership of those properties.
Thus implementation tend to only support set.
As a result optional setter were not tested although called by the
framework.
For example the default impl setTtyMode has a bug that was not detected
because the Pixel HAL does not support getTtyMode.
This patch makes sure to always test getter and setter.
Test: atest VtsHalAudioV4_0TargetTest
Bug: 71486871
Change-Id: Ib0b03fb6eb77cc0428a33eb463166dd7c339bd3d
Signed-off-by: Kevin Rocard <krocard@google.com>
This factorization had not been ported from the AOSP patch.
The code is functionally identical.
Test: compile
Bug: 69010523
Change-Id: Ied3a657d7c219b580eb32377789096f6b2f6dc19
Signed-off-by: Kevin Rocard <krocard@google.com>
Test was calling getSupportedSamplingRate instead of channel mask.
Bug: 77307068
Test: atest VtsHalAudioV4_0TargetTest
Change-Id: Ib6e9d017793edfc95853cab0c2955b8c801bc66f
Signed-off-by: Kevin Rocard <krocard@google.com>
Thus the test was always incorrectly failing.
Also improve the test error messages.
Bug: 77307068
Test: VtsHalAudioV4_0TargetTest
Change-Id: I95db94ed99f7ca32af35422e36a95084e72279d8
Signed-off-by: Kevin Rocard <krocard@google.com>
Legacy implementation through getParameter can not return a status_t.
This is problematic for
- getSupportedChannelMasks(format)
- getSupportedSampleRate(format)
as they should be able to return NOT_SUPPORTED if they do not support
the provided format.
In that case, allow the legacy implementation to return an empty string
that will be converted to NOT_SUPPORTED.
Test: atest VtsHalAudioV4_0TargetTest
Bug: 77307068
Change-Id: I78c37caf059885e3d33e6a308876dbc0e3ef7145
Signed-off-by: Kevin Rocard <krocard@google.com>
This does not change the test logic or constraints.
It only improves the error messages.
Bug: 77307068
Test: atest VtsHalAudioV4_0TargetTest
Change-Id: I6c79ddd014d4ab8aba4f1d0b918888f83dfb63ad
Signed-off-by: Kevin Rocard <krocard@google.com>
The rest of the API (*::analyseStatus) returns NOT_SUPPORTED
when the legacy API returns -ENOSYS.
setParameter legacy -> treble shim did not follow this
conversion due to the legacy API stating that for get_paramers,
-ENOSYS should be returned if
"the implementation does not accept a parameter change while the
output is active but the parameter is acceptable otherwise",
aka INVALID_STATE.
Thus setParameter shim used to return
- OK for OK
- INVALID_STATE for -ENOSYS
- INVALID_ARGUMENTS for everything else
This leads to several problems:
- an implementation of the legacy API can not report NOT_SUPPORTED
- it is inconsistent with the rest of the status_t conversion methods
- shim methods implemented over getParameter can not distinguish
between different failures as required by the .hal documentation
Most importantly, on the system side, the Result is transformed to a
status_t again but without any special logic for methods wrapping
getParameter in the shim.
This can not be changed as the system can not know which methods
are implemented with a legacy wrapper under the Treble API boundary.
Thus setParam now converts status_t to Result in the same way
as all the other shim methods.
This patch is the second half of I41204c0807d2bd4675e941771cbc9a43d7d14855
that was reverted due to a merge conflict.
Bug: 72873273
Bug: 69811500
Bug: 69010523
Test: playback and record for media and voice call
Original-Change-Id: I41204c0807d2bd4675e941771cbc9a43d7d14855
Change-Id: I41328afce56ce31d4a26159ca2d4b16d14cce05b
Signed-off-by: Kevin Rocard <krocard@google.com>
This patch does not have any functional change.
It refactors Util.h to make it version dependant.
This is needed in the next patch to add a helper
that uses HIDL types.
This patch is the fixed first half of
I41204c0807d2bd4675e941771cbc9a43d7d14855
that was reverted due to a merge conflict.
Bug: 72873273
Bug: 69811500
Bug: 69010523
Test: playback and record for media and voice call
Original-Change-Id: I41204c0807d2bd4675e941771cbc9a43d7d14855
Change-Id: Ie543519fa0dca62486b75f42bb0c8a93d6cad3c3
Signed-off-by: Kevin Rocard <krocard@google.com>
A debugDump was used previously because the debug did not exist.
Now that the framework uses debug(), the HAL must also do so.
Bug: 78307161
Test: adb shell dumpsys media.audio_flinger
Change-Id: Ic5841d5284d742c572629249b80aa1de841983c7
Signed-off-by: Kevin Rocard <krocard@google.com>
The rest of the API (*::analyseStatus) returns NOT_SUPPORTED
when the legacy API returns -ENOSYS.
setParameter legacy -> treble shim did not follow this
conversion due to the legacy API stating that for get_paramers,
-ENOSYS should be returned if
"the implementation does not accept a parameter change while the
output is active but the parameter is acceptable otherwise",
aka INVALID_STATE.
Thus setParameter shim used to return
- OK for OK
- INVALID_STATE for -ENOSYS
- INVALID_ARGUMENTS for everything else
This leads to several problems:
- an implementation of the legacy API can not report NOT_SUPPORTED
- is inconsistent with the rest of the status_t conversion methods
- shim methods implemented over getParameter can not distinguish
failures error required by the .hal documentation
Most importantly, on the system side, the Result is transformed to a
status_t again but without any special logic for methods wrapping
getParameter in the shim.
This can not be changed as the system can not know which methods
are implemented with a legacy wrapper under the Treble API boundary.
Thus setParam now converts status_t to Result in the same way
as all the other shim methods.
Bug: 72873273
Bug: 69811500
Bug: 69010523
Test: playback and record for media and voice call
Change-Id: I41204c0807d2bd4675e941771cbc9a43d7d14855
Merged-In: I41204c0807d2bd4675e941771cbc9a43d7d14855
Signed-off-by: Kevin Rocard <krocard@google.com>
This was breaking Treble interface consistency test.
Bug: 77853088
Test: play music effect work
Change-Id: Ieb54f9c154e346286da353d0c3cdc770574c9bfe
Signed-off-by: Kevin Rocard <krocard@google.com>
- The ALL devices should not appear in the XSD as they are helpers for
enum value validity checks.
- Add the V4 values HEARING AIDS, ECHO_CANCELLER, BLUETOOTH_BLE.
- Sort the values in the same order as the enum values in
audio-base.h for easier comparison.
Bug: 77307068
Test: xmllint -xinclude --schema \
hardware/interfaces/audio/4.0/config/audio_policy_configuration.xsd \
out/target/product/walleye/vendor/etc/audio_policy_configuration.xml
Signed-off-by: Kevin Rocard <krocard@google.com>
Change-Id: I8b970d21eb0b3f256d6866be9ef935d12283076e
The metadata API was not present in the legacy HAL which lots of
developer still use.
Test: Check the method is correctly called on each track change
Bug: 38184704
Bug: 69623109
Change-Id: If56b4ee3739194e49808cf24d728c791b0588f9f
Signed-off-by: Kevin Rocard <krocard@google.com>
The XML format has not changed. Symlink the V4 XSD to the V2.
Bug: 76165942
Bug: 38184704
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioEffectV4_0Target
Change-Id: I25a61c125c461c6c5b89d53142dcf887d6c94347
Signed-off-by: Kevin Rocard <krocard@google.com>
Add conversions between hal and framework.
Bug: 64038649
Bug: 75041465
Test: Manual Testing and Cts test
Change-Id: I88a292f0509e09467750affbe84350ed82cdd500
The xsd did not have its version in its name, thus the V4 and V2 were
overwriting each other.
Bug: 38184704
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV4_0Target
Change-Id: Id7e733729a9afcdcc582f88a5527b6eb1c7283bf
Signed-off-by: Kevin Rocard <krocard@google.com>
They were supposed to be added by the change with id
I2f488462614114e4c82149460b030585981ae15e
but actually were not.
Also, rename OUT_TOP_CENTER_... to OUT_TOP_SIDE_...
according to Dean's suggestion.
Bug: 38184704
Bug: 63901775
Test: make
Change-Id: Ib263b06e4f3aa84525c2255f7a52f9bb39dbebcd
Because VTS must no be modified for old API version (except bug fixes),
as that could break retrocompatiblity.
As a result, a full copy is made. This commit is only:
$ cp -r core/2.0/vts/ core/4.0/vts
$ cp -r effect/2.0/vts/ effect/4.0/vts
With a V2 replaced by V4 test target name to avoid conflict.
Bug: 38184704
Test: Compile
Change-Id: Iddf9e7a9d42bfe84cf067a08d249a9cc0e6b7241
Signed-off-by: Kevin Rocard <krocard@google.com>
The following masks added for input: 2.0.2, 2.1.2, 3.0.2, 3.1.2
Bug: 38184704
Bug: 63901775
Test: make
Change-Id: I9ffc2a1858068fdd9fe0777184ea8464e7ab0e3b
With MSD it's possible to have another instance of IDeviceFactory.
For passthrough implementations it's necessary to check whether
the instance name is "default" because otherwise HIDL framework
will attempt to use the default implementation for MSD.
Do the same for effects in case some special effects will be
needed for MSD.
Bug: 38184704
Bug: 63901775
Change-Id: I18044f3a97e3f6ec4dc3f35b3a9300ea404fc07e
Test: audio works, effects work
Declare that the audio HAL service supports 4.0 as well as 2.0
interface.
Formatting done by clang-format.
Test: compile
Bug: 38184704
Change-Id: Iee842b141e1218f4f3779187339bde40680ec78a
Merged-In: Iee842b141e1218f4f3779187339bde40680ec78a
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
All the new files added are a copy of the 2.0 ones, with just the
version 2 that was changed to 4.
Due to the rollback on the retrocompatiblity breakage,
the split of implementation is not strictly needed any more.
This makes the current split in .impl.h and double include
unnecessary complicated.
This will need to be factorized in a future patch.
Bug: 38184704
Test: compile
Change-Id: I0d699ade7558ed68125b300f8522e2767ae1ee37
Merged-In: I0d699ade7558ed68125b300f8522e2767ae1ee37
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
The primary device has its own type and a fixed name and
is not optional.
By having its own getter, the client does not have to downcast it.
Bug: 38184704
Test: compile
Change-Id: I7b22eb0e12bddabfe966a20fbeab37d974306b12
Merged-In: I7b22eb0e12bddabfe966a20fbeab37d974306b12
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
The HAL audio service entry point is not version dependant
and is common to core and effect.
Bug: 38184704
Test: compile
Change-Id: I143cf28490afc978791ccd7e8aeee2106cbb2ebd
Merged-In: I143cf28490afc978791ccd7e8aeee2106cbb2ebd
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
All the new files added are a copy of the 2.0 ones, with just the
version 2 that was changed to 4.
Due to the rollback on the retrocompatiblity breakage,
the split of implementation is not strictly needed any more.
This makes the current split in .impl.h and double include
unnecessary complicated.
This will need to be factorized in a future patch.
Bug: 38184704
Test: compile
Change-Id: If412eb55ebf6afc773593547af9395a09b6825c2
Merged-In: If412eb55ebf6afc773593547af9395a09b6825c2
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
As multiple tracks can be connected to the same stream,
the audio source list can be found in metadata.
Bug: 38184704
Test: none
Change-Id: I63e75fd4049fbe469b78cacf0adf44e9597cb422
Merged-In: I63e75fd4049fbe469b78cacf0adf44e9597cb422
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
The name of an audio device is an opaque string that the
framework does not interpret (there are exceptions, see documentation)
and only uses as an ID to link
the audio_policy_configuration.xml and the audio device factory.
Previously it was an enum which meant that the vendors
could not implement the interface more than a set number of time
and that generic meaningless (secondary, auxiliary) names had
to be introduced.
Bug: 38184704
Test: compile
Change-Id: I9f3ac1928de8116974257951e016108c5820eded
Merged-In: I9f3ac1928de8116974257951e016108c5820eded
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
The HAL API for port name is a C++ string of arbitrary
length.
Nevertheless the legacy API name had a maximum length.
Thus when wrapping from the new to legacy, the string
was truncated but no '\0' was added.
Bug: 38184704
Test: compile
Change-Id: I482363809718281e022041c2d5042e5800c5a617
Merged-In: I482363809718281e022041c2d5042e5800c5a617
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
That avoids to repeat the destination type which
can change between versions.
Bug: 38184704
Test: compile
Change-Id: I55c881afe5f6fc511ea01b19c5d46de12fb1e0d2
Merged-In: I55c881afe5f6fc511ea01b19c5d46de12fb1e0d2
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
Those values are only for the framework, thus they should not be
available to the vendor.
Bug: 38184704
Test: compile
Change-Id: I05d3e506a85dbe66d51b7024fa9de45865bcf9db
Merged-In: I05d3e506a85dbe66d51b7024fa9de45865bcf9db
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
Some enum values only used by the system were exposed to the vendor for
legacy reason. Remove them.
Bug: 38184704
Test: compile
Change-Id: I78254047a74d08bcdf2d7b285e874dbd497d5407
Merged-In: I78254047a74d08bcdf2d7b285e874dbd497d5407
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
Declare that the audio HAL service supports 4.0 as well as 2.0
interface.
Formatting done by clang-format.
Test: compile
Bug: 38184704
Change-Id: Iee842b141e1218f4f3779187339bde40680ec78a
Signed-off-by: Kevin Rocard <krocard@google.com>
All the new files added are a copy of the 2.0 ones, with just the
version 2 that was changed to 4.
Due to the rollback on the retrocompatiblity breakage,
the split of implementation is not strictly needed any more.
This makes the current split in .impl.h and double include
unnecessary complicated.
This will need to be factorized in a future patch.
Bug: 38184704
Test: compile
Change-Id: I0d699ade7558ed68125b300f8522e2767ae1ee37
Signed-off-by: Kevin Rocard <krocard@google.com>
The primary device has its own type and a fixed name and
is not optional.
By having its own getter, the client does not have to downcast it.
Bug: 38184704
Test: compile
Change-Id: I7b22eb0e12bddabfe966a20fbeab37d974306b12
Signed-off-by: Kevin Rocard <krocard@google.com>
The HAL audio service entry point is not version dependant
and is common to core and effect.
Bug: 38184704
Test: compile
Change-Id: I143cf28490afc978791ccd7e8aeee2106cbb2ebd
Signed-off-by: Kevin Rocard <krocard@google.com>
All the new files added are a copy of the 2.0 ones, with just the
version 2 that was changed to 4.
Due to the rollback on the retrocompatiblity breakage,
the split of implementation is not strictly needed any more.
This makes the current split in .impl.h and double include
unnecessary complicated.
This will need to be factorized in a future patch.
Bug: 38184704
Test: compile
Change-Id: If412eb55ebf6afc773593547af9395a09b6825c2
Signed-off-by: Kevin Rocard <krocard@google.com>
As multiple tracks can be connected to the same stream,
the audio source list can be found in metadata.
Bug: 38184704
Test: none
Change-Id: I63e75fd4049fbe469b78cacf0adf44e9597cb422
Signed-off-by: Kevin Rocard <krocard@google.com>
The name of an audio device is an opaque string that the
framework does not interpret (there are exceptions, see documentation)
and only uses as an ID to link
the audio_policy_configuration.xml and the audio device factory.
Previously it was an enum which meant that the vendors
could not implement the interface more than a set number of time
and that generic meaningless (secondary, auxiliary) names had
to be introduced.
Bug: 38184704
Test: compile
Change-Id: I9f3ac1928de8116974257951e016108c5820eded
Signed-off-by: Kevin Rocard <krocard@google.com>
The HAL API for port name is a C++ string of arbitrary
length.
Nevertheless the legacy API name had a maximum length.
Thus when wrapping from the new to legacy, the string
was truncated but no '\0' was added.
Bug: 38184704
Test: compile
Change-Id: I482363809718281e022041c2d5042e5800c5a617
Signed-off-by: Kevin Rocard <krocard@google.com>
That avoids to repeat the destination type which
can change between versions.
Bug: 38184704
Test: compile
Change-Id: I55c881afe5f6fc511ea01b19c5d46de12fb1e0d2
Signed-off-by: Kevin Rocard <krocard@google.com>
Those values are only for the framework, thus they should not be
available to the vendor.
Bug: 38184704
Test: compile
Change-Id: I05d3e506a85dbe66d51b7024fa9de45865bcf9db
Signed-off-by: Kevin Rocard <krocard@google.com>
Some enum values only used by the system were exposed to the vendor for
legacy reason. Remove them.
Bug: 38184704
Test: compile
Change-Id: I78254047a74d08bcdf2d7b285e874dbd497d5407
Signed-off-by: Kevin Rocard <krocard@google.com>
Initialize processtate with vndbinder to allow
vendor components to talk via vndbinder
Test: re-launch android.hardware.audio@2.0 service
Change-Id: I9fafff157c5e497a8125b13741b56e0852534ffa
This adds the following method:
IStreamOut.selectPresentation
This corresponds to the following legacy parameters:
AUDIO_PARAMETER_STREAM_PRESENTATION_ID
AUDIO_PARAMETER_STREAM_PROGRAM_ID
Bug: 63901775
Test: make
Change-Id: I9ca6ead72b1ef80d2de582a6e4b051ee32fe1857
To retain compatibility with existing usages of the "routing"
parameter, IStream.setDevice method must accept multiple devices
(as DeviceAddress). This happens when the patch being created
has multiple sinks.
As a consequence, IStream.getDevices needs to return a vector of
DeviceAddress structs.
Bug: 73240607
Test: make
Change-Id: I77aedeb435988363d30325d045f791f3785c8bb5
It was a mistake to put this method on IStream, in fact
it belongs to IDevice.
Bug: 73087917
Change-Id: I3ece962343c8541b7891b6448eb43e2f9481ed8a
Test: make
This output is used to send audio to earring aid device
(usually through Bluetooth).
Bug: 38184704
Test: mm
Change-Id: I09ec4d2853ef04300fcda45bddb4a42209f19be0
Signed-off-by: Kevin Rocard <krocard@google.com>
Switching to 64 bit has proven to be too much refactor
and the need is not immediate.
Instead in the next version of the Audio HAL,
AudioDevice will no longer be a bitfield and when multiple
devices will need to be passed, a list will be used.
Bug: 38184704
Test: mm
Change-Id: I8de14fc4ee69fb70fc1c4275b568093a5d0aec1b
Signed-off-by: Kevin Rocard <krocard@google.com>
Run update-makefiles.sh to create all HAL makefiles.
Test: update-makefiles.sh
Bug: 38184704
Change-Id: I2532c4b9d1f0f6252ceaffbfb0c5d0a615400c72
Signed-off-by: Kevin Rocard <krocard@google.com>
Remove unnecessary Result typedef.
Make bufferSizeFrames and burstSizeFrames unsigned
as they should not be negative.
Remove legacy AudioInterleave.
Remove implicit callflow annotation.
Make EffectConfigParameters a bitfield.
Bug: 38184704
Test: hardware/interfaces/update-makefiles.py
Change-Id: I33e6f7869d20ca0cad4123f32347754e5a514caa
Signed-off-by: Kevin Rocard <krocard@google.com>
Get list of all/currently active microphones from hardware.
Part of the device enumeration feature.
Bug: 64038649
Test: test/vts-testcase/hal/script/update_makefiles.py
Change-Id: I08051f1d6013672dea8f3866776864e87ff35297
Rebased for 4.0 by:
Signed-off-by: Kevin Rocard <krocard@google.com>
Originally written by:
Signed-off-by: Ricardo Garcia <rago@google.com>
Too many usages detail were previously exposed to the HAL.
All usages that should be handled identically by the HAL
are now the same value.
- All notification types are now the same usages
Test: build
Bug: 38184704
Change-Id: I2096f995e249ab02bc29449c6d1a65b521dc13f7
Signed-off-by: Kevin Rocard <krocard@google.com>
Allow multiple concurrent opened profiles.
Allow mixPort to declare their preferred usage.
Allow to declare the default devicePort for a device type.
Bug: 38184704
Test: xmllint --noout --schema hardware/interfaces/audio/4.0/config/audio_policy_configuration.xsd --xinclude out/target/product/taimen/vendor/etc/audio_policy_configuration.xml
Change-Id: If2afd9e83f8b023e6229496759dc525497af8d72
Signed-off-by: Kevin Rocard <krocard@google.com>
That will make it easier to review the changes between 2.0 and 4.0.
Bug: 38184704
Test: none
Change-Id: Icb36a5b6e74ad89fb05dfe3ceee7b7f81801918d
Signed-off-by: Kevin Rocard <krocard@google.com>
Forward to the HAL the audio usage, audio content types and volume
of playback tracks to the stream out they are playing to.
Forward to the HAL the audio source and volume of record tracks
to the stream in they are playing to.
This will allow the HAL to better tune its effects and remove the need
to inject a fake effect (volume listener) to get the tracks volume.
Bug: 38184704
Test: none
Change-Id: Iede0f7aa518608c3b3ce1497f059f672aac109b2
Signed-off-by: Kevin Rocard <krocard@google.com>
The debugDump function was deprecated by the introduction of the
debug method in the IBase.
AudioMode CURRENT and INVALID should not be passed to the
vendor.
Bug: 38184704
Test: none
Change-Id: I0e14c71ce7216524587a6ba28cae0cdb821bae23
Signed-off-by: Kevin Rocard <krocard@google.com>
The audio HAL has lots of enums were each value is a specific bit
pattern (usually a single bit) and are expected to be used as a
combination of value (kind of like a bitfield).
Nevertheless the 2.0 methods only had the enums themselves in their
signatures which leads the HIDL API checkers to warn that invalid values
were passed.
Currently, there are no way to express a value which is a combination
of enum values. The closest thing is the bitfield type.
Thus transition all enums combination to bitfield.
Note that AudioDevice as NOT been transition systematically
as both the enums and the combination are meaningful:
- the enum is one device
- the combination is a list of device.
Test: none
Bug: 38184704
Change-Id: I155cf7bc5d88fc5cf8954903d55aa8d7ca458a4b
Signed-off-by: Kevin Rocard <krocard@google.com>
Add MAT 1.0, 2.0, 2.1 audio formats
Add 5.1.2, 5.1.4, 7.1.2, 7.1.4 output channel masks
Add E_AC3_JOC audio format
Add MSD Device to allow an MSD HAL implementation separated from the
primary.
Bug: 38184704
Test: none
Change-Id: I2f488462614114e4c82149460b030585981ae15e
Original author:
Signed-off-by: Dean Wheatley <dwhea@dolby.com>
Ported to HAL 4.0:
Signed-off-by: Kevin Rocard <krocard@google.com>
Add new device to the device factory to allow vendors to split
their HAL implementations more.
AudioDevice bitfield is now 64bit to allow more devices to be added.
Add a new AudioDevice to support playing music to distant during voice
call.
A HAL can now declare if its MMAP buffer can be securely accessed
directly by untrusted apps.
Add AAC_XHE format.
Add BLE input source.
Bug: 38184704
Test: none
Change-Id: Ic2fbec4db71c7f688c8847ba39c72f51480c0727
Signed-off-by: Kevin Rocard <krocard@google.com>
The CNT, MAX enum values had two drawbacks:
- they were invalid enum value that were part of the enum
thus enum validity check would validate them although those values
are only expected to be use in loops/validation code.
- they are not extensible by vendors
The *_ALL enum values were not extensible by vendors.
Those values can instead be replaced by treble enum iterator and
helper functions.
Bug: 38184704
Test: none
Change-Id: I1a9527bb7311088e0abe22eceee92d21d9171ca4
Signed-off-by: Kevin Rocard <krocard@google.com>
hidl-doc does not support two consecutive documentation comments
/** ... */
/** ... */
In such case make the first one a non-doc comment.
This is a port of: http://android-review.googlesource.com/432140
Bug: 38184704
Test: none
Change-Id: I86cb10c655036ca49055ee007813c3e5af743eb5
Signed-off-by: Kevin Rocard <krocard@google.com>
Add missing documentation, especially for failure cases
and methods that are optional.
Add missing operation status for testability.
Add format for getSupported* methods as they could not
be implemented in 2.0 for multi-format stream (HDMI).
Test: compile
Bug: 38184704
Change-Id: I14ee5e02ef70a82df6de732f88b065810e9b032f
Signed-off-by: Kevin Rocard <krocard@google.com>
That will ease review of the changes.
The only changes are:
- replace all @2.0 by 4.0
$ sed -i 's/@2\.0/@4\.0/g' */4.0/*.hal
- replace all licence 2016 by 2018
$ sed -i 's/2016/2018/g' */4.0/*.hal
Moving the .hal in a subfolder forces the package name and the
namespace to change.
This mean that the audio HAL 2.0 and 4.0 will not be consider
different version of the same HAL but two different HALs.
As a result to minimize code change due to tight deadline,
keep the 4.0 core in the audio folder.
Bug: 38184704
Test: hardware/interfaces/update-makefiles.sh
Change-Id: I7c7a826270c9933091f037b795806787e1284583
Signed-off-by: Kevin Rocard <krocard@google.com>
A device may not be configured to ship with ST V2.1 impl,
in this case the device will stuck in a boot loop because the
framework will be attempting to instantiate ST, but the
service will not have ST server side registered.
Since the service code is the same for all devices,
allow a fallback to ST V2.0. This way, if only V2.0 is present
on the device, it will be registered, and the framework
will find it. The actual version used can be determined by
examining output of 'lshal' command.
Also remove obsolete dependency on broadcast radio.
Bug: 63600413
Bug: 68823037
Test: Try taimen both with ST V2.0 and V2.1 impls
Change-Id: I484659b1df5a7e4b11db91d0cf75a7079786c766
Move in order to adhere to the new folder organisation.
Bug: 38184704
Test: compile
Change-Id: I7398cab951ee628782f81098b57b04a1402b4041
Signed-off-by: Kevin Rocard <krocard@google.com>
This patch only contains cosmetic reformatting imposed by clang-format.
Bug: 38184704
Test: compile
Change-Id: Ic2a2386b976cf1df1e4e062b45688cd6115541d3
Signed-off-by: Kevin Rocard <krocard@google.com>
The name device has already too many meaning, thus rename the main audio
api to core.
Bug: 38184704
Test: compile
Change-Id: I178dfef05af8f8579196affbe2cbc5f6c3f9af55
Signed-off-by: Kevin Rocard <krocard@google.com>
What was done in this patch:
# move headers in all-versions/default folder for qualified inclusion
mkdir -p audio/effect/all-versions/include/effect/all-versions/default/
mv audio/effect/all-versions/*[hp] $_
# Go in the all-versions header folder
cd $_
# Use a macro for the version
sed -i '/^#/!s/V2_0/AUDIO_HAL_VERSION/g' *
#Remove 2.0 includes
sed -i "/include.*2.0/d" *
# Add include guard to make sure AUDIO_HAL_VERSION is set
sed -i '/limitations under the License/!b;N;a\n#include <common/all-versions/IncludeGuard.h>' *
# Remove guard include macro
sed -i '/^#.*[H_]$/d' *
# Remove LOG_TAG
sed -i '/LOG_TAG/d' *
# Remove local include (include "XXX")
sed -i '/include.*"/{N;/\n$/d;D}' *
# Replace implementation with inclusion
cd audio/effect/2.0/
git checkout HEAD^^
ls *h *cpp| sed -r 's/.*h$/\0 \0/;s/(.*)cpp/\1impl.h \0/' |xargs -L1 printf '1h;2,$H;$!d;g;s$namespace.*}[^\\n]*$#define AUDIO_HAL_VERSION V2_0\\\n#include <effect/all-versions/default/%s>\\\n#undef AUDIO_HAL_VERSION$\000%s\000'|xargs -0 -n2 sed -i
+ manual update of Android.bp and removal of duplicate include
Bug: 38184704
Test: compile
Change-Id: If99871516f3069fcb9e699ab670a665d7d507e7d
This will make diff much more clear and allow git to follow the files.
Bug: 38184704
Test: compile
Change-Id: I90deaad883a52ef8fbcd3109937f90d46d458f8c
Signed-off-by: Kevin Rocard <krocard@google.com>
This patch only contains cosmetic reformatting imposed by clang-format.
Bug: 38184704
Test: compile
Change-Id: If5e61eecd0a67fec19997792c9db73936ce7be2e
Signed-off-by: Kevin Rocard <krocard@google.com>
This will make diff much more clear and allow git to follow the files.
Bug: 38184704
Test: compile
Change-Id: I946b20254dcda1cb31b48898d0b5f46b185ebafe
Signed-off-by: Kevin Rocard <krocard@google.com>
This patch only contains cosmetic reformatting imposed by clang-format.
Bug: 38184704
Test: compile
Change-Id: I57545f2b8de1e982028ef4794328741d91682e0c
Signed-off-by: Kevin Rocard <krocard@google.com>
The previous patch made the test independent of the HAL version
As a result, move them in the version common folder.
Note that this patch is separated from the previous patch to ease
review.
Bug: 38184704
Test: compile
Change-Id: I98a46eb0b88ea786656200ab613afd2d36ed222d
Signed-off-by: Kevin Rocard <krocard@google.com>
The implementation uses the version provided by macro.
Bug: 38184704
Test: compile
Change-Id: Ib5565bdf77ed9e42fc8271a4317eb88681aefcd5
Signed-off-by: Kevin Rocard <krocard@google.com>
This will make diff much more clear and allow git to follow the files.
Bug: 38184704
Test: compile
Change-Id: I41ccb41c334aa56d3935be333e6227dd99773766
Signed-off-by: Kevin Rocard <krocard@google.com>
This patch only contains cosmetic reformatting imposed by clang-format.
Bug: 38184704
Test: compile
Change-Id: I2f8c74d1b976e1e4e74f85dd0e8350f9b16fb31a
Signed-off-by: Kevin Rocard <krocard@google.com>
This dependency is imported but not used, so it should technically
go in the Android.bp file.
Bug: 71863483
Test: none
Change-Id: I3ee391bdea47182689156b3243b75a3572f7d8bf
StreamOut::asyncCallback could became an owner of StreamOut
causing the destructor to be called on the offload callback
thread, while the legacy HAL is holding a mutex, which resulted
in a deadlock.
Removed erroneous usage of sp<StreamOut> in asyncCallback.
The legacy HAL joins the offload callback thread when closing
output stream, thus StreamOut destructor is guaranteed to finish
only after the offload callback thread has exited, and using
a raw pointer to StreamOut inside asyncCallback is correct.
Bug: 70863217
Change-Id: I0d77018cf3df5ad07251732733288d425dd836eb
Test: manual
setSampleRate, setChannelMask, setFormat
may not be implemented by the HAL, although this is not documented in
the HAL API.
Currently the VTS test requires their implementation if the respective
getSupported{SampleRate,ChannelMask,Format} are supported.
Relax this requirement as the framework never calls those setters.
Note that the optionality of those functions will be documented
in the next HAL API version.
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Bug: 69811500
Change-Id: I3a390ae925cabd99e7f1ed4a627e71ad87b1b437
Signed-off-by: Kevin Rocard <krocard@google.com>
getSupportedSampleRate should return the native sampling rates,
(IE. the sampling rates that can be played without resampling)
but other sampling rates can be supported by the HAL.
The test was too strict as it was failing if HALs were supporting more
sample rates than there native (optimized) ones.
For example, a HAL might have its best performance (no resampling)
on 48kHz but still support 16kHz through resampling.
Note: getSupportedSampleRate might be renamed to getNativeSampleRate in
the next major HAL revision to avoid ambiguity.
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Bug: 69811500
Change-Id: I1ec1ce422bc5039637463c6641060508f4ee892b
Signed-off-by: Kevin Rocard <krocard@google.com>
This constraint was added due to an incorrect assumption
that device ports were identified by names whereas
they are by the (module,type,address) triplet.
Bug: 69442986
Test: xmllint validates an XML with two identically named devices in
different modules.
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Change-Id: I66d890d3c967bead4f2a287202c259009217996a
Signed-off-by: Kevin Rocard <krocard@google.com>
Device port are not identified by names but by their type and address
and the module they are in.
As a result, enforce this constraint in the XSD. Violating it results in
a policy parsing crash.
Bug: 69442986
Test: xmllint invalidates an XML with two devices of the same type
and address
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
Change-Id: I84245f0fa80fef786a002c98073c166b6aaf2be4
Signed-off-by: Kevin Rocard <krocard@google.com>
Vendor are currently not allowed to extend the XML format.
As some enumeration are allowed to be extended, this mean that
the format must allow some extension mechanism.
This patch relaxes the definition of the module name field.
AOSP names are still allowed, but a vendor can add its own name
if prefixed with "vx_". Eg:
<module name="vx_google_vr" halVersion="3.0">
Test: xmllint --xinclude --noout --schema hardware/interfaces/audio/2.0/config/audio_policy_configuration.xsd audio_policy_configuration.xml
with audio_policy_configuration.xml containing a module named vx_google_vr
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target -t CheckConfig.audioPolicyConfigurationValidation
on Pixel 2
Bug: 69442986
Signed-off-by: Kevin Rocard <krocard@google.com>
Change-Id: I4ead38535cce89bb8fe44cf23fa1146acd1271d6
This was preventing getCapturePosition() being called from
the default HIDL implementation.
Test: cts-tradefed run cts -m CtsMediaTestCases \
-t android.media.cts.AudioRecordTest
Change-Id: I9c920108f68fb895a7f7a9d2ea27c291a91c1afb
Removing whenever I see these in code reviews.
Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
Removing whenever I see these in code reviews.
Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
Removing whenever I see these in code reviews.
Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
Automatic mk -> bp conversion for all modules here
which can be converted and built automatically.
Test: Soong resolves all dependencies
Bug: 37512442
Change-Id: Ib789212cb88d55731397c600d132e7c672c0d8be
set_parameter wrapper was converting status_t as such:
OK -> OK
-ENOSYS -> INVALID_STATE
everything else -> INVALID_ARGUMENTS
Which was inconsistent with the rest of the wrapper which was doing:
OK -> OK
-EINVAL -> INVALID_ARGUMENTS
-ENODATA -> INVALID_STATE
-ENODEV -> NOT_INITIALIZED
-ENOSYS -> NOT_SUPPORTED
everything else -> INVALID_STATE
Unfortunately, identical conversion can not be achieve as legacy
set_parameter specifically require
-ENOSYS -> INVALID_STATE
in `get_parameter` docstring:
* If the implementation does not accept a parameter change while
* the output is active but the parameter is acceptable otherwise, it must
* return -ENOSYS.
As a result implement:
OK -> OK
-EINVAL -> INVALID_ARGUMENTS
-ENODATA -> INVALID_STATE
-ENODEV -> NOT_INITIALIZED
-ENOSYS -> INVALID_STATE <--- unchanged
everything else -> INVALID_ARGUMENTS <--- unchanged
Test: Playback and record over builtin & USB. Hangout call
Test: vts-tradefed run commandAndExit vts --module VtsHalAudioV2_0Target
Bug: 67030461
Change-Id: I13649eb00f8465921e5c718c5d5df120e1262ff7
Signed-off-by: Kevin Rocard <krocard@google.com>