* changes:
audio: Ensure proper priority and scheduler for service threads
audio: Implement the major functionality of the primary CF HAL
audio: Make renamings suggested by reviewers
LatencyMode is not updatable after audio session started.
Currently, if low latency is allowed, audio session should have
LOW_LATENCY latency mode.
Create a workaround to add LOW_LATENCY when low_latency_allowed_ set to
ture at ReportLowLatencyModeAllowedChanged.
Bug: 291760415
Test: play low latency audio with supported headset and check
LOW_LATENCY mode can be selected
(cherry picked from https://android-review.googlesource.com/q/commit:25b4819e08280ea1bffa019a231e1d60edea7338)
Merged-In: Ie0626179a56334125cd48a048d162f09882888eb
Merged-In: I9d5510116225aa5857d1bd086956bc46d46a3eba
Change-Id: Ia324f0a368e47ae8b8056c190d8d1f4a2e09ecec
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
(cherry picked from commit 4bf6899cc7)
Merged-In: Iab7e21ebc139ff11cf9b7f4a1645960db8dadd43
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
(cherry picked from commit cf824f65c8)
Merged-In: I85271564c664fa40008d60e82b32eaa66a99c68f
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
(cherry picked from commit 459b7331e9)
Merged-In: Id7159f9bf3ee020dc7cf594ec35f5d59d23d7e31
Add overloads for UpdateSink/SourceMetadata that
accept android.hardware.audio.common.Sink/SourceMetadata types.
Move include of hardware/audio.h to BluetoothAudioSession.cpp.
This allows to use this code from "pure AIDL" modules.
Bug: 228804498
Test: m
Change-Id: Ib0b8c6d1c7db9b846a508d6d4001f67feb2111c6
(cherry picked from commit d5f0d13ef0)
Merged-In: Ib0b8c6d1c7db9b846a508d6d4001f67feb2111c6
Make android.hardware.bluetooth.audio-V3 and
VtsHalBluetoothAudioTargetTest to depend on
android.hardware.audio.common-V2. This is needed so that
the audio HAL service can depend on
android.hardware.bluetooth.audio-V3.
Bug: 228804498
Test: m
Change-Id: Ic001e651de4cc6ef6920f1d6d80ab272c45aefe2
Merged-In: Ic001e651de4cc6ef6920f1d6d80ab272c45aefe2
(cherry picked from commit f6497dd78c)
If the test fails, the allowed network type bitmap will not be reset to
the previous value. Instead of using ASSERT_EQ, change to EXPECT_EQ to
allow the test to continue to the reset.
Test: atest VtsHalRadioTargetTest
Bug: 264913330
Change-Id: I719afa2e0d9ebc41a329f38f3eca597c9381f2f9
Use stream switcher to obtain device address for creation
of a remote submix stream.
Bug: 286914845
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I8dde3d59e488c9621dce78ffd5249254ecfc0b1a
(cherry picked from commit 2e460345a2)
Merged-In: I8dde3d59e488c9621dce78ffd5249254ecfc0b1a
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
(cherry picked from commit 43a85cfb2b)
Merged-In: Ie8ae0338fd22f705e00a34e56a7fa235eda5ed9e
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
(cherry picked from commit 1eedc130e8)
Merged-In: If6716f4051c484b52927cbfe4032df7c907eb3a5
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
(cherry picked from commit 780fefb331)
Merged-In: I31f9dd832c7f85f9632d1d389a8b1063d237d4c1
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
(cherry picked from commit 6ddefdbcdf)
Merged-In: Iaf13d4bc3a53cbfc27264d3abd1f6c417ece3941
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
(cherry picked from commit 2eabaf995b)
Merged-In: I1350e7b3720c6244cd8527e1d021ee9577399291
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
(cherry picked from commit f12d4a1ef8)
Merged-In: I0fad994153de96aceec3eb8f2fec19805ec912f8
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
(cherry picked from commit f082902b41)
Merged-In: Id69f17d0a47227e744eb6dadcb5fee08c07bb0bd
When a vendor HAL reuses libaudioserviceexampleimpl,
a subclass of Module cannot change Configuration.
This change adds virtual method Module::initializeConfig(),
then a vendor HAL can override it to load custom Configuration.
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I63fa8d70f3c4e13c8938070ee5431ebefd36bb58
(cherry picked from commit 918a6a5ce9)
Merged-In: I63fa8d70f3c4e13c8938070ee5431ebefd36bb58
This is a method which can be optionally implemented
by a stream in case it can provide more exact position,
for example by taking into account data in intermediate
buffers.
Implemented this method for StreamAlsa and StreamRemoteSubmix.
Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I392933f8f6b22d784726925199db00dcb0313648
(cherry picked from commit 704aec434e)
Merged-In: I392933f8f6b22d784726925199db00dcb0313648
Make 'Module' more abstract by moving stream creation
methods to more concrete 'ModulePrimary' and 'ModuleStub'.
'ModulePrimary' is now closer to the CF primary module:
it was stripped off USB devices from its configuration,
these got moved to 'ModuleUsb', and got rid of BT A2DP
and LE interfaces, these will be on 'ModuleBluetooth'.
Note that 'ModulePrimary' still uses stub streams, this
will be changed in subsequent patches.
'ModuleStub' is what 'Module' used to be, just a module
for improving test coverage. It includes simulation of
offload streams and dummy BT objects.
Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I5e4da0c32c00d65688f2eda78b2c79594e4e4671
(cherry picked from commit 521fc49fba)
Merged-In: I5e4da0c32c00d65688f2eda78b2c79594e4e4671
Extract code interacting with tinyALSA which is not
specific to USB into "abstract" module and stream
implementations ModuleAlsa and StreamAlsa. Also, move
utility code which does not need module or stream
context into Utils.
This facilitates implementation of the CF core HAL which
also uses tinyALSA, allowing to share common code.
Bug: 264712385
Test: atest VtsHalAudioCoreTargetTest
Change-Id: I2134b15e970c78e8a48b254e15199b8207a8ab34
(cherry picked from commit c337a8799b)
Merged-In: I2134b15e970c78e8a48b254e15199b8207a8ab34
Ensure that all formats returned by
AudioPolicyConfigXmlConverter::getDefaultSurroundSoundConfig
can be converted into legacy values.
Bug: 290116634
Test: atest audio_policy_config_xml_converter_tests
Change-Id: I3a46ea5ee4805f719c8977064c9d8d681a75cff2
(cherry picked from commit 724b24f895)
Merged-In: I3a46ea5ee4805f719c8977064c9d8d681a75cff2
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
(cherry picked from commit 64fd6bd779)
Merged-In: Ia1b9330c2b419a1a4048ed78d914d05c1caf523f