Commit graph

2327 commits

Author SHA1 Message Date
Mikhail Naganov
af75a679c9 Revert "audio: Parse module configurations from the APM XML files"
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: I0076c88877943d9498f90c477e78a2be5d390150
2023-10-13 23:38:25 +00:00
Mikhail Naganov
5eea7fb0d7 Revert "audio: Populate MicrophoneInfo with vendor data"
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: I01a4d22056507f9047c4fead21c9a75bfa153a46
2023-10-13 23:38:25 +00:00
Mikhail Naganov
006a136ea7 Revert "audio: Set connectedProfiles for non-attached device ports."
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: Id325171baeabd61d244e5f15c37f7d14402bd426
2023-10-13 23:38:25 +00:00
Mikhail Naganov
567d0de485 Revert "audio: Use hardcoded r_submix configuration with XML"
Revert submission 2770886-AidlAudioHalModuleConfig

Reason for revert: Breaks BluetoothInstrumentationTests on main downstream

Reverted changes: /q/submissionid:2770886-AidlAudioHalModuleConfig

Bug: 305291602
Change-Id: I7f51ab94f5d42ac052e9900ddd0cc69a33856820
2023-10-13 23:38:25 +00:00
Mikhail Naganov
ea604d50de audio: Use hardcoded r_submix configuration with XML
There are several reasons why parsing the canonical XML
configuration for the remote submix module will not work
correctly (see the commend in the code).

Since de facto all vendors use the canonical configuration
XML for the remote submix, substitute parsing it with
a correct hardcoded version.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Iddebf9baa73e8dc90ada1c9b1783c513abb59420
2023-10-11 19:38:49 -07:00
Lorena Torres-Huerta
a29393db39 audio: Set connectedProfiles for non-attached device ports.
For external (non-attached) device ports that have dynamic
profiles, 'connectedProfiles' must be provided. They are
used when 'ModuleDebug.simulateDeviceConnections' is enabled.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ic82e47abc50e2958ed93f5d4d18082b569ecb67b
2023-10-11 19:38:12 -07:00
Lorena Torres-Huerta
dc9d1a4b42 audio: Populate MicrophoneInfo with vendor data
Added a virtual method Module::getMicrophoneInfos
so that vendor implementations can provide actual
data about device microphones. This information
is not part of the APM config file.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTestTest
Change-Id: I4b650ae221ba866421bbf8500ad8c17f04bc4aa7
2023-10-11 19:36:38 -07:00
Lorena Torres-Huerta
00a7307862 audio: Parse module configurations from the APM XML files
The default implementation now loads the HAL configuration
from the legacy XML configuration file which was previously
consumed by the framework directly.

Note that errors in the config file will lead to crash
of the XML parser, pointing out to the source of the problem.

IMPORTANT NOTES:
  - Never use untested legacy config files with production
    devices.
  - Make sure that all possible configurations (for example,
    BT offload on/off) are tested.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I01e4cd77a284d7df64ecb0c0b21cb16abfa0f6c5
2023-10-11 18:31:25 -07:00
Mikhail Naganov
e3dcd057d9 Merge "audio: Allow "dynamic" profiles for device ports" into main 2023-10-11 17:32:22 +00:00
Mikhail Naganov
84bcc049e6 audio: Allow "dynamic" profiles for device ports
Some device ports are connected via ADSP which takes care
of the actual audio configuration (format, channels, SR),
for example the built-in speaker and mic ports, as well
as some external devices like analog headsets.

In the legacy implementation, such device ports did not have
any profiles specified. Allow the same behavior in the AIDL
implementation. To ensure correctness, device ports with no
profiles must be routable to mix ports that have profiles
specified. This requirement is fulfilled in legacy configs.

Bug: 266124463
Test: atest VtsHalAudioCoreTargetTest
Test: atest audiosystem_tests audiorouting_tests
Test: atest CtsMediaAudioTestCases
Change-Id: Iaccd1e8ef2a5af9a5f8bae453905d01c6b7fdc28
2023-10-10 15:15:50 -07:00
Mikhail Naganov
81b8fb2841 audio: Set 'maxOpenStreamCount' to unlimited for input ports am: 8dbc51158f
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2768032

Change-Id: I0f917bd3a39d08659e7b6d9c49ea4cc03f7c2db6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-02 23:58:05 +00:00
Mikhail Naganov
8dbc51158f audio: Set 'maxOpenStreamCount' to unlimited for input ports
Since libaudiohal@aidl reports that the most current legacy C API
version is supported by the HAL, the audio server uses a different
logic for telephony scenarios than for the HIDL HAL. This involves
opening more streams on the same mix port. Allow opening
an unlimited number of streams. However, keep the number of active
streams to be `1`.

