Functions called by RequestThread::threadLoop must not hold
mInterfaceMutex since the following deadlock scenario may occur:
T1: disconnect() -> holds mInterfaceMutex and waits for RequestThread to
exit
T2: RequestThread::threadLoop()->reconfigureCamera (or any other function) that waits on
mInterfaceMutex
leading to a deadlock
Bug: 143513518
Test: GCA
Test: CTS
Change-Id: I4bd856e5263934a54cd7087a01d35cfe10936196
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
Player type AAudio are always initialized with AUDIO_USAGE_MEDIA. Added
fix to initialize with assigned usage.
Bug: 143578354
Test: ran native application with usage of AUDIO_USAGE_NOTIFICATION
Test: atest CtsNativeMediaAAudioTestCases
Change-Id: I170e0b55d7f90b59d9b5129b22f4a9080957994b
Merged-In: I170e0b55d7f90b59d9b5129b22f4a9080957994b
Audio policy engine supports receiving a preferred device to use
for a given strategy (Engine superclass). Use of the preferred
device intervenes at the level of the each engine implementation,
here in the default engine in getDevicesForProductStrategy() method
so it is saved in the routing cache, and respects existing routing
priorities.
Refactor the loops for call and output rerouting into a new
updateCallAndOutputRouting() method.
Bug: 144440677
Test: atest AudioServiceHostTest#testPreferredDeviceRouting
Change-Id: Ic4c690e1b0d8020c4335979e40e14e6df5887879
Merged-In: Ic4c690e1b0d8020c4335979e40e14e6df5887879
Since the only f_mtp.h header is deprecated in newer Android kernels,
copy this file out of bionic and to the only place it's used.
Test: Builds.
Change-Id: I06bab28f46b7d60bdb83a279b8ebec306b2e6661
The added files were using DOS EOL symbols (CRLF) instead
of UNIX (LF only). Removed CR symbols.
Bug: 135749685
Test: m
Change-Id: Iba36aaef0ea8d9bcb3bd8e2d476a7b0588bd70ee
When connecting multiple audio devices,
Media and Sonification sounds comes out of the last connected device,
not a high-priority device.
Test: play music
Test: connect wired earphone // sound : wired earphone
Test: connect usb earphone // sound : usb earphone, not the wired earphone(high-priority)
Test: connect bluetooth headset // sound : bluetooth headset
Test: disconnect bluetooth headset // sound : usb earphone, not the wired earphone(high-priority)
Bug: 135749685
Change-Id: I579a04a04c97cc846b88e54fa83cdf3dad0b5cee
Signed-off-by: Baekgyeong Kim <baek.kim@samsung.com>
Add request to create tombstones of audio HAL servers before restarting
audioserver process when the watchdog triggers.
Add audio device factory HAL interface API to retrieve HAL process pids when
possible (on debug builds).
Add AudioFlinger service API to set audio HAL process pids from
JAVA AudioService.
Bug: 141528385
Test: Force watchdog and verify tombstone creation
Change-Id: I68c1e8fb4db23e5952ad0c93d7d0b9d121b8ec18
Merged-In: I68c1e8fb4db23e5952ad0c93d7d0b9d121b8ec18
Read log tag from request list under lock
to avoid use after free.
Bug: 142142406
Test: make
Change-Id: If4adab8c15a319dc84b7003adf3ac59a3980f075
Merged-In: If4adab8c15a319dc84b7003adf3ac59a3980f075
* changes:
Refactor for audio device type in conversion.
Use AudioDeviceTypeAddr when setting device for effects.
Add constructor with type and address for DeviceDescriptor.
As audio device type can not be used as bit mask any more, refactoring
audio device type usages in conversion from/to HAL. Use a set of audio
device types instead of bit mask.
Bug: 135621476
Test: atest AudioPlaybackCapture
Test: play and capture audio with BT and usb headset
Change-Id: If4a5c5002d6d4ccb7aaf823111b371d417784b19
Merged-In: If4a5c5002d6d4ccb7aaf823111b371d417784b19
Separate SET_DEVICE and SET_INPUT_DEVICE command in effects as it can
be multiple devices for output case, but only single device for input
case.
Use AudioDeviceTypeAddr instead of just audio device type as address
can be useful to identify audio device if there are multiple devices
with the same device type connected.
Bug: 135621476
Test: atest AudioEffectTest BassBoostTest DynamicsProcessingTest
Test: atest EqualizerTest VirtualizerTest VisualizerTest
Change-Id: Ie9df88e3338730392abbc3efae5daadc70398ff7
Merged-In: Ie9df88e3338730392abbc3efae5daadc70398ff7
Type and address are used to distinguish a device, it makes more
sense to set device type and address when creating a DeviceDescriptor.
Bug: 135621476
Test: make, atest audiopolicy_tests
Change-Id: I5f9063bd8c756ace77c162e86a8c0dd685da79b4
Merged-In: I5f9063bd8c756ace77c162e86a8c0dd685da79b4
Before, in Android 10, this would have been a small leak because
unlinkToDeath is not called, but now, objects are automatically
unlinked. However, this presents a problem since you must hold onto
a binder in order to linkToDeath. This now holds onto the binder
and is relying on the automatic-unlinkToDeath behavior.
Fixes: 145675653
Test: atest CtsNativeMediaAAudioTestCases
arm64-v8a CtsNativeMediaAAudioTestCases: Passed: 122, Failed: 0, Ignored: 0, Assumption Failed: 0
Test: after using app and killing which uses AAudio MMAP stream,
dumpsys output for media.aaudio is cleaned up:
------------ AAudio Service ------------
Stream Handles:
AAudioClientTracker:
AAudioEndpointManager:
Exclusive MMAP Endpoints: 0
ExclusiveSearchCount: 3
ExclusiveFoundCount: 0
ExclusiveOpenCount: 1
ExclusiveCloseCount: 1
Shared Endpoints: 0
SharedSearchCount: 1
SharedFoundCount: 0
SharedOpenCount: 0
SharedCloseCount: 0
Change-Id: I2ef141320dc3ef0135fb7ef002d85377d06a75c2
* changes:
Refactor audio device type in audio flinger.
Refactor opening output interface between AF and AP.
Move libmediahelper into a new folder.
Use AudioDeviceTypeAddr in DeviceDescriptorBase.
Move AudioDeviceTypeAddr to libaudiofoundation.
As audio device type must not be used as a bit mask, there is a
requirement to refactor the code in audio flinger. This CL includes:
1. Use DeviceTypeSet for recording output devices in Threads. The input
and output device types in Threads will only be updated when creating
an audio patch.
2. Use helper functions in audio flinger for checking whether an audio
device type is a certain category.
3. Use DeviceDescriptorBaseVector as vector of DeviceDescriptorBase.
DeviceDescriptorBaseVector will be used in RecordThread to record output
devices, which will be used in audio effect.
4. Do not use set parameters when communicating output devices to
RecordThread. Instead, adding a new event in Thread to update output
devices directly.
Bug: 135621476
Test: atest AudioTrackTest AudioRecordTest AudioPlaybackCaptureTest
Test: atest AudioHostTest AudioServiceHostTest RoutingTest
Test: atest AudioEffectTest BassBoostTest DynamicsProcessingTest
Test: atest AAudioTests
Test: audio smoke test, run OboeTester
Change-Id: I87f3e59fd01b0b100232d61a9abbc471c61110c4
Merged-In: I87f3e59fd01b0b100232d61a9abbc471c61110c4
Refactor interface between audio flinger and audio policy. Use device
descriptor instead of audio device type and address. DeviceDescriptor
can contain more information that may be useful when opening an output
stream.
In audio policy, if multiple audio devices are passed in when opening
an output stream, one device is extracted using the same strategy as
when selecting a device for volume application. When starting source,
audio policy manager will call audio flinger to create audio patch. In
that case, multiple devices will still be patched to the output stream.
Test: atest AudioTrackTest AudioPlaybackCaptureTest
Test: atest audiopolicy_tests, audio smoke test
Change-Id: I46dc2da621614f8716c6c73cf807fe7d2d672cda
Merged-In: I46dc2da621614f8716c6c73cf807fe7d2d672cda
This change mainly aims at refactoring libmediahelper. Libmediahelper
doesn't need to be stored in media folder. In that case, move
libmediahelper related file to a new folder. In the meantime, move
AudioParameter.h from libaudioclient to libmediahelper. There is no
need to keep AudioParameter.h in libaudioclient while AudioParameter.cpp
is in libmediahelper.
Test: make
Bug: 135621476
Change-Id: Icce6615b7e3a68be8b7492f2a91922ab04464ca2
Merged-In: Icce6615b7e3a68be8b7492f2a91922ab04464ca2
AudioDeviceTypeAddr is moved to libaudiofoundation. In that case, it can
be used in DeviceDescriptorBase.
Bug: 135621476
Test: make, atest audiofoundation_parcelable_test
Test: play music, record audio
Change-Id: Ia66dce29c8fb9d25c40598d9bada6eb295313884
Merged-In: Ia66dce29c8fb9d25c40598d9bada6eb295313884
Move AudioDeviceTypeAddr from AudioPolicy.h to libaudiofoundation.
AudioDeviceTypeAddr is a class that contains audio device type and
address. It can be used not only in audio policy, but also other places.
Bug: 135621476
Test: make, atest AudioHostTest
Change-Id: Ib257859891c647c07f22771012efdada438a4ff5
Merged-In: Ib257859891c647c07f22771012efdada438a4ff5
* changes:
Add parcelable test for classes in libaudiofoundation.
Add export header lib headers to libaudiofoundation_headers.
Add equals functions for classes in libaudiofoundation.
Make audio stuff parcelable.
Clear up bit mask usage in audio policy.
Make AudioGain parcelable.