Commit Graph

47 Commits

Author SHA1 Message Date
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
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
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
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
Shunkai Yao
2461891a1c Remove the limitation of max open streams
Bug: 295055755
Test: atest CtsMediaAudioTestCases
Change-Id: Ifc0bec23ccc2845657389783194eb18fcc7884fa
2023-08-24 18:14:03 +00:00
David Li
b089c0cfee audio: Fix remote submix module device ports handling
- remove the default address "0" for IN_SUBMIX and OUT_SUBMIX;
 - remove the profiles in the device port and assign profiles when
   connecting;
 - make remote submix input to use "virtual" connection type,
   same as the output;
 - fix ModuleConfig in VTS to avoid returning devices with virtual
   connections as "external devices" because they can actually
   be connected even when connection simulation is disabled;
 - fix TryConnectMissingDevice VTS test to disconnect the device
   if the operation has unexpectedly succeeded.

Bug: 286914845
Bug: 294976817
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ife11c9c356d1b5dc587d08cef47294e3b29f65c5
2023-08-10 14:37:31 -07:00
Mikhail Naganov
cf824f65c8 audio: Implement the major functionality of the primary CF HAL
Core HAL changes:

1. Add StreamPrimary implemented via StreamAlsa.

2. Align the configuration with the HIDL HAL.

3. Fix position retrieval vs. standby call.

4. Fix sleeps in StreamAlsa.

VTS changes:

1. Use several bursts for stream I/O test scenarios that check
   observable position increase. This is because the position may
   not be available until a couple of transfers have been made.

2. Do not require position increase for the scenarios that do
   not make several bursts. As specified above, the position may
   not have been increased for the ALSA case. Whereas, using
   multiple bursts in all scenarios will increase test time, and
   make the state machine transitions graph more complicated.

3. Hook up the test config file to shut down audioserver during
   VTS tests, fix the test config file.

Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Test: compare APM dumps for AIDL vs. HIDL
Change-Id: I85271564c664fa40008d60e82b32eaa66a99c68f
2023-08-07 13:38:50 -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
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
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
Treehugger Robot
7260130baf Merge "audio: Put audio/aidl/common/include/Utils.h into 'aidl' NS" 2023-03-10 22:31:37 +00:00
Mikhail Naganov
b4f8e67e1c audio: Add offload reconfiguration event to IBluetoothLe
Since BT LE can also have offloaded codecs, it might need
a reconfiguration event similar to the one that BT A2DP
receives.

Bug: 272658632
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I04fb7c99f0457f87e1f4aaf7e77165317163387b
2023-03-10 12:44:52 -08:00
Mikhail Naganov
872d4a6518 audio: Put audio/aidl/common/include/Utils.h into 'aidl' NS
These utilities are for types generated from AIDL. Since
the types end up in the 'aidl' namespace (NDK backend), it makes
sense to keep the utilities in the same namespace.

While changing the namespace, I've found numerous useless
includes of 'Utils.h' and removing them, also reorganizing
lists of includes along the way to match the style guide.

Bug: 205884982
Test: m
Test: atest --test-mapping hardware/interfaces/audio/aidl/TEST_MAPPING
Change-Id: Ib23b47092364046f632f9503b92b9baff5b902f5
2023-03-10 11:34:31 -08:00
Mikhail Naganov
b5647da1ad audio: Add IBluetoothLe
Similar to IBluetooth and IBluetoothA2dp interfaces,
IBluetoothLe controls the LE profile. This interface
replaces the following string parameter:

"LeAudioSuspended"

Bug: 270731693
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I9df28053cd270fc2d446ba9a8ada4dd6ab761c7b
Merged-In: I9df28053cd270fc2d446ba9a8ada4dd6ab761c7b
2023-03-08 09:28:00 -08:00
Mikhail Naganov
6f3474a98e audio: Add IStreamCommon.prepareToClose method
This method is needed to implement HAL modules that
are proxies for other subsystems, for example
the "bluetooth" and "r_submix" modules. This method
replaces string parameters "exiting=1" and "closing=true"
which the framework sends to streams prior to closing
them in order to unblock the I/O thread of the stream.

