This CL forces the onAudioDeviceUpdate on register event.
It also fixes the loss of callback on AudioTrack or AudioRecord
client if received before ioHandle is assigned.
Test: audio smoke tests
Test: CTS for AudioTrack and AudioRouting
Change-Id: I119b5c407da68a5b55162550bea5fa7e724165d1
Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
A media application takes advantage of HwAudioSource would call
start/stopAudioSource directly.
Bug: 112161027
Test: Launch FM Tuner application
Change-Id: Ic4c23f51010dbb3f2226d9d2200e11feb908867b
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
IMPORTANT NOTE:
CL depends on another CL in frameworks/base
https://partner-android-review.googlesource.com/c/platform/frameworks/base/+/1206275
AudioProductStrategies offers the possibility to dynamically
translate attributes to stream types (and vice versa) within
audio policy engine.
Legacy engine has hard coded rules to maintain the translation
service.
This patch removes the hardcoded translation within the helper
and replaces them by AudioProductStrategy APIs.
Test: AudioPolicyTests: AudioProductStrategiesAllStreamsTest
It loops on all stream types supported by strategy and ensures
device selection matches. Hard coded stuff would prevent right device
selection.
Test: CTS: AudioTrackTest AudioRecordTest
Test: audio smoke test on sailfish, walleye blueline
Change-Id: I76589df5555136ed49dbacc7aac9b0b5e828bef2
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
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>
-Adds new Engine APIs for Product Strategy management
-Adds a common engine code to handle product strategies
-Adds a parsing configuration library to feed the strategies
-Prepare both engine for the switch
Test: make
Change-Id: I00f57ece798893bc6f9aa9ed54a3e5237e8d5cf1
mAttributes in AudioTrack can not be set in AudioTrack::set()
when pAttributes is NULL.
AudioTrack::getPosition() sometimes returns wrong value
since mAttributes is undefined value.
This change sets default values to mAttributes.
Bug: 123607740
Test: manual
Change-Id: Ie590c17efc466cc89cbd7e9f89fc3ebeed98eace
Use the same logic in VibrationEffect.scale to control the intensity of
haptic playback in audio framework. Note that as the maximum amplitude
of vibrator is 255, convert the haptic data to pcm_8_bit before doing
scaling.
Test: Manually
Change-Id: I6136d27c9255a215834b6e3092aa8ad696fbae04
Test: Change Balance through Settings, play audio
Bug: 28390736
Co-author: Ed Savage-Jones <edward.savage-jones@sony.com>
Change-Id: I0169b436ccbaa5628584d9f4954dd7c76d021aae
This reverts commit 7194e6da8a.
Reason for revert: AOSP is fixed with new vendor image
Change-Id: I15797a30abcc304379db05bec1b25a0bd95b2ff4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
libaudioclient and libmedia are using get_sched_policy and
set_sched_policy which are now implemented inside libprocessgroup.
Add required dependencies and include required headers.
Exempt-From-Owner-Approval: janitorial
Bug: 111307099
Test: builds, boots
Merged-In: I83dd6878839122e3ea71b7be6f6f312376897d56
Change-Id: I83dd6878839122e3ea71b7be6f6f312376897d56
Signed-off-by: Suren Baghdasaryan <surenb@google.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
libaudioclient and libmedia are using get_sched_policy and
set_sched_policy which are now implemented inside libprocessgroup.
Add required dependencies and include required headers.
Exempt-From-Owner-Approval: janitorial
Bug: 111307099
Test: builds, boots
Change-Id: I83dd6878839122e3ea71b7be6f6f312376897d56
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
When setting a uid device affinity, make the rules deterministic
by applying an "exclude" rule on all mixes that don't reach
the devices (existing), but also a "match" on the mixes that
do (new).
Bug: 111647296
Test: requires device with routing policy started by CarService
Change-Id: I3bb844156ade75e4b9576c1e18200ca90ce26cf9
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
As haptic playback via audio require sample rate is the same as the HAL
one, sample rate should not be changed after AudioTrack is created.
Bug: 121271890
Test: Manually
Change-Id: I1549017b3ca8523735190f62f8c9a4fb8b95e000
When trying to play with haptic channel mask, use adjust channels
buffer provider to make the haptic channel the same as the output one.
If haptic playback is supported, use adjust channel non destructive
buffer provider to output haptic data to the end of the sink buffer.
Otherwise, haptic data will be ignored.
Test: Manually
Bug: 111454766
Change-Id: Ic5f780de48c1e71de6ba5c4774d1ed2e9c8c51a0
1. Add adjust channels buffer provider, which will expand or contract
sample data from one interleaved channel format to another. Expanded
channels are filled with zeros and put at the end of each frames.
Contracted channels are omitted from the end of each audio frame.
2. Add adjust channels non destructive buffer provider, which could
expand or contract sample data from one interleaved channel format to
another while not destructing the buffer. Extra expanded channels are
interleaved in from the end of the input buffer. Contracted channels are
copied to the end of the output buffer. Contracted channels could be
written to an output buffer with certain audio format.
Test: Manually
Bug: 111454766
Change-Id: I3f963307e73b3f7aa662d4127f78f0c61ac84510
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
Return the port ID allocated by audio policy manager instead of the
internal track ID allocated by audio flinger when an AudioTrack or
AudioRecord is created.
This information is more useful for logs and allows to associate information coming
from audiopolicy manager with a specific client instance.
Bug: 111438757
Test: Manual playback and capture tests
Change-Id: Ib467d8fcc34d9a8aa7bcaac0770a741982b847c5
The Java AudioTrack interface has a setPresentation API. This
calls the setParameters API in IAudioTrack. However, this does
not eventuate into a call into the android.hardware.audio@4.0
IStreamOut selectPresentation API.
Add selectPresentation API to IAudioTrack and call down to the
android.hardware.audio@4.0 IStreamOut selectPresentation API.
Translate into calls to setParameters API for legacy HAL
interfaces.
Bug: 63901775
Test: compile
Change-Id: Id634a107f3f93ab18dc80d2bd0af67bda35e859f
Add APIs to communicate assistant and accessibility service UIDs
to audio policy service in order to implement the new concurrent
capture policy.
Bug: 111438757
Test: enable and disable Google Assistant and Voice Access.
Change-Id: Ia804613051edab2ebd57d317b5b7509c98e7c6b4
If the track thread is paused, EVENT_STREAM_END will not delivered
for offload. This event is required for PRESENTATION_END to
be delivered for Java AudioTrack offload.
Bug: 86837964
Test: cts-tradefed run cts -m CtsMediaTestCases -t android.media.cts.AudioTrackOffloadTest
Change-Id: I491cdb0a6faa69e5c37139c0364b5c9079ff1f14
New transfer mode for java AudioTrack using offload
path, where data is provided through the write method,
and the callback is used to notify the track owner
more data can be written on the track.
Bug 86837964
Test: adb shell clof --source /sdcard/Music/my.mp3
Change-Id: I47c760b7fb8f1431945ca24ff4a26311b63cb761
Allow retry on failure to reconnected to audioserver when restoring an
AudioTrack or AudioRecord and do not change state to inactive when
reconnection fails. In case of failure due to temporary race conditions this will
increase the chances of success and avoid ending up in an inconsistent
active state if a later reconnection succeeds.
Bug: 113109529
Test: AudioTrack CTS tests and manual playback smoke tests.
Test: AudioRecord CTS tests and manual capture smoke tests.
Change-Id: I570724eb46f3a0f830267396aba06297bd37df7a
When there is a TimeCheck timeout crash, the transaction code will be
useful for debugging.
Test: Manual run
Change-Id: I8a93ead7ec7379f51b211ca31c68ec6ec2553afc
Merged-In: I4716852c77d56703ad5f3dfc2500f598a2b80a12
To play the following tones as per Indian standards.
- Dial tone
- Busy tone
- Congestion tone
- Call waiting tone
- Ringing tone
Bug: 117161543
Test: Play each tone in indian locale
Change-Id: I6b7a2a5674a79a26fba80f987d2ed6ed555ce4bf
Optimizing compilers may skip masking if the result of
subtraction is assigned to larger integral type.
Test: long term test with 64 bit audioserver
Bug: 113763960
Change-Id: Ida405a5a26e819891e7da7f29ebd0b78d2de1fc5
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: Icafaff606364fe7bffaad1e9c2e763c444ea999c
NBLog.cpp was deleted and split up into Entry.cpp, Merger.cpp,
Reader.cpp, Timeline.cpp, and Writer.cpp. NBLog.h was split up into
Entry.h, Events.h, Merger.h, Reader.h, Timeline.h, and Writer.h. NBLog.h
now includes all of these new headers except Merger.h, which is managed
exclusively by MediaLogService.
Other changes:
- changed NBLog from a class to a namespace
- changed NBLog::thread_info_t.type to enum and replaced magic numbers
- fixed some fragile build dependencies in libaudioclient and medialog
No other changes were made, and all functionalities that existed prior
to this commit remain the same.
Test: build, dumpsys media.log
Bug: 68148948
Change-Id: I1ce6dcb7b30d004f90584edfad7103a89f7bab0c
* Use time_t for tv_sec type.
* Use 'auto' to avoid explicitly use of 'long'.
* Use (u)int16_t instead of (unsigned) short.
Bug: 112478838
Test: build with WITH_TIDY=1
Change-Id: I023e579b071688731064e51dc94f404274cd59e2
Allows runtime modification of what effects should be default
attached to sources of different types. The core functionality
was already in the AudioPolicyEffects system, this allows
the dynamic modification of the lists.
Bug: 78527120
Test: Builds, manually tested an app adding a source effect,
tested both media on the specified source and on a different source.
Also tested by Android Things integration tests.
Change-Id: I4da15787278c79d80043e172f4f81d3b2a139f44
The object of AudioEffect may be deleted when construction ongoing,
if the method of mIEffectClient invoked by the proxy in audioflinger.
If mIEffectClient cleared in the destructor of AudioEffect before IEffect
linkToDeath to mIEffectClient in the constructor of the AudioEffect,
the aforementioned case may lead to an abort, i.e.,
"Abort Message: 'linkToDeath():recipient must be non-NULL".
Test: monkey test
Change-Id: I5fe8227b8528fb9fb9c9a1e636bd4dc0cc22c2cf
When a track is reused from SoundPool and started again, the
previous callback events could be done after track started,
then the new playback will be stopped unintentionally.
Clear the old cblk flags when recycled track is started again
to avoid triggering unexpected callback events.
Bug: 112269355
Test: Playback with SoundPool frequently
Change-Id: I111b085d08b73c333fbb0fc2896efe1c013c584c
Enable log function in ToneGenerator.cpp, then ToneGenerator
plays consecutively many times and do not stopTone.
"lpToneGen->mNextSegSmp*1000" will go beyond the scope of unsigned
int, and audioserver get crashed.
Test: Enable log function in ToneGenerator.cpp, alarm notification is
played when the phone is online. ToneGenerator plays consecutively.
Do not stopTone. then we get audioserver crash.
Change-Id: I073590088fccb32a73353d14970dc89441045663
Allows runtime modification of what effects should be default
attached to streams of different types/usages. The core functionality
was already in the AudioPolicyEffects system, this allows
the dynamic modification of the lists.
Bug: 78527120
Test: Builds, manually tested an app adding a stream effect,
tested both media on the specified stream and on a different stream.
Also tested by Android Things integration tests.
Change-Id: Ie0426b17ff7daece58b8c85d72fbef620844325b
Adds audio_usage_to_stream_type method to aid in converting
audio_usage_t to the legacy audio_stream_type_t.
Bug: 78527120
Test: Builds
Change-Id: I411bb687d0f46b82afef3a2e9ac6a974f922da91
Allows getting effect descriptors by type or uuid,
not just by uuid.
Bug: 78528249
Test: Builds. Manually tested that an app playing audio with an effect works.
Change-Id: I9d339a7d6d81161065e1adaf427dd2d3430436c2
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
Refactor audio policy service APIs controlling audio playback (startOutput, stopOutput, releaseOutput)
To allow finer grain control per AudioTrack client.
Test: AudioTrack CTS test. manual test of playback use cases.
Change-Id: I49a681f3c2a8211e524824993049b24d8086376d
Add event logging in case of audioserver watchdog to help
collect statistics.
Test: make. Simulate watchdog and check events in logcat.
Change-Id: I4716852c77d56703ad5f3dfc2500f598a2b80a12
Allows common use for latency computation.
Implementation for AudioRecordServerProxy added.
Test: audio sanity, subsequent latency tests
Bug: 80447764
Change-Id: Ib53181cdced16606bf268769a04bd52c689d89d3
Replaces main and aux buf from track dump.
Bug: 80272001
Test: adb shell dumpsys media.audio_flinger
Change-Id: I5d6565410e652ec7fc6701b171d299dea9f7bc3e
Change captureAudioOutputAllowed to check client pid.
Check calling uid with AID_AUDIOSERVER instead of calling pid with
own pid. This is consistent, and works if AudioFlinger and
AudioPolicyManager exist as different processes.
Remove getpid_cached since getpid() is very fast. This removes
any initialization issues.
Replace getuid() with AID_AUDIOSERVER to remove ambiguity of
multiple native audio services for multiple users. Only
one exists regardless of users.
Do not use multiuser UID checks for certain native services
that do not spawn for multiple users to prevent accidently exposure.
Move permission checks to use ServiceUtilities for control and
consistency.
Rename isTrustedCallingUid to isAudioServerOrMediaServerUid
so that permission check is explicitly known to caller.
Update MediaLogService to use ServiceUtilities.
Test: Basic sanity
Test: AudioTrackTest, AudioRecordTest, SoundPool, SoundTrigger
Bug: 79485140
Change-Id: Ib8ccb36929a9b4806c01626f32fa023a046d6020
Handle A2DP codec config change in audio HAL without
closing / re-opening outputs or invalidating streams
from AudioPolicyManager.
Bug: 79476124
Test: music playback over BT A2DP
Change-Id: I87263da32815a4d4f6273068ef0b2a5b93c73b75
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
Some system apps (not having system AIDs) still need this
hidden API due to lack of better option for media use case routing.
Add protection by privileged permission MODIFY_AUDIO_ROUTING instead.
Bug: 79475856
Test: manual regression for music playback over speaker and bluetooth
Change-Id: Icaa585a9fa4c043c291f24c9bab4a93f02406955
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
Remove special timeout for long binder command added to
work around issues b/78901123, b/72823323 and similar
Bug: 72823323
Test: connect/disconnect BT headset while playing music
Change-Id: Ic5b57673ee95c29e5510af3b647ff3beb84dd7d7
When a transaction to IAudioFlinger or IAudioPolicyService is detected
from an unauthorized source, return the INVALID_OPERATION status in
reply Parcel and not as transaction status.
Also removed check on SET_RINGER_MODE as it is not implemented on client
side and allow SET_MODE from system AIDs instead of just audioserver.
Bug: 78615605
Test: manual audio smoke tests.
Change-Id: Ia4fdfc22f049da69aaa9d45075e1c502eecf4521
In case of an audioserver crash, clients that registered AudioPort
cb are no more notified of Port and Patch update (only Service Died
continues to work).
The AudioPolicyService client shall upon registration set again the
cb flag to continue beeing notified.
Also clear binder caller identity before registering a client to
audio flinger and audio policy services to avoid registering the
wrong client when get_audio_flinger() or get_audio_policy_service()
is called while executing a binder call.
Bug: 78506562
Test: launch a test app registering to Port Callback. Check upon
setDeviceConnectionState and createAudioPatch that cb are called.
Kill the audio server, and check cb continue to be called.
Change-Id: If1e803f59cb02fba84b6259e9da2d7031235d9c2
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
This is analogous to similar code in AudioTrack::restoreTrack_l().
Bug: 77682459
Test: Connect USB headset. Start Skype call. Note input audio on DUT is
heard on remote phone. Manually kill audio server, verify that input
from USB headset is restored on DUT and heard on remote phone.
Change-Id: Icbf624aba8a3fe6917b132d8c38c2812f9519ec6
(cherry picked from commit 7820494133)
Only allow setParameters() for reserved keys when received from
audioserver UID. For instance, keys used to control routing or audio
stream configuration are reserved for use by audio policy manager.
Also use multiuser_get_app_id() instead of duplicated code to
extract application ID from UID.
Bug: 77869640
Test: manual audio smoke tests.
Change-Id: I88852e8fddf7f705e4a084fc02d9ced1f4b0de92
This is analogous to similar code in AudioTrack::restoreTrack_l().
Bug: 77682459
Test: Connect USB headset. Start Skype call. Note input audio on DUT is
heard on remote phone. Manually kill audio server, verify that input
from USB headset is restored on DUT and heard on remote phone.
Change-Id: Icbf624aba8a3fe6917b132d8c38c2812f9519ec6
Zero initialize structs before parcel read, if status is not checked.
Sanitize parcel read audio_port_config.
Test: Audio CTS, See bug for POC
Bug: 73126106
Merged-in: Iece43eb463385927e6babcf93654eea8aaebc29c
Change-Id: Iece43eb463385927e6babcf93654eea8aaebc29c
Audio policy manager methods must always be executed with the
level of priviledge of audioserver process.
After checking calling permissions, audio policy service will
clear binder caller identity before calling into audio policy manager.
Also add restrictions for start source and stop source binder
transactions.
Bug: 77869640
Test: manual audio smoke tests
Change-Id: I993d4fddcea9bfa3f44093c38406b85d69ca8890
This parameter will be used to set user's preferred audio language
to the MSD HAL. The MSD HAL will use this as a preference indication
when selecting an audio presentation to decode and render
for next generation audio codecs such as AC-4.
Bug: 63901775
Test: make
Change-Id: Ic1da11ced50857f62affd636ba197fb8e6759110
Signed-off-by: Previr Rangroo <prang@dolby.com>
Prior to this CL, if an AudioTrack client wrote audio data after
AudioTrack stop(), but before the track was drained by the server,
the newly written client data would be consumed in the drain.
We now limit the server read to the client write position on stop.
This interlocking is essential for rapid asynchronous AudioTrack
command processing.
Test: AudioTrack CTS, SoundPool looping, bug test case
Bug: 75788313
Change-Id: Ib70e3dc46afe047a8c6cf1fb906a618b3c66cc7f
Connecting to a BT A2DP device supporting multiple codecs causes
a lot of churn on the audio service side, and it can reject
starting playback of a previously created track. As a
workaround, allow restoreTrack_l to retry in this case.
Bug: 74409267
Test: switching between 2 HD BT headsets while playing audio
Change-Id: I5d2ecf4da9ff680af7ae5bb837081b22ecd84f85
Get list of all/currently active microphones from hal.
Bug: 64038649
Test: Manual Testing and Cts test
Change-Id: Id39cae38ba040f9bc91571e713487f87c2eb67b0
Fix UID checks in audioserver to take into account multi user UIDs
where the top part above AID_USER_OFFSET contains the user number.
Bug: 76439650
Test: manual audio smoke tests.
Change-Id: I6dbd616021bcb2639c7b7369000ce911c7e7e030
Extend timeout for SET_DEVICE_CONNECTION_STATE and HANDLE_DEVICE_CONFIG_CHANGE
binder commmands in IAudioPolicyService.cpp while we investigate why BT A2DP
device connection/disconnection can sometimes take more than 5 seconds.
Bug: 74840091
Test: check that no timout occurs for A2DP headset connections
Change-Id: I7dcba80059898ac1c73d580594d4956b4608ade0
Add a mechanism to monitor execution time of incoming binder
calls to audio flinger and audio policy and cause native audioserver
restart in case of timeout.
Bug: 69250055
Test: manual. audio smoke tests
Change-Id: I01b5bf2599fb2a4cd265cbbe8d4e34b2b059aaf4
As part of change:
Remove track name offset by TRACK0.
Move track name management to the Tracks class.
Sync mixer track name to FastMixer track index.
Fixes regression introduced by commit 8ed196a.
Test: SoundPool, AudioTrack CTS, Usability
Bug: 72937362
Bug: 73004420
Change-Id: I2f1a33f6f0da66bcd7aa91e2a4b663ff822df645
add comments to native media.metrics code pointing to how they
are (and aren't) to be kept in synch with their java counterparts
that are part of the public API (and therefore pretty much fixed).
Bug: 72492234
Test: compilation
Change-Id: Ic096545a5cdfb2160c6b66438d345d8e625384b9
Block incoming binder calls to audio flinger and audio policy service
for sensitive functions if they are not coming from a system UID.
Bug: 72278478
Test: audio smoke tests. CTS tests for AudioTrack and AudioRecord
Change-Id: I78e02efffe135d5450ced125e51e2084719ca03d
the 'finalized' concept didn't pan out -- remove references to it.
Simplifies the code flow.
Also purged some uses of generateSessionID().
Bug: 71874686
Test: logcat/dumpsys
Change-Id: I39e48526a5696158d8195f47154881ca6ecda266
This is part of device enumeration. With the new add API, developer
could get the active microphones information for each channel.
Bug: 64038649
Test: Run cts and check the print log.
Change-Id: Ic63d86e533a30e40697da7522a5a81f7cfcea988
Add MicrophoneInfo class in native side and native logic for supporting
query all available microphones.
Bug: 64038649
Test: Run test and check the print log.
Change-Id: Ic0a9cce55a1265a66ba08fe81b56b56cb88ba42f
Refactor audio policy service APIs controlling audio record (startInput, stopInput, releaseInput)
To allow finer grain control per AudioRecord client and prepare for new concurrent capture
policy
Test: AudioRecord CTS test. manual test of capture use cases:
camcorder, OK Google VoIP
Change-Id: I4992fd5a115853c47be5dac5465989eb53f1287c
Client apps can have 40 tracks, up from 14 tracks
Related code cleanup:
a) Removed State nested class
b) Moved static functions to Track member functions
c) Moved static function hooks to pointer-to-member-function hooks
d) Some reorganization of touched code for recent C++ style
Test: test-mixer native mixer test
Test: SoloTester effect test
Test: SoundPool with many tracks
Test: CTS AudioTrackTest
Bug: 64161002
Change-Id: I0d09620acd715d577e776bb6f76e94e87e554520
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
audio.h and its dependencies (audio-effect.h, sound_trigger.h...)
used to be shared between system and vendor code.
This led to multiple problems:
1) Such sharing contradicts the Treble policy of
strict independence of framework and vendor code.
2) When audio.h was changed, every vendor needed to update
its code in the next release. This meant that audio*.h
headers were mostly changed in backward compatible manner.
Nevertheless, for P the HIDL interface and thus the audio.h
interface are changed in backward incompatible way.
(Some enum are becoming 64 bit long).
3) As the headers were common, some API used only by the framework
needed to be visible to the vendors (mostly enum values).
4) Treble policy is to support at least one previous HAL version
As a result the audio*.h headers are now duplicated,
one set for the framework, and one for the vendor.
Each set will evolve independently. After this split,
the framework-only APIs will be removed from the vendor headers
and vice versa.
The split is implements as such:
+ for system code
- NOT moving the libaudio_system_headers
Eg: system/audio.h and system/audio_effects/effect_equalizer.h
are still in system/media/audio
- the legacy audio HAL API that were in libhardware headers
are now in libaudiohal_legacy_headers
Eg: hardware/audio.h and hardware/audio_effect.h
are now in frameworks/av/media/libaudiohal/legacy/
+ for vendor code
- moving libaudio_system_headers and the legacy audio HAL API
that were in libhardware_headers in
android.hardware.audio.common.legacy@2.0
Note that those headers are now versioned, so migrating to a @4.0
HIDL HAL will mean changing the legacy dependency too.
Eg: system/audio.h, system/audio-effect.h, hardware/audio.h
are now in hardware/interfaces/audio/common/2.0/legacy
- the legacy audio effect HAL API that was in libaudioeffects
is now moved in android.hardware.audio.effect.legacy@2.0
Eg: audio_effects/effect*.h are now in
hardware/interfaces/audio/effect/2.0/legacy
- the legacy sound trigger HAL API that were in libhardware_headers
is now moved in android.hardware.soundtrigger.legacy@2.0
Eg: hardware/sound_trigger.h is now in
hardware/interfaces/audio/effect/2.0/legacy
libaudioutil being used by both system and vendor, had
to be renamed for system to libaudioutil_system.
Vendor libs that now depend on the audio.h of a specific
version and are not extensively referenced in non google code,
append @2.0 to their name.
Note that headers that are not expected to change in the 4.0 HAL are
left in all-versions folder to avoid duplication.
This is an implementation detail as the versioned libraries export
the all-versions headers.
Note that strict vendor-system separation is enforced by the
build-system. The system headers are not available for vendor
libs and vice-versa.
Note that this patch is split between numerous git repository (>10),
all the commits having the same Change-id for searchability.
Note that audio_policy.h is no longer exposed to vendors
as the legacy audio policy HAL API was never officially supported.
As a result the audiopolicy stub implementation has been removed.
Test: compile taimen-userdebug walleye-userdebug
sailfish-userdebug marlin-userdebug
gce_x86_phone-userdebug gce_x86_phone
full-eng aosp_arm aosp_x86-eng
Test: check that the emulator booted and played audio
Test: full QA on sailfish-userdebug and taimen-userdebug
Bug: 38184704
Change-Id: I950f4e0a55613d72e32eba31bd563cb5bafe2d1a
Signed-off-by: Kevin Rocard <krocard@google.com>
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
change from AString to std::string for how media.metrics handles
strings. This severs the dependency on libstagefright_foundation,
where AString is implemented, so we can integrate into places
which do not want to introduce a dependency on libstagefright_foundation.
Bug: 70805723
Test: compilation/linking, CTS subset
Change-Id: I66de971b6ec354444e06112607a2d7614084cef8
Collect media metrics for audiorecord. Basic framework and initial set
of metrics.
Bug: 70569777
Test: recordings, observe stats
Change-Id: I66fce1eec46cc13a93b106c2be34d23c138920de
initial pass at collecting metrics information from audiotrack.
Bug: 70569777
Test: manual via dumpsys media.metrics
Change-Id: Ia6ed6d93bd487e4323b86dd4ffabae232f79f94b
Preferred is %#x but 0x%x is also permitted because it is widely used.
The benefit is that it reduces ambiguity and possible confusion,
without needing to read the source code for each log.
Test: builds OK and logs are less ambiguous
Change-Id: Ie2404e071d22278b8bba1e094ad336887844212c
ToneGenerator is only used for signalling, never for voice.
In order to use proper audio attributes usage and content type, convert
requests to play on stream VOICE_CALL to stream DTMF.
This will produce consistent routing and volume behavior when apps use
DTMF or VOICE_CALL streams.
Also use audio attributes when creating the AudioTrack
Test: CTS for ToneGenerator, voice and VoIP calls
Change-Id: Ic67abaeed0ea09f08ad5586cebe858e74fe21af9
This test contructs a number of AudioRecords from arguments
listed in an input file and outputs dumps of the constructed
AudioRecords to an output file.
The output file can be compared to previous iterations to spot regressions.
An reference input file and the corresponding output file are added for
further comparison.
Test: run this test
Change-Id: I0d1b596ca91c3c58f159887fbd48aa3f04ae38c2
Add a dump() method to AudioRecord.
Can be used by dumpsys or tests.
Test: run test_create_audiorecord
Change-Id: I4b3133601eeff4d5447ca2c5b13a01ff3451b6c7
Refactor the mechanism used by audio record tracks to query and
attach to an input mixer/stream in audio flinger. This will:
- reduce the number of binder transactions needed to create a record track
- move sample rate, framecount and flags validations to audio server side
- move audio session allocation to audio server side
- prepare restriction of certain binder transactions to audioserver only
Also:
- renamed openRecord() to createRecord() for consistency with AudioTrack
- make AudioRecord mStatus update consistent when calling default
contructor + set() or constructor with arguments
- make AudioClient, CreateTrackXXX and CreateRecordXXX classes derive
from Parcelable
- restore audio session ID validity check in AudioFlinger::createTrack()
Test: CTS tests: AudioRecordTest, AudioRecordingConfigurationTest, AudioPreProcessingTest
Test: manual test for capture use cases: camcorder, OK Google, VoIP calls
Change-Id: I72edaa7ddef1da11c77df21e88378e3aa9012d58
When audio_attributes_t was read from the binder parcel,
the string tags field was copied without checking that
it contained a '\0'.
This could lead to read past the end when tags were used.
This patch always adds a '\0' at the end of the buffer when
deserializing.
Bug: 68953950
Test: manual playback/record
Test: send binder payload without \0 in tags attribute, check that only
AUDIO_ATTRIBUTES_TAGS_MAX_SIZE - 1 char are printed.
Change-Id: I285258cbf7cfaf26b191d1f31b3b1e2d724c4934
Merged-In: I285258cbf7cfaf26b191d1f31b3b1e2d724c4934
Signed-off-by: Kevin Rocard <krocard@google.com>
Make sure mStatus is updated when set() is executed
from outside of the constructor
Also update mStatus when createTrack_l() is executed.
Test: manual test of audio playback use cases
Test: AudioTrack contructor test.
Change-Id: I70700c84800e144cbf34dac2f9d1526eaf7df292
This test contructs a number of AudioTracks from arguments listed in an input file
and outputs dumps of the constructed AudioTracks in an output file.
The output file can be compared to previous iterations to spot regressions.
An reference input file and the corresponding output file is added for
further comparison.
Test: run this test
Change-Id: I88e458a194a18c9ec919e1e903d49686632c18bf
Put AIDL files into a filegroup so they can be imported as sources
for framework.jar.
Bug: 69917341
Test: m checkbuild
Change-Id: Ia500ff881bcc8d4a6f0aa66e12d9e6bb5a07ecc1
Refactor the mechanism used by audio tracks to query and attach
to an output mixer/stream in audio flinger. This will:
- reduce the number of binder transactions needed to create a track
- move sample rate, framecount and flags validations to audio server
side
- move audio session allocation to audio server side
- prepare restriction of certain binder transactions to audioserver only
Test: CTS tests for AudioTrack
Change-Id: If4369aad6c080a56c0b42fbfcc97c8ade17a7439