Bug: 302132812
Test: atest CtsMediaAudioTestCases --test-filter=".*AudioNativeTest.*"
Test: atest CtsMediaAudioTestCases --test-filter=".*CallAudioInterceptionTest.*"
Change-Id: I896398fca73f28d28d9397d00751394c969531b4
2023-10-02 15:19:03 -07:00
Mikhail Naganov
63d294c196 Merge changes I7df6e323,I0e3412b9 into main am: 0da62dd023
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2767897

Change-Id: I5def5e9262b8dfec9131f2d2bd184634956e6aae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-02 19:56:23 +00:00
Mikhail Naganov
0da62dd023 Merge changes I7df6e323,I0e3412b9 into main
* changes:
  audio: Fix notification of streams of the device change
  audio: Fix update of an existing patch
2023-10-02 18:06:44 +00:00
Mikhail Naganov
89a8ea964d audio: Fix notification of streams of the device change
Replace the incorrect logic which was considering each
port individually with the correct logic which considers
a connection of a mix port to device ports.

Bug: 302573756
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I7df6e32315945897d88923ea4d9744e590e85dfd
2023-09-29 17:05:23 -07:00
Mikhail Naganov
dc41773ba3 audio: Fix update of an existing patch
The code for updating the existing patch did not modify
the patch stored in the module's list of patches.

Added a test which switches the patch to another port
config and validates that 'Module.getAudioPatches' returns
the updated patch.

Bug: 302573756
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I0e3412b9387cd451436a48af116dc5a940d868cf
2023-09-29 17:05:13 -07:00
Treehugger Robot
35a06a8adc Merge "Audio : Add OpenInputMultipleTimes VTS for r_submix" into main am: afdfa1d079
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2762796

Change-Id: I466944898bbcc4e2c9b5e6f43994bee0a49b6b0e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-28 21:43:47 +00:00
Treehugger Robot
afdfa1d079 Merge "Audio : Add OpenInputMultipleTimes VTS for r_submix" into main 2023-09-28 20:53:33 +00:00
Shraddha Basantwani
21980e5196 Audio : Add OpenInputMultipleTimes VTS for r_submix
Bug: 286914845
Test: atest AudioModuleRemoteSubmix

Change-Id: I8ae78db42274d8e17408ad6d5300cda7de134985
2023-09-28 07:20:30 +00:00
Mikhail Naganov
a4998f64cd Merge "audio: Align Module::getMmapPolicyInfos behavior with legacy" into main am: b9c4bd4ea5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2763851

Change-Id: I2d35697637c6a8ff08eecd48b5dd44faae11bfc1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-27 21:49:37 +00:00
Mikhail Naganov
8506491475 audio: Align Module::getMmapPolicyInfos behavior with legacy
When there are no device ports supporting MMAP,
Module::getMmapPolicyInfos have to return 'Policy::NEVER'
so that the AAudio code does not attempt to use
the AAudio service. This aligns with the use of sysprops
by the HIDL implementation.

Update AudioCoreModule#GetMmapPolicyInfos test to use
the same logic for determining MMAP support as the framework
uses.

This makes CtsNativeMediaAAudioTest cases passing with
the AIDL HAL on Cuttlefish.

Bug: 302049825
Test: atest VtsHalAudioCoreTargetTest
Test: atest CtsNativeMediaAAudioTest [w/AIDL enabled on CF]
Change-Id: Ie58c408f6f648a8a03b6a5d92118b90061389c50
2023-09-26 17:20:58 -07:00
Mikhail Naganov
4991074eba Merge "audio: Fix connection between alsa_device_profile and _proxy" into main am: f69e0b6795
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2760046

Change-Id: I1203693e0bd17f89326b99b7ff60c4fea75809d1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-25 17:11:27 +00:00
Mikhail Naganov
f69e0b6795 Merge "audio: Fix connection between alsa_device_profile and _proxy" into main 2023-09-25 16:00:00 +00:00
Treehugger Robot
b616f1844b Merge "audio: Fix Effect worker thread" into main am: 542110eebe
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2757106

Change-Id: I61aa81f240dac4184c1600b624b4f8d27756ef6e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-22 17:16:53 +00:00
Treehugger Robot
542110eebe Merge "audio: Fix Effect worker thread" into main 2023-09-22 16:40:06 +00:00
Mikhail Naganov
5d2bfbac33 audio: Fix connection between alsa_device_profile and _proxy
alsa_device_proxy keeps a pointer to alsa_device_proxy,
but does not own it. Thus, the lifetime of the proxy must
be no less than of the proxy. In the legacy USB HAL impl
they were stored together (struct alsa_device_info).
Implement an equivalent class (DeviceProxy) in ALSA utils.