Bug: 270731693
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I3d13fe34535ab853c9f8237a08c31cdafadbb390
Merged-In: I3d13fe34535ab853c9f8237a08c31cdafadbb390
2023-03-07 09:41:08 -08:00
Mikhail Naganov
7499a00c04 audio: Add IBluetoothA2dp
Similar to IBluetooth interface which controls SCO/HFP,
IBluetoothA2dp controls the A2DP profile. This interface
replaces the following string parameters:

AUDIO_PARAMETER_A2DP_RECONFIG_SUPPORTED
AUDIO_PARAMETER_RECONFIG_A2DP
"A2dpSuspended"

Also, refactor fields used by Module implementation
for persistent child interfaces.

Bug: 270731693
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie62952c3bc3af2f53535d716e5b57bf48c661306
Merged-In: Ie62952c3bc3af2f53535d716e5b57bf48c661306
2023-03-01 13:29:29 -08:00
Mikhail Naganov
d150942aa7 audio: Add AudioOffloadMetadata and a method to update it
AudioOffloadMetadata contains the same information
as 'AUDIO_OFFLOAD_CODEC_*' framework parameters.
It is updated via a new method IStreamOut.updateOffloadMetadata
which only works for compressed offload streams.

Bug: 270731693
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I6c8a8853f216438284082f79e3f57e511a2a1f06
Merged-In: I6c8a8853f216438284082f79e3f57e511a2a1f06
2023-02-28 19:26:14 +00:00
Mikhail Naganov
248e950798 audio: Accept I/O handle for mix ports from the client
The client can pass the I/O handle to the HAL as part of
the requested audio port config. The HAL can store that handle
and use it as a cookie to match the port config with other HALs
(for example, SoundTrigger).

Updated behavior of IModule.setAudioPortConfig to copy
the handle for mix ports, and pass it back with the applied
config. Enforced this behavior in VTS.

Bug: 269551518
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ibc3f9eea4169610f1680937c764de42b4fe5194a
2023-02-21 16:39:58 -08:00
Treehugger Robot
4cf91c5144 Merge "audio VTS: Consider device connection for external device address" 2023-02-16 23:20:17 +00:00
Mikhail Naganov
4590949e12 audio VTS: Consider device connection for external device address
When generating an address for an external device, consider
the connection type and choose the appropriate variant of
the AudioDeviceAddress struct.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ic791ba7de80e482c7e721e082fc9678f0f564b62
2023-02-15 18:28:41 -08:00
Mikhail Naganov
6725ef536b audio: Move Microphone[Dynamic]Info structs from core
These parcelables are also used by the framework.

Bug: 263964254
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ib30b69c325040e474fb58a8e7e515912fccab4c7
Merged-In: Ib30b69c325040e474fb58a8e7e515912fccab4c7
2023-02-15 10:15:42 -08:00
jiabin
b76981e2a7 Add interfaces to query aaudio hardware information.
Add interfaces to query aaudio hardware information. The new interfaces
are supposed to replace the system properties. The information includes
aaudio mixer burst count and aaudio hardware burst minimum usec.

Bug: 193275465
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Id3442dae15937baba84f053f2e244bc294f4d718
2023-01-19 18:06:22 +00:00
Treehugger Robot
91ca65c35c Merge "audio: Add supportsBluetoothVariableLatency API to IModule" 2023-01-19 10:08:36 +00:00
Mikhail Naganov
5f477d864b audio VTS: Limit mix ports that route to attached devices
In tests that do not request and activate simulation of
connection of external devices, limit the mix port query to
return ports that can be routed to attached device ports only.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I7e77b269c07b763a5080f42ebf7ec7d0fcaee195
2023-01-17 15:34:25 -08:00
Eric Laurent
e2432ea1a7 audio: Add supportsBluetoothVariableLatency API to IModule
Add API to query if the Module supports control of variable latency over
playback paths.

