Commit graph

2277 commits

Author SHA1 Message Date
Shunkai Yao
a2c4af080a Merge "Avoid sub_overflow_minimal in AIDL effects VTS" into main am: 5348432dea
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2746173

Change-Id: Iadd6d3ccfda756700363562a2699cf7248e1cc8c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-08 22:06:41 +00:00
Shunkai Yao
5348432dea Merge "Avoid sub_overflow_minimal in AIDL effects VTS" into main 2023-09-08 21:38:08 +00:00
Mikhail Naganov
c3d0a2eb48 Merge "audio: Properly support external device port with static configs" into main am: 3401dae1ae
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2746297

Change-Id: Ib2232579276b47707a654f0619d38f897223423f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-08 18:06:28 +00:00
Mikhail Naganov
3401dae1ae Merge "audio: Properly support external device port with static configs" into main 2023-09-08 17:44:58 +00:00
Shunkai Yao
5ed80c5144 Avoid sub_overflow_minimal in AIDL effects VTS
Bug: 299385610
Test: atest VtsHalHapticGeneratorTargetTest
Change-Id: I1721fb87dd373a40453505733c8aaee647b4cf3b
2023-09-08 17:09:30 +00:00
Mikhail Naganov
fcf980e586 audio: Properly support external device port with static configs
External device ports might not have dynamic profiles, for example,
ports for BT devices. Properly handle this case in the default
implementation.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Test: atest audiosystem_tests
Change-Id: I8d4bcbf6ccf2ba05436e68e3ba94567fc7610eb7
2023-09-08 09:47:30 -07:00
Shunkai Yao
2ee2dade75 Remove unused file EffectWorker.h am: 5b8638c66c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2746174

Change-Id: I267d8552dffaa257eea1f20f2c68b91449e089bf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-07 21:20:04 +00:00
Shunkai Yao
5b8638c66c Remove unused file EffectWorker.h
Bug: 299213582
Test: m
Change-Id: I9ffd2e4e1cf1fbca69650eb101812db2ed3acc6f
2023-09-07 17:57:45 +00:00
Xin Li
879960bdce Merge Android U (ab/10368041)
Bug: 291102124
Merged-In: I7b6fffac2ada0e039f79bad8cc9b4d954e9c3460
Change-Id: I9466127d8d0fa38df36ca99f704853b2db871e67
2023-08-25 13:29:30 -07:00
Shunkai Yao
84cfecd616 Merge "Fix the audio source table in Processing" into main 2023-08-24 21:11:05 +00:00
Treehugger Robot
4115d8b01d Merge "Remove the limitation of max open streams" into main 2023-08-24 19:29:36 +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
Treehugger Robot
16012b6b06 Merge "Migrate String8|16.setTo to assignment operator" into main 2023-08-24 15:54:28 +00:00
Treehugger Robot
58d953e4be Merge "audio: Make IConfig.getSurroundSound default implementation more robust" into main 2023-08-23 22:31:08 +00:00
Tomasz Wasilczyk
17034e5f39 Migrate String8|16.setTo to assignment operator
Bug: 295394788
Test: make checkbuild
Change-Id: Ic98514f48399115046029e68883408090f0cd0db
2023-08-23 22:14:17 +00:00
Mikhail Naganov
1e25ef808f audio: Make IConfig.getSurroundSound default implementation more robust
In the case when there is a problem with the legacy APM XML file,
the converter provides a default surround sound config. However,
the default implementation of IConfig::getSurroundSoundConfig did
not take an advantage of that, and was returning an empty config,
which is not accepted by VTS.

Also, improve logging messages: clarify the situation when no readable
audio policy XML file found, and use outer functions name for lambdas.

Bug: 293978054
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Iae069a0498009605ef5ededb9c9112efab08548a
2023-08-23 14:18:27 -07:00
Treehugger Robot
ff0aae4132 Merge "Use String8/16 c_str [audio]" into main 2023-08-23 20:46:44 +00:00
Tomasz Wasilczyk
b20afc5f87 Use String8/16 c_str [audio]
Bug: 295394788
Test: make checkbuild
Change-Id: I9cba2d925dc1e5363927ba336b0ca2c43207ddad
2023-08-23 18:45:04 +00:00
Shunkai Yao
c1056947dc Fix the audio source table in Processing
Bug: 297158046
Test: atest VtsHalAudioEffectTargetTest
Change-Id: I7102608b945b92e7d66322bc94130aa965e471ea
2023-08-23 17:40:21 +00:00
Shunkai Yao
d3e5e33330 Merge "Update vts to align AOSP effects support requirement with CDD" into main 2023-08-23 15:34:13 +00:00
Shunkai Yao
9696741d0c Update vts to align AOSP effects support requirement with CDD
Bug: 296790934
Test: atest VtsHalAudioEffectFactoryTargetTest
Change-Id: I1c837125e62a083d95e279ed0584a9bccea3dcbd
2023-08-23 15:33:51 +00:00
Shunkai Yao
7816f26afa r_submix: keep the signed value for offset calculation in AIDL implementation
otherwise a negative offset will result in long sleep

