Commit Graph

140 Commits

Author SHA1 Message Date
Treehugger Robot
2c1e429d34 Merge "audio: Reduce the interval between BT proxy registration retries" into main am: 320ef27af2 am: 121dcebc4e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2933574

Change-Id: Iaa7c2b48609fe9a65b3fd35fa6a4f12f382886bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 01:12:46 +00:00
Mikhail Naganov
19de94764d audio: Reduce the interval between BT proxy registration retries
A follow-up for aosp/2929441. The interval between retries
of connecting to BT proxy must be reduced significantly.
Otherwise, in situations when the BT is not connected
(that happens during tests), the resulting long delay causes
failures at the frameowork level due to resulting long
timeout.

Bug: 322820830
Test: atest audiosystem_tests --iterations 100
Change-Id: Idd84cb22b28d109151f98bb5883dca18a9ae928d
2024-01-29 13:40:27 -08:00
Mikhail Naganov
9db9570eec Merge "audio: Add retries for BT proxy port registration" into main am: 3552515d70 am: 2a3bc07b4e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2929441

Change-Id: I616fce4c978a0effecbcee05adadffde05f8d6f2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-29 18:37:33 +00:00
Mikhail Naganov
a5c0437327 audio: Add retries for BT proxy port registration
When ModuleBluetooth::createProxy is invoked on BT device
connection, the BT stack may not be fully ready yet,
and port registration can fail. This is an intermittent
state and registration should succeed after retrying.

Bug: 320838889
Test: atest pts-bot:A2DP/SRC/REL/BV-02-I
Change-Id: I0c7cf7c1c6a8ee03ef55b004f89139e3b56ee9cd
2024-01-26 16:19:45 -08:00
Treehugger Robot
dabe4a7902 Merge "audio: Fix handling of a thread exit command with a bad cookie" into main am: 759fb98667 am: 0ad71fd5fc am: 0e1a0a9328
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2908743

Change-Id: I73571a0d39b488d5aedd8162a4ffaa2cb673aef6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-13 03:30:37 +00:00
Treehugger Robot
759fb98667 Merge "audio: Fix handling of a thread exit command with a bad cookie" into main 2024-01-13 00:40:04 +00:00
Mikhail Naganov
1850779bc4 audio: Fix handling of a thread exit command with a bad cookie
In case when the command was sent by the HAL itself (from another
thread), the worker thread must not post a reply. The only case
when a reply needs to be posted is in the case when the command
was sent from a VTS test. This case is identified by the fact that
the cookie has value '0'.

Bug: 300181540
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ifeb0722b5cf7346a694c5a938f6b324f5fa825f1
2024-01-12 13:59:24 -08:00
Mikhail Naganov
3daa193aa1 Merge "audio: Improve logging in remote submix module" into main am: 198e8f747c am: 13993da38a am: b3d65cec6c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2901102

Change-Id: Iff8c545935a838b9ca593f2c0344042b115b2d90
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-10 21:12:38 +00:00
Mikhail Naganov
9eb3314a24 audio: Improve logging in remote submix module
Implement IModule::dump to display the current state in
the audioflinger dump.

Throttle repetitive logging when there is nothing to read.

Remove stale comment for already fixed b/307586684.

Bug: 307586684
Test: adb shell dumpsys media.audio_flinger
Change-Id: I1f1f6e1658d035d46af3a933a825b20a78c7f297
2024-01-09 14:13:15 -08:00
Vlad Popa
e32ffaec3b Merge "CSD: Adjust code to new MelCallback interface" into main 2024-01-09 17:17:32 +00:00
Vlad Popa
3ee7690028 CSD: Adjust code to new MelCallback interface
Added the attenuated bool to the callback interface. Not used

Test: trivial
Bug: 315218453
Change-Id: Ibd5e90b0537bfce7d01ee7a3a0e55bc53850a216
2024-01-04 01:53:41 -08:00
Mikhail Naganov
5f8f8cc16b Merge "audio: Fix the type used for timekeeping" into main am: e3ed739865 am: da3b33a4f4 am: 6178a82724
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2894924

Change-Id: I6dead6af17b8364d52548c5d73e0984e1341d18e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-04 02:38:49 +00:00
Mikhail Naganov
878afae8f8 audio: Fix the type used for timekeeping
On 32-bit builds, the 'long' type is 32 bit. Thus, it can not
be used to store the value returned from 'uptimeNanos'.

