Commit graph

1859 commits

Author SHA1 Message Date
Mikhail Naganov
9d16a6ac10 audio: Allow Module subclasses to customize stream creation
Since specializations of the 'Module' class likely need
to provide their own specializations for streams, provide
virtual methods for them.

Bug: 282568751
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Iddb1bff9f11bc867aba61897ea2f8b9bc3c27544
2023-06-26 17:32:01 -07:00
Mikhail Naganov
d5554cfae2 audio: Refactor streams implementation
Simplify the experience of implementing stream variants.
Stream class now exposes two interfaces: DriverInterface
and StreamCommonInterface, which represent the two
aspects of its usage: via the FMQ on the worker thread,
and via IStreamCommon Binder interface.

Input/output streams now inherit the concrete stream
variant, and implement interface methods specific for
IStreamIn and IStreamOut.

Added DriverInterface::shutdown method which is called
on the worker thread prior to the exit.

Bug: 282568751
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I5bf8da2f22b27f0e284a41fc30b920d87ac2936c
2023-06-26 17:32:01 -07:00
Mikhail Naganov
75b59dfb4e audio: Propagate errors from Driver::setConnectedDevices
Plumb propagation of errors reported by the implementations
of DriverInterface::setConnectedDevices up to the Module.
This allows returning the reported errors from the corresponding
IModule interface methods. Implement handling of errors
from connection state update by the Module implementation.

When updating streams about the connection status
ensure that the list of connected devices is not empty.

Also, add an extra check to AudioStreamIn#ActiveMicrophones
to validate the size of the returned active microphones
list.

Bug: 282568751
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I62a422d95c37a672fce4ad221bea435cc7b4ebfa
2023-06-26 17:32:01 -07:00
Mikhail Naganov
26dc9add8d audio: Enable use of 'expected_utils' for ScopedAStatus
Add necessary helper functions and use
RETURN_STATUS_IF_ERROR where possible.

Bug: 282568751
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If68c995da0e5e0cb2e9c142ba40af6503ff628b2
2023-06-26 17:32:01 -07:00
Mikhail Naganov
b42a69ef68 audio: Pass flags and I/O handle to StreamContext
Vendor implementations may need to see the value of flags
and the I/O handle of the mix port used to open the stream.

Bug: 282568751
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If1f346793f3b3a725bc19358909f5b461cb159c1
2023-06-26 17:32:01 -07:00
Mikhail Naganov
57f0dcf78d audio: Facilitate extension of Module class by vendors
Make interface methods protected so that subclasses can
augment them.

Provide getters for private fields.

Bug: 282568751
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I0e4810f8a4c816c4f673139816e9768f6dc8da7c
2023-06-26 17:32:01 -07:00
Shunkai Yao
9e60e635bf Format VTS test code
Bug: 287430121
Test: atest VtsHalAudioEffectTargetTest
Change-Id: Iecc0c9388c6596cf5a25918f8f0af0495b2133a6
2023-06-23 04:34:50 +00:00
Jaideep Sharma
e4c7a96789 aidl: Improve Effect VTS naming
Use uuid in hexadecimal format in testcase name.

Change-Id: Ib687b6617060e4400a767f23ca0b26cece4005f1
2023-06-16 05:58:43 +00:00
Yu Liu
e989964b89 Remove duplcated static libgtest
Bug: 284287101
Test: locally build
Change-Id: Ia7fbf101eff850a2d128f17ad3fdefe6da99a987
2023-06-05 12:47:39 -07:00
Jooyung Han
ee8374606a Merge "Set root elements for xsd_config modules" 2023-05-30 03:58:25 +00:00
Mikhail Naganov
310b1c6e7e audio: Add more legacy channel masks for the input direction
This is in order to achieve a better parity both with
legacy output channel masks and AIDL channel layouts.
The change only affects the XSD schema used to generate
a parser for legacy configuration files.