Bug: 197823000
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I3a08d682a1a639d8373869725e12702fff962d53
2023-01-16 11:32:02 +01:00
jiabin
9a8e686628 Add API to query mmap policy information.
Bug: 193275465
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I8374a6e7942d68259d820b5de1f4ec597f1b6473
2023-01-13 22:57:34 +00:00
Mikhail Naganov
04ae822302 audio: Remove android.hardware.audio.core.AudioMode type
I missed that there is already android.media.audio.common.AudioMode.
However, due to use by the framework, it contains more values
(all of them are SYS_RESERVED), thus the implementation and VTS
have to be updated as well.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If260413b1f774a69514de978792d5ad2eb46481a
Merged-In: If260413b1f774a69514de978792d5ad2eb46481a
2023-01-12 17:42:02 +00:00
Mikhail Naganov
194daaac57 audio: Allow going to 'IDLE' for synchronous drain
For small buffers, the driver can perform draining
synhronously, returning control to the HAL only after
the buffer is empty. This makes going through
the 'DRAINING' state artificial. Thus, we allow going
to the 'IDLE' state directly.

In order to make sure that VTS handles both transitions:
to 'DRAINING' and to 'IDLE', correctly, add an "AOSP as
vendor" parameter "aosp.forceSynchronousDrain" to induce
this behavior in the default implementation.

Bug: 262402957
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ic8eaee53cb4596afb5317b4b905e004af3f112aa
2023-01-06 19:43:14 +00:00
Mikhail Naganov
20047bc1d9 audio: Improve test coverage
Add a vendor-specific parameter "aosp.forceTransientBurst"
which helps to cover the case of non-full async writes.
This parameter is specific to the "AOSP as vendor" implementation,
other vendors are not required to have it—that's why it's
not in AIDL.

Fix minor issues in VTS found after revisiting the code, and by
looking at logs during testing.

Bug: 262402957
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ide961d91a8d9da24392561654f04eb8207b7b781
2023-01-06 19:43:13 +00:00
Mikhail Naganov
4e699bd94f audio VTS: Refactor support for non-deterministic SM behavior
Use a DAG instead of a list for representing stream state machine
transitions. This allows accomodating multiple possible replies
from the stream state machine, and enables following different,
possibly converging test sequences depending on actual replies.

Update the async output state machine graph including possible
state transitions that are implemented but were missing from the
graph.

Bug: 262402957
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie97f3ce9222eec812d4eb4dfbce1f678370bef26
2023-01-06 19:43:13 +00:00
Mikhail Naganov
10c6fe2b8f audio: Add IBluetooth core interface
This interface corresponds to BT-specific functions
of the IPrimaryDevice in the HIDL HAL.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I5f52d65e06f42e1a5fb2e51d27b79e94fe423eaa
2023-01-03 18:23:33 +00:00
Mikhail Naganov
0f8849795f Merge "audio: Implement ITelephony core interface for telecom" 2023-01-03 18:10:13 +00:00
Treehugger Robot
65cec4b4db Merge "audio VTS: Make checks for supported methods more consistent" 2022-12-28 22:04:29 +00:00
Mikhail Naganov
1576a58757 audio VTS: Make checks for supported methods more consistent
Fix the issue pointed out by gkaiser@ on aosp/2256190.
I also went over other usages the logic which checks for
methods support, and made the code more consistent.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I1b06c1fd9dddcbdadfd6e04525493a049283f31f
2022-12-28 20:56:32 +00:00
Vlad Popa
2afbd1e549 Refactor the ISoundDose.aidl interface
This refactoring is fixing the hal_implementation_test workaround from
aosp/2363076. Adjusted the package name to match the aidl_interface and
declared the ISoundDose interface types only.

Test: VtsHalSoundDoseFactoryTargetTest, VtsHalAudioCoreTargetTest,
hal_implementation_test
Bug: 263388737