Bug: 295055755
Test: atest android.media.audio.cts.AudioPlaybackCaptureTest
Change-Id: Ie941cc2525e3ea42b53106ae3a65242794b1dd1b
2023-08-22 20:50:31 +00:00
Treehugger Robot
7f2619ddff Merge "audio: Fix remote submix module device ports handling" into main 2023-08-19 03:53:26 +00:00
Tomasz Wasilczyk
fed7d54dfc Don't use String8::empty
With the current definition, it's an alias of default constructor. This
has very different meaning from std::string empty, especially that
static method String8::empty can still be called from instance context.

One of such bugs are present in in ParametersUtil.

Bug: 295394788
Test: make checkbuild
Change-Id: I9116a0c42a6a9e94116eaaaa0fd60568db428838
2023-08-17 13:53:55 +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
Treehugger Robot
ff1f1f3494 Merge "audio: Implement the major functionality of the primary CF HAL" into main 2023-08-08 07:56:05 +00:00
Mikhail Naganov
4bf6899cc7 audio: Ensure proper priority and scheduler for service threads
Change audio worker threads priority to ..._URGENT_AUDIO to match
the coupled thread in the audio flinger.

Set SCHED_FIFO scheduler for FAST threads (also to match AF fast
mixer/capture threads). In order to enable that, grand SYS_NICE
capability to the HAL service process and provide "getTid"
function in the StreamWorker class. For testing, add a "FAST"
output to the "stub" module in the HAL configuration.

Bug: 286914845
Test: atest libaudioaidlcommon_test
Test: atest VtsHalAudioCoreTargetTest
Test: adb shell ps -A -T -o PID,TID,NI,PCY,PRI,RTPRIO,SCHED,CMD
      for the HAL service process during VTS test. For regular
      "reader"/"writer" threads should see 'NI 19, PRI 38',
      for FAST "writer" should see 'NI -19, PRI 43, RTPRIO 3, SCH 1'
Change-Id: Iab7e21ebc139ff11cf9b7f4a1645960db8dadd43
2023-08-07 18:15:19 -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
459b7331e9 audio: Make renamings suggested by reviewers
Rename DriverInterface::getPosition -> refinePosition. This reflects
the fact that the driver may provide more precise position, however
this is an optional operation.

Rename StreamIn/Out::mContext -> mContextInstance. This is
to emphasize that StreamIn/Out actually own the context and they
hold the real context instance, not just a reference/pointer
to it, like other classes involved in the inheritance chain.

Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Id7159f9bf3ee020dc7cf594ec35f5d59d23d7e31
2023-08-03 10:31:12 -07:00
Mikhail Naganov
09d45c473e Merge "audio: Address comments from an internal review" into main 2023-08-03 15:58:56 +00:00
Mikhail Naganov
0faf339425 audio: Address comments from an internal review
Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I2f636c77f67fdd8eeac70dd304848bf7f76db4e5
2023-08-02 12:24:47 -07:00
Treehugger Robot
0bc307a5dd Merge "Audio r_submix : Handle the usecase when no data is available to read." into main 2023-08-02 18:51:53 +00:00
Treehugger Robot
169be3476d Merge changes from topic "bluetoothmodule" into main
* changes:
  aosp aidl bluetooth parameter support
  aosp aidl bluetooth audio hal implementation
2023-08-02 17:41:07 +00:00
Ram Mohan
18f0d5121a aosp aidl bluetooth parameter support
Bug: 228804498
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If1820018d5a6750eed0d0b486e15fc7c717aa11c
2023-08-02 21:42:01 +05:30
Mikhail Naganov
b03b5c4a06 aosp aidl bluetooth audio hal implementation
Bug: 228804498
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Id5fb60fe53ead9f5d2e6ecbb9988a23835cf2509
2023-08-02 21:42:01 +05:30
François Gaffie
acd4a677f0 Audio: add system usage to audio policy engine schemas
Bug: 293917986
Test: m

Change-Id: I49a8d3cfeb45eddc95ad6ab4a33b0adf0585cde2
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
2023-08-02 10:47:00 +02:00
Shraddha Basantwani
675cce24d6 Audio r_submix : Handle the usecase when no data is available to read.
Bug: 290116295
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ifd6706d593f890dd8ae148523a37177774c8ffd4
2023-08-02 05:19:24 +00:00
Shraddha Basantwani
2e460345a2 Audio r_submix : Replace usage of portId by device address
Use stream switcher to obtain device address for creation
of a remote submix stream.

Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I8dde3d59e488c9621dce78ffd5249254ecfc0b1a
2023-08-01 12:06:38 +00:00
Shraddha Basantwani
035beba203 Audio : Fix a few minor issues with stream switcher class
1. Constructor should forward variable arguments
2. mContext initialization was missing
3. Add nullptr check for addEffect and removeEffect methods