Bug: 283542128
Test: atest audio_aidl_conversion_tests
Change-Id: Ic69b94f6ec650e0814f0200dbef219567eac9fe2
2023-05-22 13:52:50 -07:00
Jooyung Han
16d5af6755 Set root elements for xsd_config modules
This reduces the code size by not generating unnecessary code for
non-root elements.

Bug: 283700992
Test: m
Change-Id: I23bd5c2a0ccc40fded3ca08155ead5f4680c2ed9
2023-05-22 16:43:12 +09:00
Mikhail Naganov
3755134720 audio: Fix the comment about threading of DriverInterface::init
'DriverInterface::init' is called on the same thread as other
interface methods (the worker thread), except
for 'setConnectedDevices'. Update the comment to reflect this,
and rearrange the methods order in the interface.

Bug: 283463913
Test: m
Change-Id: I8937506d20ff8233b4b934c421173ce2bec9d43e
2023-05-19 20:08:53 -07:00
Lorena Torres-Huerta
aa8f76af92 audio: Provide code for parsing surround sound config from XML
The main change is to convert the result of parsing from XSDC
types to AIDL, and add a VTS test for IConfig.getSurroundSoundConfig.

Extra changes:
  - add 'Unchecked' suffix to conversion functions that do not
    wrap the result into ConversionResult;
  - enable more compile-time checks for the default AIDL service,
    fix issues found.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Icf578b8d28647e6355ed5328599c77d2ca1234f9
2023-05-16 18:00:14 -07:00
Mikhail Naganov
b511b8aa21 audio: Enable more compile time checks in the default impl
Enable "-Wall, Wextra, Werror, Wthread-safety",
fix discovered issues.

Bug: 205884982
Test: m
Change-Id: I0a8d3095dd24dbb3bc7cf6569c1f71945cd55168
2023-05-16 17:54:30 -07:00
Shunkai Yao
492dc40711 Merge "Implement AIDL effect IFacotry::queryProcessing" 2023-05-16 22:38:43 +00:00
Shunkai Yao
5824efbe84 Implement AIDL effect IFacotry::queryProcessing
Bug: 281572768
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I0166786d531437ef52690b92067766879b043a1d
Merged-In: I0166786d531437ef52690b92067766879b043a1d
2023-05-15 23:13:07 +00:00
Mikhail Naganov
26526f15e3 audio: Update hardwired configuration
Fill in address for remote submix devices. Specify correct
connection type for the remote submix output.

Avoid logging entire HAL Engine Config.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I246435e4d3b848b5d0ad9810d13f650603eac76d
2023-05-12 19:44:26 -07:00
Treehugger Robot
2ba43ea9f3 Merge "Remove Descriptor proxy field from individual effect" 2023-05-10 17:37:29 +00:00
Mikhail Naganov
a273cdde84 audio VTS: Update 7.0/PolicyConfig
The call to instantiate PolicyConfig was updated
in Iced9d665d018853c4b2a50f4471a545af7bf60bb, however
the version of PolicyConfig class for HIDL HAL 7.x
was not updated accordingly

Bug: 205884982
Bug: 281450557
Test: atest VtsHalAudioV7_0TargetTest
Test: atest HalAudioV7_0GeneratorTest
Change-Id: Ic7ed6b186e1d0f1ff853f84ad962c1e4acf17a68
2023-05-08 13:17:08 -07:00
Shunkai Yao
e0f32c1dd7 Remove Descriptor proxy field from individual effect
This field should be filled by IFactory implementation

Bug: 271500140
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I96203b8cd037fd81b0b1d88fc5ca9915df02a919
Merged-In: I96203b8cd037fd81b0b1d88fc5ca9915df02a919
2023-05-03 23:58:29 +00:00
Treehugger Robot
8182edb4ff Merge "Freeze Audio AIDL interfaces" 2023-05-02 23:28:26 +00:00
Treehugger Robot
5a9edcec4c Merge "audio: Use the canonical direction port direction in ModuleUsb" 2023-05-02 17:43:28 +00:00
Mikhail Naganov
9be1cde261 Merge "audio VTS: Update PolicyConfig after AudioPolicyConfig" 2023-05-02 16:34:46 +00:00
Shunkai Yao
dd6ec5291a Freeze Audio AIDL interfaces
Fix Visualizer and Volume type UUID