Change-Id: Ibce4cd95aaf600de2096179f137243939114ba6a
Merged-In: Ibce4cd95aaf600de2096179f137243939114ba6a
2022-12-28 18:01:01 +01:00
Mikhail Naganov
a7f4e05357 audio: Implement ITelephony core interface for telecom
Implement telecom functions in ITelephony corresponding
to the IPrimaryDevice in the HIDL HAL.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia83fa4341dd50919d885ac1e10fb31c9a30c5a86
2022-12-27 20:30:03 +00:00
Mikhail Naganov
7492720e49 audio: Add presentation and latency control to IStreamOut
Add the following methods to IStreamOut:
  - get/setAudioDescriptionMixLevel;
  - get/setDualMonoMode;
  - getRecommendedLatencyModes/setLatencyMode;
  - get/setPlaybackRateParameters;
  - selectPresentation.

Add IStreamOutEventCallback interface for async notifications
of the client about playback-related events. This callback
can be provided to IModule.openOutputStream.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I8974102d232cdd121a53edccbf26c33778a94e5e
2022-12-23 02:22:38 +00:00
Treehugger Robot
6109a9c6bf Merge "audio VTS: Exclude '1' from 'invalid' buffer size list" 2022-12-20 05:16:16 +00:00
Mikhail Naganov
5659221d4c audio VTS: Exclude '1' from 'invalid' buffer size list
This affects AudioStream{In|Out}.OpenInvalidBufferSize test.
Leave only values that are obviously invalid.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I148b823761175959a1cf658599c038378ac4b116
2022-12-19 20:07:05 +00:00
Mikhail Naganov
fb1acdec67 audio: Add effect attachment to devices and streams
Add the following methods:
  - IModule.{add|remove}DeviceEffect;
  - IStream.{add|remove}Effect.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I4066e2d10a8e08d634010cfe9eb8f832157e725f
2022-12-19 17:23:30 +00:00
Mikhail Naganov
383cd4277a audio: Add methods for controlling hw volume
Add the following methods:
 - IStreamIn.get/setHwGain;
 - IStreamOut.get/setHwVolume.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I8fc48c15a9211b5f0bf8bb4b5b0e50d414b859c2
2022-12-16 22:19:32 +00:00
Mikhail Naganov
8230457989 audio: Fix streamCommon nullptr check in VTS
Fix test code in AudioStream#GetStreamCommon test.
Avoid crashing if the HAL module returns a null
IStreamCommon instance pointer.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I118ea1df49a127780a901479cf8cd5787be601f7
2022-12-16 22:19:32 +00:00
Mikhail Naganov
e9f10fc9dc audio: Provide operations common to input and output streams
Introduce IStreamCommon which contains methods that apply
both to input and output streams. Move the 'close' method
to it. Add 'IStreamIn/Out.getStreamCommon' method to retrieve
the common interface.

Add methods for dealing with HW AV Sync and vendor parameters.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie1a7b32e28425f5398afc95192fcbc5403b5c332
2022-12-16 16:40:28 +00:00
Vlad Popa
943b7e2b91 Add default implementation and VTS for ISoundDose
The ISoundDose HAL interface is used for reporting the sound dose
relevant information from/to the HAL. This is necessary for all devices
that certify with the IEC62368-1 3rd edition and EN50332-3 standard
for safe hearing.

Bug: 248567177
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ib89e09243a01cebc2f7996b6b572384a1471867a
Merged-In: Ib89e09243a01cebc2f7996b6b572384a1471867a
(cherry picked from commit 83a2146546)
2022-12-15 19:41:32 +00:00
Mikhail Naganov
c8e4312da8 audio: Bring default HAL configuration closer to cuttlefish
This is to simplify switching of cuttlefish to
the AIDL implementation. Split out 'r_submix' module.

Add all IModule instance names to the compatibility
matrix.

Bug: 205884982
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I424db14257281671eea87aa743deb778ca75f388
2022-12-13 01:17:55 +00:00
Lorena Torres-Huerta
aff8a1f8fd VTS for IConfig getEngineConfig
Bug: 242678729
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I051d0778bbad447e49dd4b99a2797333d0d67862
2022-12-12 19:34:39 +00:00