Bug: 318055805
Test: atest CtsMediaAudioTestCases
Change-Id: I4abf72415b7241728d3ddb1d11043dfd59a8d08a
2024-01-03 11:27:31 -08:00
Mikhail Naganov
e6612a500c Merge changes from topic "fix-aidl-mix-ports-and-bt" into main am: eafa78c929 am: 002c58fafd am: 78d8c4dd50
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2877679

Change-Id: I0e0869b0ad13637ee5c53a865a7a34ea13f5560d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-27 05:09:31 +00:00
Mikhail Naganov
d1e45d1bf5 audio r_submix: Suggest configuration from the peer am: 3b732895a8 am: de6a93d47d am: f48e129f55
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2886671

Change-Id: Icda9e4ef2cdd124e67222bf3401f722770a1179e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-27 05:09:26 +00:00
Mikhail Naganov
67bc25ca14 audio: Refactor configuration population am: a92039ac48 am: 8cb953b071 am: a667344e8c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2886670

Change-Id: Idf16a09027b4fb61d71c6f23cc620edf8264a1dd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-27 05:09:21 +00:00
Mikhail Naganov
a88cf60b87 audio: Fix BT AIDL HAL module implementation
In order to align with legacy behavior, when opening a stream,
the module must suggest the current configuration of the BT session.
For that to work, the BT device proxy must be opened prior
to creating a stream, code moved to ModuleBluetooth.

Fix minor inconsistencies and bugs found during testing.

Bug: 301213930
Bug: 316027906
Test: atest pts-bot
Change-Id: I04ddaf73be82f872a3f32a789563c3cbd648eb61
2023-12-26 16:34:58 -08:00
Mikhail Naganov
3b732895a8 audio r_submix: Suggest configuration from the peer
When there is a pipe established for a remote submix
device, suggest the configuration of the peer when opening
the other end.

Refactor SubmixRoute management to move it out from
StreamRemoteSubmix so that ModuleRemoteSubmix could also
use it.

Bug: 294962274
Test: atest audiorouting_tests
Change-Id: Ib31a662e7b65b92c614dc441a01160cae3485f3a
2023-12-26 10:31:43 -08:00
Mikhail Naganov
a92039ac48 audio: Refactor configuration population
In 'Module::setAudioPortConfig' allow subclasses to provide
their own suggested configuration.

In 'Module::populateConnectedDevicePort' provide the ID of
the device port instance that will be created as a result
of connecting an external device.

Also, expose 'ModuleDebug' flags to subclasses so that they
can know when device connections are simulated.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Iceb2bdeb61c3470554b592fe197efa54d3b9e578
2023-12-20 14:31:47 -08:00
jiabin
dd23b0e58e AHAL: add API to notify the HAL module about disconnecting device.
When external device is about to disconnect, the audio framework will
notify the HAL module about the coming device disconnection so that the
HAL module could abort any active read/write operations on drivers to
avoid problems with the HW interfaces.

Bug: 279824103
Test: atest VtsHalAudioCoreModuleTargetTest
Change-Id: I9f960b8ae5df11a764e70bd63f98c0f8b8386c34
Merged-In: I9f960b8ae5df11a764e70bd63f98c0f8b8386c34
2023-12-13 01:02:21 +00:00
jiabin
bc79ff19e8 AHAL: add API to notify the HAL module about disconnecting device.
When external device is about to disconnect, the audio framework will
notify the HAL module about the coming device disconnection so that the
HAL module could abort any active read/write operations on drivers to
avoid problems with the HW interfaces.

Bug: 279824103
Test: atest VtsHalAudioCoreModuleTargetTest
Change-Id: I9f960b8ae5df11a764e70bd63f98c0f8b8386c34
2023-12-12 17:44:28 +00:00
Mikhail Naganov
992921a9af Merge "audio: Fix remote submix module I/O timing and atomicity" into main am: 5260337cbb am: 73ddfafe34 am: bede03bbdf
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2855474

Change-Id: Ic6f8482082084dc5652218473f472a8371c984b5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-04 06:16:01 +00:00
Mikhail Naganov
0608545377 audio: Fix remote submix module I/O timing and atomicity
Similar to the primary module implementation, align the time
spent in the transfer operation with the duration of audio.

Change the read operation to ingest as much data as possible
during the audio burst duration.

Ensure that checking the existence of a SubmixRoute and adding
a new one is an atomic operation.

Minor improvements to avoid extra synchronization.

In the configuration, change the limit of max open streams to 10
to match the legacy implementation.