Bug: 279432911
Test: m
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I3e7d145aa37fb67d78cf05c06da22f74c0ea07ad
Merged-In: I3e7d145aa37fb67d78cf05c06da22f74c0ea07ad
2023-05-02 00:55:22 +00:00
Mikhail Naganov
64fd6bd779 audio: Use the canonical direction port direction in ModuleUsb
Instead of relying on the device type, use the 'AudioPort.flags'
field to determine the device direction.

Remove 'isUsbInputDeviceType' and 'isUsbOutputtDeviceType'
as they are too specific to particular device type and just
add a maintenance burden.

Bug: 266216550
Test: m
Change-Id: Ia1b9330c2b419a1a4048ed78d914d05c1caf523f
2023-05-01 13:34:51 -07:00
Mikhail Naganov
33a35b5ffb audio VTS: Update PolicyConfig after AudioPolicyConfig
Make necessary changes to use updated AudioPolicyConfig class.

Bug: 205884982
Test: m VtsHalAudioV6_0TargetTest
Test: atest HalAudioV6_0GeneratorTest
Change-Id: Iced9d665d018853c4b2a50f4471a545af7bf60bb
2023-05-01 13:24:05 -07:00
Jiabin Huang
cf210c83b2 AHAL: add more comment for IModule.disconnectExternalDevice
Bug: 277955540
Change-Id: I0d6a73884ab4bcfec62da45124024e8680155144
Test: TH
2023-04-27 23:06:57 +00:00
Treehugger Robot
fe4b88ab73 Merge "Add EventFlag for effect HAL thread processing" 2023-04-13 16:57:44 +00:00
jiabin
768c6f94d6 AHAL: use PCM_FORMAT_INVALID as the termination of format array.
Bug: 266216550
Test: make
Change-Id: Ibe2056eb4fdecb14c3e25daa3dbdd769d6433136
2023-04-12 23:46:55 +00:00
Shunkai Yao
41888a2f07 Add EventFlag for effect HAL thread processing
Bug: 261129656
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit

Change-Id: Ibe6052a8c2a182b33e6fe727b8606431dd2f5355
2023-04-11 00:10:50 +00:00
Mikhail Naganov
7b2d12b1f7 audio: Clarify profiles management for external devices
Clarify what should happen to mix port profiles after
connection of an external device. Add a test to verify
this behavior.

Also, add an XML file for the test runner for
VtsHalAudioCoreTargetTest.

Bug: 273252382
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I3381dd29c5922bf31fa3a8ae6fa273597e8333a1
Merged-In: I3381dd29c5922bf31fa3a8ae6fa273597e8333a1
2023-03-30 20:32:00 -07:00
Mikhail Naganov
d5536d9ac6 audio: Add some utility methods, improve logging
Add 'isDefaultAudioFormat' to Utils.h.

Print the module type in 'setModuleDebug'.

Align 'suggestDeviceAddressTag' with framework code.

Bug: 273252382
Test: m
Change-Id: I0248d2e866522a63a745d4af6132b7d2b6a01564
Merged-In: I0248d2e866522a63a745d4af6132b7d2b6a01564
2023-03-30 20:32:00 -07:00
Treehugger Robot
d14815472d Merge "DynamicsProcessing: Validate config params based on ranges advertised" 2023-03-30 04:03:07 +00:00
Treehugger Robot
a4ccb03efd Merge "Add utils for checking range limits of effect config params" 2023-03-29 03:38:28 +00:00
Ram Mohan
afdf90b679 DynamicsProcessing: Validate config params based on ranges advertised
Bug: 272195502
Test: atest VtsHalDynamicsProcessingTargetTest