Bug: 264712385
Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I4037292bf497be186b26508bd16846886fa4fe55
2023-08-01 12:06:20 +00:00
Mikhail Naganov
43a85cfb2b audio: Add a helper class to simplify legacy HALs migration
Since in the C and HIDL APIs the method for opening a stream
receives the device to connect to, some legacy HAL implementations
took an advantage of that. In AIDL APIs device port connection
process is more dynamic and independent of the stream creation.

To simplify porting of legacy implementations to AIDL, a helper
class StreamSwitcher is added. It emulates the legacy behavior
by allowing to postpone the stream implementation creation until
the connected device is known. Until that moment, it exposes
to the client a stub implementation of the stream interface.

Bug: 264712385
Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ie8ae0338fd22f705e00a34e56a7fa235eda5ed9e
2023-07-24 16:40:39 -07:00
Mikhail Naganov
1eedc130e8 audio: Move frame counter to StreamContext
Moving frame counter to the StreamContext class enables
switching stream drivers on the fly while keeping the frame
count monotonically increasing.

StreamWorkerCommonLogic now holds a pointer to StreamContext,
which makes redundant storing copies of the fields of the latter.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: If6716f4051c484b52927cbfe4032df7c907eb3a5
2023-07-24 16:37:18 -07:00
Mikhail Naganov
780fefb331 audio: Update ChildInterface to set scheduler policy lazily
Since the client may end up never retrieving the interface
instance for sending it over Binder, postpone setting
of the scheduler policy to until that very moment.

Rename 'ChildInterface::getPtr' to 'getInstance' for clarity.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I31f9dd832c7f85f9632d1d389a8b1063d237d4c1
2023-07-24 16:36:51 -07:00
Treehugger Robot
12c4bf6ba1 Merge changes from topic "fix-b-264712385-primary-module" into main
* changes:
  audio: Move StreamContext ownership out from StreamCommonImpl
  audio: Use ChildInterface in StreamCommonImpl
  audio: Update StreamAlsa and alsa utils for built-in devices
  audio: Simplify and extend alsa::Mixer
2023-07-20 23:09:50 +00:00
Mikhail Naganov
6ddefdbcdf audio: Move StreamContext ownership out from StreamCommonImpl
Upcoming implementations of the streams of the primary module
will need to change the underlying stream type depending on
the current connected device. The stream context must persist,
thus its life time must be bound to the IStreamIn/Out implementation.
Move the StreamContext instance under ownership of StreamIn/Out.

Add StreamCommonImpl::onClose so that the owner of the context
may know when it is safe to reset it.

Re-arrange the order of the arguments when creating a stream
so that the context always comes first.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Iaf13d4bc3a53cbfc27264d3abd1f6c417ece3941
2023-07-19 17:49:28 -07:00
Mikhail Naganov
2eabaf995b audio: Use ChildInterface in StreamCommonImpl
Replace the pair of 'shared_ptr<>, Binder' with
the equivalent ChildInterface.

Fix logging of returned sub-objects to print their
Binder value instead of the local pointer.

Bug: 264712385
Test: m
Change-Id: I1350e7b3720c6244cd8527e1d021ee9577399291
2023-07-19 17:36:37 -07:00
Mikhail Naganov
422f7e6b1b audio: Update StreamAlsa and alsa utils for built-in devices
Use new functions added to alsa proxy layer for opening
attached (built-in) devices.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia2a47ff96fa62f99ce4ec4a0993ca3fd86f82c9d
2023-07-19 17:35:39 -07:00
Mikhail Naganov
f12d4a1ef8 audio: Simplify and extend alsa::Mixer
Remove alsa::MixerControl. tinyALSA contains utility
functions for setting values in percents, they use
the same logic as used to be there for handling
the "volume" control. Use access serialization at
the mixer level, rather than for each control.

Move the call to 'mixer_open' to alsa::Mixer.

Add controls for capture (mic) mute and gain. They
will be used by the primary HAL.

Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I0fad994153de96aceec3eb8f2fec19805ec912f8
2023-07-19 17:35:38 -07:00
Shraddha Basantwani
7770c158a1 Audio : Fix minor comments in r_submix module
Add missing check for StandbyTransition variable
Add missing & in const arguments

Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Id7a30e0697da80a272768bbf2aa8e3ed748e93f4
2023-07-19 16:43:50 +05:30
Treehugger Robot
1829d2133f Merge "audio: Fix state machine initial and final state symbols" into main 2023-07-18 22:59:06 +00:00
Mikhail Naganov
f082902b41 audio: Fix state machine initial and final state symbols
In UML, the initial state is a solid circle, the final
state is a double circle. In the Core HAL diagrams it
was the opposite.

Test: dot -Tpng stream-{in|out}-[async-]sm.gv -o ...
Change-Id: Id69f17d0a47227e744eb6dadcb5fee08c07bb0bd
2023-07-18 14:46:18 -07:00