Bug: 302132812
Test: atest CtsMediaAudioTestCases --test-filter=".*AudioPlaybackCaptureTest#testPlaybackCaptureDoS"
Change-Id: Iccb6aaac46c039551c3d5f7760b1459168d9cfe5
2023-12-01 16:39:52 -08:00
Devin Moore
855a857014 Merge "Register bluetooth.audio in the audioservice AIDL example" into main am: 6504238fd7 am: 506464d703 am: 125806ada7
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2850408

Change-Id: I8cbe16fe22be353ffbf80fb72b35778bd88cea6b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 20:02:55 +00:00
Devin Moore
6504238fd7 Merge "Register bluetooth.audio in the audioservice AIDL example" into main 2023-11-29 18:15:31 +00:00
Devin Moore
0b2b93dccd Register bluetooth.audio in the audioservice AIDL example
android.hardware.bluetooth.audio should really be registered in its own
process, but this is a temporariy solution that is similar to the
old HIDL example.

Test: launch_cvd
Bug: 312265159
Change-Id: Ib60e2654d3b751bedf256d90de72921210174fe4
2023-11-29 00:13:18 +00:00
Mikhail Naganov
b6c97c04a3 Merge "audio: Adjust default impl for non-RT audio behavior of AVD" into main am: 8062a77307 am: 3bb96fe48b am: ccbb3e1ad7
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2836447

Change-Id: Ic8ea353189b17d77be70906fce8ebc1e0553f1a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-27 19:46:12 +00:00
Mikhail Naganov
6c419352c2 audio: Adjust default impl for non-RT audio behavior of AVD
The default implementation of the primary HAL is intended to
work with the AVD. Current implementation of virtualized audio
I/O on AVD falls behind actual hardware in terms of I/O timing.
This is not tolerated by CTS tests which are tailored for
real hardware.

Make the primary HAL implementation more resilient to irregular
ALSA read/write behavior on AVD by prolonging I/O time, or
skipping operations when falling behind expected time.

Bug: 302132812
Bug: 302587331
Test: atest CtsMediaAudioTestCases
Change-Id: Ia290d9541a8a0e22d28024f7930ef554396d63c6
2023-11-17 13:39:28 -08:00
Mikhail Naganov
6bb8fc76b2 Merge changes Ic51d603d,Ia50def0d,I22f65b8b,I8ce9f230,Id8455eb1, ... into main am: 3143e6930b am: 1afd920ac6 am: 5fde3c5693
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2811595

Change-Id: I02b9286f7b4d1702f3474094fdfbfdd8486a4e3a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-06 18:51:45 +00:00
Mikhail Naganov
55045b5fce audio: Clean up and fix the bluetooth HAL module
Fix the issue with retrieving BluetoothA2dp and BluetoothLe
instances access.

In 'Module::connectExternalDevice', always call
'populateConnectedDevicePort' to allow the module implementation
to cancel device connection.

Move frame count calculation into Utils.
Clean up includes and 'using' directives.

Bug: 302132812
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I22f65b8bcdcdd9bcd67a8290520eb4a465d4c720
2023-11-03 13:57:20 -07:00
Mikhail Naganov
1350187c6b audio: Provide a way for Module to specify nominal latency
The latency figure depends on the module implementation.
Instead of using a hardcoded value, each module should be
able to specify its own value. This value is then used
for calculating the minimum buffer size.

Set the nominal latency of the primary (CF) module to a high
value since the virtual device implementation fails CTS tests
if it attempts to pretend that it provides low latency.

Bug: 302132812
Test: atest CtsMediaAudioTestCases --test-filter=".*AudioTrackTest.*"
Test: atest CtsMediaAudioTestCases --test-filter=".*AudioRecordTest.*"
Change-Id: I8ce9f230378eea787c9b3c7ce3660c1e4e7bc895
2023-11-03 13:50:07 -07:00
Mikhail Naganov
2aab766d05 audio: Fix default remote submix HAL implementation and VTS
The implementation had duplicated code in 'transfer', which already
present in 'outWrite'.

Cleaned up delay calculations and logging.

Fixed the VTS to send 'prepareToClose' before attempting to join
the worker. Otherwise, the worker could be stuck on a blocking
operation due to inactivity of the other party and join would never
happen.

Bug: 302132812
Test: atest VtsHalAudioCoreTargetTest --test-filter="*AudioModuleRemoteSubmix*"
Change-Id: Id8455eb12d1d2999dc0bc7b64f0d70a61a177598
2023-11-03 13:49:59 -07:00
Mikhail Naganov
3c8b6ce171 CSD: Add default AIDL HAL implementation
** Partial upstream of ag/24854732. Only the interface part is
** included.