Change-Id: I05233c1e56cc35c4936f0a36e92aaf7a12dda49f
2023-03-28 21:08:51 +05:30
Ram Mohan
9c47719bf7 Add utils for checking range limits of effect config params
Bug: 272195502
Test: Build

Change-Id: I1ff5af7d25e9410c58f323b6d12dbe6764e40073
2023-03-28 20:28:04 +05:30
Shraddha Basantwani
b76f5abdcb Audio : Fix ASAN crash in VTS test cases
Effect Helper should not try to access min/max values of a tag
when it is not defined.

Bug: 271912230
Test: atest VtsHalAECTargetTest.cpp (with ASAN enabled)

Change-Id: Idf47a521fbd594c83ab0fc21f2750673652b3aee
2023-03-27 17:18:18 +05:30
Shunkai Yao
ff16dd1f7b Merge "AIDL effect: Effect factory add EffectProxy information in proxy" 2023-03-24 22:54:11 +00:00
jiabin
fdee322c96 AHAL: fix StreamUsb crash.
1. By default, the DriverUsb should be standby. When there is data
   transfer request, it will exit standby.
2. Initialize alsa device profile before reading device info.
3. Open the alsa device proxy after the preparation succeed.

Bug: 266216550
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I1f0425036df176c52220320135079e7c98daa2d0
2023-03-22 22:16:13 +00:00
Jiabin Huang
b3602ca092 Merge "AHAL: fix USB HAL issues with reporting device capabilities." 2023-03-22 16:18:49 +00:00
jiabin
118c261010 AHAL: fix USB HAL issues with reporting device capabilities.
1. The card and device must be specified before reading device info.
2. Map PcmType::FIXED_Q_8_24 to PCM_FORMAT_S24_LE.
   Map PcmType::INT_24_BIT to PCM_FORMAT_S24_3LE.

Bug: 266216550
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ib48538d01bc980524e2c4c5b221f6d7e479beba6
2023-03-21 23:07:40 +00:00
Shunkai Yao
b1b8b68316 Merge "Update EffectUUID initialization" 2023-03-18 23:36:42 +00:00
Vlad Popa
429e51f4e7 Merge "CSD: rename get/setOutputRs2 to include upper bound" 2023-03-17 19:12:45 +00:00
Shunkai Yao
f8be1acde7 Update EffectUUID initialization
Avoid dynamic initialization global UUID variables

Bug: 271500140
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I7574c1fe1ba0aaff1d9d29a9eed10de1aef33806
2023-03-17 18:16:22 +00:00
Mikhail Naganov
1120ee5603 Merge "Update visibility of libaudioserviceexampleimpl" 2023-03-17 16:55:05 +00:00
Vlad Popa
4d7aa9279b CSD: rename get/setOutputRs2 to include upper bound
RS2 represents an interval of power levels. This is why it is clearer to
specify upper bound in the naming to make it clear that we refer to the
upper limit which when exceeded will trigger a momentary exposure.

Test: atest VtsHalAudioCoreTargetTest
Bug: 273961110
Change-Id: If4e065deeedb32c3e5e81caf4cd6924fb5815dc0
Merged-In: If4e065deeedb32c3e5e81caf4cd6924fb5815dc0
2023-03-17 02:57:47 +01:00
Mikhail Naganov
776e65e35f Update visibility of libaudioserviceexampleimpl
In order for vendors to be able to use this library
it needs to have public visibility.

Bug: 205884982
Test: m
Change-Id: Idd47c942ee1e97372047ec1b44bcd996d454e3e2
2023-03-15 09:29:16 -07:00
Xin Li
82e0eca1c4 Merge "Merge Android 13 QPR2" 2023-03-14 21:40:25 +00:00
Shunkai Yao
d30ff8fb80 Add some Effect type UUID and offload indicater in common parameter
Bug: 271500140
Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit
Change-Id: I61ebf268600564cb5abddc90979070b675a85541
2023-03-14 16:07:25 +00:00