Bug: 264712385
Bug: 298712227
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I4e36701752afb3f35664b6f2ad1acda5719be1ea
2023-09-21 17:44:54 -07:00
Shunkai Yao
dcfc268767 Merge "Effect AIDL: correct some code format" into main am: 697e3f89a7
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2757992

Change-Id: Ie617eee8dbf3eda1c2c90d4014d1fe0a0e359d79
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-21 21:23:33 +00:00
Shunkai Yao
8771cecb99 Effect AIDL: correct some code format
Bug: 300735428
Test: atest VtsHalAudioEffectTargetTest
Change-Id: Ic4c925ea14e08418e56ad108468f61b049280f70
2023-09-21 17:58:42 +00:00
Jaideep Sharma
632b1cd048 audio: Fix Effect worker thread
When a effect is closed and reopened from framework,
mExit and mStop states are not reset,that causes
threadloop to exit and eventually blocks framework
as FMQs are never filled from effects HAL.

Reset the state of mExit and mStop on every time when
thread is created, so open->close->open kind of
scenarios can be handled.

Bug: 301214647
Test: run vts-hal-audio

Change-Id: If54c8fa62827e5f28e620dd841d638028149b1b8
2023-09-21 03:11:00 +00:00
Treehugger Robot
c39ed27778 Merge "Effect AIDL: Skipping vts test case if its not supported by effect" into main am: 4f2a709416
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2755205

Change-Id: Iabf41d3f3b8ad56a106da445fcf613788d142e63
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-20 17:38:17 +00:00
Treehugger Robot
4f2a709416 Merge "Effect AIDL: Skipping vts test case if its not supported by effect" into main 2023-09-20 16:57:23 +00:00
Shunkai Yao
92cd748451 Effect AIDL: Skipping vts test case if its not supported by effect
Check audioModeIndication/audioSourceIndication/volume flags and only
test if they are supported

Bug: 300735428
Test: atest VtsHalAudioEffectTargetTest
Change-Id: I539b408fcdb73c25984ec8f39b401475a3ccab69
2023-09-19 21:31:22 +00:00
Treehugger Robot
cb1900c8a7 Merge "audio: Match the r_submix configuration to the legacy impl" into main am: 65747f7ccb
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2755271

Change-Id: I480ad6a21f409bdbe86096ee38916ed6e4ba2c1d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-19 01:51:28 +00:00
Mikhail Naganov
21d4b9608a audio: Match the r_submix configuration to the legacy impl
The legacy configuration was interesting because although the
xml config file only listed 48000 Hz SR and
AUDIO_CHANNEL_OUT_STEREO channel mask, the implementation
allowed a range of SRs and MONO channel mask. The framework was
liberally allowing requests for other SRs to go to the r_submix
HAL, even without having them listed in the xml config
file. However, since libaudiohal@aidl is more strict in matching
configuration requests to port capabilities, we need to list all
channels masks and SRs suported by the legacy HAL explicitly.

However, we need to limit the amount of profiles to avoid
extra load when passing them via AudioPolicyService.listAudioPorts,
thus remove other PCM types.

Also, to match the hard limit on the number of routes in the legacy
implementation, set "maxOpen/ActiveStreamCount" for mix ports.

Bug: 286914845
Bug: 300990644
Test: atest VtsHalAudioCoreTargetTest
Test: atest android.media.audio.cts.AudioPlaybackCaptureTest
Change-Id: I4a8c7d016662d92ab5e73bc67d94aaac6570e59a
2023-09-18 17:35:52 -07:00
Mikhail Naganov
f494fb43a9 Merge "audio: Improve testing of point-to-point connections" into main am: 049a82e5d9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2753112

Change-Id: I2bd9cef92786b85abe73d6092ea6960ec8c27d91
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-18 17:06:02 +00:00
Mikhail Naganov
fe47b00628 audio: Improve testing of point-to-point connections
Point-to-point connections (analog, HDMI, SPDIF) do not use
a device address. Reflect that in `GenerateUniqueDeviceAddress`.
Add an analog headset into the test configuration.

Bug: 300648357
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Id1d0b1b60df40c2474fe3151067152b8e0a261c3
2023-09-15 18:58:17 -07:00
Mikhail Naganov
e3b1829528 Merge "audio: Fix handling of external devices disconnection" into main am: a39e854ef5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2751285