This should enable the sound dose gts on cuttlefish devices. The sound
dose HAL uses the internal MelProcessor to compute the MELs which are
reported to the framework.

Test: atest GtsAudioTestCases:SoundDoseTest
Bug: 301527435
Change-Id: Ifc505a0171bc8b4d3f5cf65d950fa5c0f812087f
Merged-In: Ifc505a0171bc8b4d3f5cf65d950fa5c0f812087f
2023-10-31 11:38:43 -07:00
Lorena Torres-Huerta
9bee81e56b audio: Set connectedProfiles for non-attached device ports. am: f7492518c7 am: 6788dcd1f8 am: abcc5cd2c8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2794108

Change-Id: Ia00d4ea2e89d6fcb2ab4436d0daca57957ce673c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-18 19:16:40 +00:00
Lorena Torres-Huerta
e6f63b2d4e audio: Populate MicrophoneInfo with vendor data am: 533cc78aab am: 3c0bd942f5 am: 87fe5c6ffa
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2794107

Change-Id: Ic91c67d2bfea0aa39caec0fb68c507a09a5338b3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-18 19:16:35 +00:00
Lorena Torres-Huerta
dc40dfd675 audio: Parse module configurations from the APM XML files am: 394e2527b5 am: 55acd0beaf am: e67e7a04f4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2794105

Change-Id: I81ba6bf19cf60d1c5360ef6b84abefe29b95fc2d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-18 19:16:24 +00:00
Lorena Torres-Huerta
f7492518c7 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
(cherry picked from commit a29393db39)
Change-Id: I69707d610c34f8f1eae9ef81768b76c40e985c0f
2023-10-17 19:54:29 -07:00
Lorena Torres-Huerta
533cc78aab 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
(cherry picked from commit dc9d1a4b42)
Change-Id: I3ea9ba8da79fd29f8d69c5a575a57851d73df7b8
2023-10-17 19:54:13 -07:00
Lorena Torres-Huerta
394e2527b5 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
(cherry picked from commit 00a7307862)
Change-Id: Id1002cb065e7cc19bdd520aca15b3fe5d39e5853
2023-10-17 19:48:24 -07:00
Mikhail Naganov
1261ff4f9b Merge changes from topic "revert-2770886-AidlAudioHalModuleConfig-FQCMWOWMCH" into main am: 03a2fbc6a3 am: fb1d459f09 am: 9868600b48 am: 9ed9a05578 am: 0cfcc0f2f9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2786757

Change-Id: I6b5a7c2db6ee69a63abc9897bb9c1716157f641e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-14 01:35:36 +00:00
Mikhail Naganov
4f8a121dd7 Revert "audio: Populate MicrophoneInfo with vendor data" am: 5eea7fb0d7 am: ca9d26dc44 am: ab0818f638 am: 96baf7e609 am: 40d47b9456
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2786756

Change-Id: I3ed92f5ac5acc7bc9a7d33dfc313f30bc81d2a1b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-14 01:35:32 +00:00
Mikhail Naganov
791a5d19b9 Revert "audio: Set connectedProfiles for non-attached device ports." am: 006a136ea7 am: bfe40ea2b0 am: 238ac10089 am: 21da9979f0 am: 3d8be4767a
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2786755

Change-Id: I4c2c62270787f883b86424c9c80d65fb03783b85
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-14 01:35:29 +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
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
Lorena Torres-Huerta
2e13df2cc7 audio: Set connectedProfiles for non-attached device ports. am: a29393db39 am: bc48f1dadd am: 14c5da7b45 am: b9457d840a am: 43fc2a8ee3
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2389654

Change-Id: Ibb797ee9a78ea8422c7c2fb9ba67e104d50d38ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 19:12:38 +00:00
Lorena Torres-Huerta
620db6886a audio: Populate MicrophoneInfo with vendor data am: dc9d1a4b42 am: 719170e066 am: ace5c10a4d am: 46d923debf am: 6b7c01e791
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2389656

Change-Id: I4234d8b63c55b5d70bd6f08ef235ff6e1d2bfc29
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 19:12:33 +00:00
Lorena Torres-Huerta
feba04d900 audio: Parse module configurations from the APM XML files am: 00a7307862 am: 8c04b54e05 am: e8f7b43dc6 am: 395beaa6e1 am: 99addf244e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2363149

Change-Id: I52ddf8fcec0930f465171fd134addac4f5d6c472
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 19:12:27 +00:00
Vlad Popa
66465ca3e6 Merge "CSD: Add default AIDL HAL implementation" into main 2023-10-12 21:42:31 +00: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