Extract code that loads hardware modules and fills out
mAvailable{Input|Output}Devices into a reusable function.
It is used both during APM initialization and on
receiving a notification that a new HAL service has
been discovered.
Bug: 149854039
Test: atest audiopolicy_tests
Change-Id: Ifb7f0b61b06a0609802e63dccb26f3472328ef48
Added new API to audio policy to route audio output streams based on
Android user id. The routing remains similar to uid rules, with only
using USERID_EXCLUDE_USERID to decide on the user id base routing.
Application uid and stream usage routing remain the same with the added
difference that user id will be taken in to consideration if available.
Bug: 139365417
Test: atest
com.google.android.gts.audio.AudioHostTest#testUserIdDeviceAffinity
Test: atest AudioPlaybackCaptureTest
Change-Id: Ib817eb8ae19ed7dea8451e8a8584a20b9b6f5042
Add support for querying the audio devices used for playback
routing for the given audio attributes.
Take into account registered dynamic policies but disregard
secondary output descriptors as they are used for playback
capture.
Bug: 144440677
Test: atest AudioServiceHostTest
Change-Id: I102c57b432b044dc6b0ead49e0a30d8e9094411d
This change:
- Removes the old ISoundTriggerHw service and removes its code.
- Connects AudioPolicyManager to the new service via AIDL RPC (using
a new utility, BinderProxy).
Change-Id: I00366e2c5f252708e903b2311816d9eceb132a05
Bug: 142070343
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
Align playback permission checks implementation in getOutputforAttr() on
capture checks in getInputForAttr(): use an "output type" returned by
audio policy manager and check permission accordingly.
- Do not modify but reject request to play to call uplink when permission
is denied.
- Add missing permission check for injection to remote submix.
- Clarify permission check for record from remote submix by using the
uid/pid of client explicitly.
Bug:
Test: CTS test for AudioTrack and AudioREcord.
Test: GTS tests for dynamic policies and playback capture
Change-Id: Ic0eb3b9921a491e97c58fa8f637583059a54b3a2
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
Add new audio mode AUDIO_MODE_CALL_SCREEN allowing call screening
to take place while other audio use cases are still active.
Also add API and audio policy configuration attribute to
indicate if the platform supports this audio mode.
Bug: 140384450
Test: make
Change-Id: If2fc56dbbd10aae2cf1498480471b35de0940228
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
Add the possibility to silence a particular AudioRecord
client rather than silencing all clients sharing the same UID.
Test: AudioRecordTest#testRecordNoDataForIdleUids
Change-Id: Ic472045cd45c7222ca3a88ccf131435fd1e26475
Fixes build issues with -O0, due to missing vtable entries.
Test: Build with -O0
Test: make NATIVE_COVERAGE=true COVERAGE_PATHS=frameworks/av
Change-Id: Ice06940f4ccc55609abf0d820f9b3c6d4e43d2c6
The client must provide a unique Record ID (RIID) when creating
an AudioRecord. This RIID is passed down to AudioInputDescriptor
in AudioPolicyManager which sends configuration updates
via IAudioPolicyServiceClient callback.
By supplying RIID, the Audio Service can coalesce start / stop
events coming from clients (apps) with recording configuration
update events.
For AAudio MMap clients everything is handled at the server
side because they correspond directly to audioserver objects.
Bug: 123312504
Test: android.media.cts.AudioRecordingConfigurationTest
AudioRecordTest#testAudioRecordInfoCallback
MediaRecorderTest#testAudioRecordInfoCallback
manual testing using Oboe and Solo test apps
Change-Id: I3d32241752d9a747736606dc4cb1e068e6b7aa3b
Add pre processing effect management for concurrent capture scenarii.
When several clients on the same input stream have enabled audio effects,
only the effects attached to the top priotity client are active.
Other effects are suspended.
Add AudioFlinger API to suspend/restore audio effects build on top
of exisiting internal effect suspend mechanism.
RecordThread now supports more than one effect chain.
AOSP pre processing implementation supports more than one effect session
per input.
Refactor AudioPolicyManager::closeAllInputs() to call closeInput() on
all inputs instead of partially duplicated code.
Bug: 128419018
Test: make
Change-Id: I685286da4c2905a8894a4354679f9787b1400621
Remove effect specific mutex (mEffectLock) in AudioPolicyService: Due to
concurrent capture (among other reasons), it is necessary that the audio
policy manager state preserved by mLock includes audio effects
registration and enabling.
Moved all audio policy API calls from audio flinger out of locked regions
for audio flinger, thread and effects mutexes to avoid cross deadlocks
between audioflinger and audio policy manager:
- centralized audio policy API calls in EffectModule::updatePolicyState()
- the enabled state now reflects the state requested by the controlling
handle, not the actual effect processing state: a suspended effect is
now considered enabled.
A new audio policy manager API moveEffectsToIo() is added to atomically
handle moving effects to a new input or output without having to call
unregister > register > enable sequence.
Also fix assert in setStreamVolume to match volume group refactoring
in audio policy manager.
Bug: 128419018
Test: CTS tests for audio effects.
Test: manual tests with Duo calls, Play Music, Youtube, notifications
with and without Bluetooth and wired headset.
Change-Id: I8bd3af81026c55b6be283b3a9b41fe4998e060fd
Apps were previously forced to set their allowed capture policy from
either their manifest which is not flexible or from each track which is
a very fine grain but difficult when using libraries like exoplayer.
Thus add an application level policy set with AudioManager.
Test: atest android.media.cts.AudioPlaybackCaptureTest
Bug: 111453086
Change-Id: Ic890b5b041affea757fbd3f2707ff2ce18771828
Signed-off-by: Kevin Rocard <krocard@google.com>
The secondary are returned from mixes (from DAP loopback&render),
from getOutputForAttr.
All getOutputForAttr* of the stack are update.
Internal getOutputForAttr use descriptor, external one use handles.
The secondary output are saved in each track and the track is
invalidated if the list of secondary output changes.
In audio flinger, create a pair of recordTrack & patchTrack to pipe
the intercepted audio audio to the secondary output.
Test: adb shell audiorecorder --target /data/file.raw
Bug: 111453086
Change-Id: Id6523d9e383c15a0e39313d5f355df809b7e72fe
This CL adds required introspection APIs to deal with product strategies:
-getter of the collection of product strategies
-helper function to return the strategy associated to a given attributes.
This API is mandatory to avoid duplicating the logic that compiles the strategy
for a given Audio Attributes structure.
Test: make
Change-Id: I0e107570a44227bb52a4f359954c93215d4f8bae
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
Add support in AudioPolicyManager to return supported encoding
formats for A2DP on the primary HAL. Current implementation is
to query prop defined and convert this to a list of audio formats
Bug: 111812273
Test: make
Change-Id: Ic3ea72e19aa4c0bd4c156f62e45e6225f9ce6b11
Add support in AudioPolicyManager to select a module,
device or output based on device type and codec.
Implement hybrid mode with A2DP which enables runtime
switching between HALs for A2DP based on offload support
for specific A2DP codecs.
Optimize A2DP active device change and device config
change in AudioPolicyManager.
Bug: 111812273
Test: make
Change-Id: I246d71dd08bacbca6ed9b0012e7d7698bd8a0953
Setting audio device affinity for a given uid augments all
audio mix criteria that do not route to the given devices
to exclude the uid.
AudioPolicyManager: after changing the device affinity,
check the outputs addressing the devices to re-evaluate
audio routing
Bug: 111647296
Test: requires device with routing policy started by CarService
Change-Id: I72de54ae067151fe6ac2ec43b78fe544a9fd9888
Report more information in onRecordingConfigurationUpdate() callback:
- For client:
- Port ID
- Enabled effects
- Silenced by policy
- For stream:
- Active effects
- Active audio source
Bug: 111438757
Test: make
Change-Id: I34c3d0ee6251576de7d793bfaa2bc2c34efa2319
This reverts commit 4c1ef4b64d.
Reason for revert: b/120588242
Bug: 120588242
Change-Id: Iac41f371cb739c54d5ce519232688bebe2285c72
Test: Launch QSB and capture from mic icon
The method checks whether the provided AudioFormat can be played
via currently connected output devices w/o SRC or downmixing
by the framework.
The implementation methods are called 'isDirectOutputSupported'
to match APM's terminology.
Bug: 120044865
Test: atest CtsMediaTestCases:AudioTrackTest#testBuilderValidate
Change-Id: I11769f796c34583fb2641415d2faab00ac526123
Implement concurrent capture in audio policy manager:
- Attach AudioRecord client to already opened input when possible
instead of systematically opening a new input for each client.
- Always allow inputs to start even in case of concurrency.
- Clients are selectively silenced based on their app state by audio
policy service.
- In case of concurrency on a given input stream, device and source is
chosen based app states and source priority.
Bug: 111438757
Test: Manual capture tests with solotester and Camera, Assistant and Duo
Test: CTS tests for AudioRecord
Change-Id: I302710ff545f67361d9aca89e81de40771ce7fb0
In preparation for concurrent capture policy, extend current audio policy
interface setRecordSilenced(uid...) to a more generic API setAppState(uid...)
Bug: 111438757
Test: CTS test AudioRecord.testRecordNoDataForIdleUids
Change-Id: Idba540e2724a6c71ec275a5ff73c312e5b6040a4
Refactor management of hardware audio sources to make use of
ClientDescriptor class:
- HW sources are now tracked by port ID and not audio patch handle.
- startAudioSource() and stopAudioSource() APIs are updated to use
audio_port_handle_t as source identifier.
- AudioSourceDescriptor class is deleted and replaced by
SourceClientDescriptor class deriving from TrackClientDescriptor
Test: make.
Change-Id: Ie418b566519a591f036b538a77319f8e30aa99a8
First step in implementing use of ClientDescriptor class to keep track
of playback and capture activity:
- update AudioPolicyInterface methods to just use port ID as
client identifier
- add list of clients in input and output descriptors and update list
when clients are added and removed.
- list clients in audio policy manager dump.
Test: Audio smoke tests. CTS tests for AudioTrack, AudioRecord, routing, recording and playback configurations
Change-Id: Ia0f62f295d421fb845d57afcaa0ce77cd2c58775
Not needed anymore as this is handled by NotificationManager.
Extend caping of alarm and ringtone volume to call volume to all
output devices (was only done for earpiece).
Test: make
Change-Id: I9a1cd8610e42fefd0518f6ccc68e50e5541884ed
To make surround sound setting more clear to users, we are changing
surround setting from ALWAYS to MANUAL. With MANUAL, users could enable
surround formats according to their need.
Bug: 67479735
Test: Try creating AudioTrack with enable/disable surround formats.
Change-Id: Ia6c0e1210ff6215f4b80a278a0aa90ca9543f262
new fields in the media metrics 'audiorecord' record for more detail
length of time recorded, error conditions
add new media metrics type 'audiopolicy' that describes attempts to get
microphone access -- success, failure on contention, what type of access
was requested, and (important for the contention) which programs are
doing the requesting and holding of the microphones.
whitelist the 'audiopolicy' metrics type with the media.metrics service.
Bug: 78595399
Test: concurrent/serial recordings, dumpsys media.metrics
Change-Id: Ia17860940d4c329b0215b4cf97c6dacacb6a8e32
This change enables phone apps to play audio to the uplink stream
during a call.
This change maks the AUDIO_OUTPUT_FLAG_INCALL_MUSIC_UPLINK flag to be added to the flags that are sent to the HAL when an ongoing call is active, the chosen output device is the TX telephony device, the stream type is music, and the calling app has the MODIFY_PHONE_STATE permission.
For this change to take place, the following changes were made to the signature of getOutputForAttr in IAudioPolicyService:
1. Add pid (process id) parameter to getOutputForAttr.
2. Make the flags parameter a pointer so changed value can be
examined by calling function.
Bug: 69973354.
Test: tested manually.
Change-Id: I74cef3f8b66de6e0e8f87b6235130c2cdf423da7
To protect user's privacy if a UID is in an idle state we allow
recording but report silence (all zeros in the byte array) and once
the process goes in an active state we report the real mic data.
This avoids the race between the app being notified aboout its
lifecycle and the audio system being notified about the state
of a UID.
Test: Added - AudioRecordTest#testRecordNoDataForIdleUids
Passing - cts-tradefed run cts-dev -m CtsMediaTestCases
-t android.media.cts.AudioRecordTest
bug:63938985
Change-Id: I1442a9dda1553e9ea7a4a654c50555ac1ec06aa0
getOtuput() was long replaced by getOutputForAttr() for the purpose of
querying an appropriate HAL output stream for a given playback use case.
It is now only used internally by AudioSystem to find an existing output
corresponding to a given stream type in limited cases.
This CL simplifies getOutput() by removing unused arguments and just
returning an output from already opened outputs.
This is in preparation of limiting access to audio policy binder calls
to what is strictly needed by apps.
Test: test main playback, capture and call use cases.
Change-Id: I137c5526aa7e82303b43948326c77ec798f432f5
Bug: 62090113
Test: run AAudio test and verify a valid device is reported just
after opening playback or capture streams in legacy mode.
Change-Id: Ic8be42e1735690eb00c811ef0cb8b5abb36172d6
Pass uid of recording session along with other existing information
in the recording monitoring callback.
Define new structure, record_client_info, to group uid (new),
session id (existing) and source (existing) and simplify
method signatures and marshalling code.
Test: run cts -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest#testAudioManagerGetActiveRecordConfigurations
Bug 62579636
Change-Id: I18f66d7e55640a21f31021416a12a3e8094c3690
* Added new call handleDeviceConfigChange() to the Media Framework.
That call can be used when there are device configuration changes
(e.g., Bluetooth A2DP codec configuration has changed).
* Added new method AudioPolicyManager::handleDeviceConfigChange().
That method toggles the UNAVAILABLE/AVAILABLE connection state of the
device, so it can be reconfigured as appropriate - e.g., the audio
feeding parameters can be updated.
* Fix ALOGVV compilation errors when extra logging is enabled.
Test: A2DP streaming to headsets
Bug: 30958229
Change-Id: I388abbbb3ec4d1a003b441cb0c77e00d80cad668
This will allow to track activity at the track level instead of
at audio session level as only possible with current implementation.
AudioTracks and AudioRecords will receive a unique audio port ID the
first time they register to audio policy with
getOutputForAttr()/getInputForAttr() and keep this ID for their
lifetime.
This CL is the first partial change and just updates the
audio policy and audio flinger APIs used at track creation time.
Test: basic regression test of audio playback and capture use cases
Change-Id: I8d612e67738e120494f61e3f7c60bfd0b2c6a329