Change-Id: I3a293e643158e46881c8e574dc3ef38682a736a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-14 20:43:59 +00:00
Mikhail Naganov
0e128dd3fe audio: Fix handling of external devices disconnection
A mix port can be patched to multiple connected device ports. Thus, when
disconnecting an external device and removing the connected port, the
profiles of the mix port can only be cleared iff there are no more
connected device ports patched to it, and it did not have profiles prior to
connection of the first device.

Enhanced VTS tests to catch this problem in the HAL implementations. Also,
ensure that audio ports and audio routes do not change after the test
finishes. This ensures that tests can't affect each other.

Bug: 298175108
Test: atest audiosystem_tests
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia666b874958fb260513fc2b8cd20a823953ec679
2023-09-13 19:41:46 -07:00
Tomasz Wasilczyk
7ccd2acee4 Merge "Don't depend on String8 cast to C string [audio]" into main am: ecc3e1af82
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2748354

Change-Id: Icd46864cc50f72142d6c2962e84d67f5807420b4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-13 19:39:37 +00:00
Tomasz Wasilczyk
ecc3e1af82 Merge "Don't depend on String8 cast to C string [audio]" into main 2023-09-13 19:00:43 +00:00
Treehugger Robot
7a47d43c4b Merge "AHAL: fix stack overflow when connecting usb device." into main am: d105a13b24
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2748878

Change-Id: Ie7cba8d772f12c8eccbb57fed1010f2349d97a75
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-13 18:00:55 +00:00
Tomasz Wasilczyk
98d280bc29 Don't depend on String8 cast to C string [audio]
Bug: 295394788
Test: m checkbuild
Change-Id: I73acbfad6da4f18566f6b11889e83679deeaa2b8
2023-09-13 04:22:00 +00:00
jiabin
3580f42df4 AHAL: fix stack overflow when connecting usb device.
Bug: 300146600
Test: manually
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1e467c28493e6306dc48d5822db8ea7cc7d28fbc)
Merged-In: Ic904a5f9d4d61a2b7dc896ed593c12da4793f1cb
Change-Id: Ic904a5f9d4d61a2b7dc896ed593c12da4793f1cb
2023-09-12 23:11:16 +00:00
Mikhail Naganov
6695dae23c Merge "audio: Mitigate double receiving of the "exit" command" into main am: f0ffa20975
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2748875

Change-Id: I2658ef61f0e395fe43952912c8a9cdd5117ce255
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-12 22:51:03 +00:00
Mikhail Naganov
f0ffa20975 Merge "audio: Mitigate double receiving of the "exit" command" into main 2023-09-12 21:41:40 +00:00
Mikhail Naganov
f9c141dfb6 Merge changes I19a08bf2,Ibab914e5 into main am: 63f2d84e68
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2731393

Change-Id: I79dc596b022d69ac6519328ebc19d4660de1c770
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-12 21:16:41 +00:00
Mikhail Naganov
63f2d84e68 Merge changes I19a08bf2,Ibab914e5 into main
* changes:
  Audio : Add 3 VTS test cases for remote submix module
  r_submix : Fix minor issues in AIDL implementation
2023-09-12 20:37:33 +00:00
Mikhail Naganov
0e7bcae462 audio: Mitigate double receiving of the "exit" command
In rare cases, a worker thread from a new stream created
via StreamSwitcher can read again from the command FMQ
the "exit" command which was sent to the worker of
the previous stream.

The underlying reason for that has to be investigated.
For now, mitigate the issue by salting the cookie of
the "exit" command with the worker's TID.

Bug: 300130515
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie7d2e847e8b39414ffd31afd64e32d4c9a292c03
2023-09-12 12:45:20 -07:00
Shraddha Basantwani
343db5e85e Audio : Add 3 VTS test cases for remote submix module
1. OutputDoesNotBlockWhenNoInput
2. OutputDoesNotBlockWhenInputStuck
3. OutputAndInput

Bug: 286914845
Test: atest AudioModuleRemoteSubmix

Change-Id: I19a08bf2bf39131a70a867280c758b5ef001c024
2023-09-12 16:40:06 +00:00
Shraddha Basantwani
95f9232923 r_submix : Fix minor issues in AIDL implementation
1. Update refinePosition for output stream
2. Add missing exitStandby on transfer
3. Add check for availableToRead in read functionality

Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ibab914e5e09474c2b55a6c64cc004ebc1bb6cb47
2023-09-12 05:43:18 +00:00