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
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: 64038649
Test: Run cts in RoutingTest
Switch output device when playing music/video with MediaPlayer
Change-Id: I5b5c288e6557199b0a6986785f9335a18a80ab89
If client requests a fast track and this request is denied, then don't
allow notification period to exceed FMS_20. FMS_20 is the minimum task
wakeup period in ms for which CFS operates reliably. This reduces
glitching when an app uses a buffer size that is too small for the endpoint.
The theory is that if the app wanted a fast track but couldn't get it,
then at least wake it up as often as possible (while still not waking
up so often than CFS can't handle it).
Also clarify in the log when the denial is by client vs server.
Test: as described in bug
Bug: 63040475
Change-Id: I2c171bda7929a8f309c2286d868e09887680d234
Ringtone and call waiting tone for Ireland are not
following ITU-T specification.
This patch implements them as per ITU-T specification.
Bug: 68294204
Test: Build and test ringback tone for Ireland
Change-Id: I2cf3f425aec47b9dbc6ecf2ffb3aef44ca4f783c
If dual sim device has two SIM cards inserted,
in airplane mode it sets "gsm.operator.iso-country" prop
to a single comma, which prevents ToneGenerator to access
prop for "gsm.sim.operator.iso-country" - SIM provider
country code. When VoWifi is used to make a call,
incorrect ringback tone is being played (generic one),
instead if one being read from gsm.sim.operator.iso-country.
This patch fix this, and allows ToneGenerator to correctly
recognize SIM country code.
Bug: 65859291
Test: Check ringback tone during SIM2 VoWiFi in flight mode
Change-Id: Ibb57d38432f3d99f2eac568aec2a949af5e2a9cd
Bug: 65292224
- Audio policy manager should not use an unavailable device when an explicit
route is requested. This causes a device selection made by a client to
become sticky after device disconnection.
Bug: 64945845
- Remove spurious device change callback occuring after registering a
new client to audio server by creating a specific configuration event
for client registration.
- Do not keep strong references to device callback interfaces in
AudioTrack, AudioRecord and AudioSystem.
- Do not update selected device in AudioTrack and AudioRecord when
not active as the new device selection on the stream is because of other
clients activity which is not relevant to an inactive client.
Bug: 65693340
- Fix missing increment of SessionRoute ref count in getInputForAttr() for
MMAP inputs
Test: AAudio CTS tests
Change-Id: I2a01b02e8b064d352004f6065495fd99aee55745
Force 64 bit arithmetic to avoid integer overflow on 32 bit
platforms.
Test: CTS AudioTrackTest
Bug: 65536481
Change-Id: I774a7811fce08c7cbe59f0a062fd2c2d72220203
nbaio is an acronym for "non-blocking audio I/O", and nblog means
"non-blocking logger" so nblog does not belong with nbaio.
There are a lot of improvements planned for nblog, and having the
restructuring done will make it clearer as more files are added.
Test: builds OK
Change-Id: Ib28bada2566c1d64bdbe9f5d7a5ce40e080178ef
After cold start, running the test will cause failure. The reason is
that with cold start, the buffer is being processed faster than the
position callback.
Calling the callback earlier at the very start will fix this issue.
Bug: 63056426
Test: adb shell am instrument -e class 'android.media.cts.AudioTrack_ListenerTest#testAudioTrackCallback'
-w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Change-Id: I7416cecb2837fac4a966e832412948c357e7b8dc
The extended timestamp server and kernel location positions
need the proper client side delta offset for native AudioTrack API calls.
The client location position is unaffected along with the legacy timestamp.
Test: test_timestamp, Photos, kill audioserver
Bug: 65386236
Change-Id: Idd71b6a31e0e86a323d0e5e343a2836e34c08673
Added the conditions that determine the region for HK,
then support Hong Kong specific ring tone and busy tone.
Bug: 63120797
Test: Build and test ringback tone for Hong Kong
Change-Id: Ifc836321ca1ac1f670d4640305727f4ea3800716
Singapore use CEPT standard supervisory tones except
for busy and ringtone. The Singapore mapping will be
used if gsm.operator.iso-country == "sg".
Bug: 63120560
Test: Build and test ring back tone for Singapore
Change-Id: I86076b0799a741ad8c54968799e400622d223ccd
The change in "Australia Supervisory DIAL tone"
seems not following ITU-T specification.
This patch implements TONE_AUSTRALIA_DIAL as per ITU-T
specification.
Bug: 63120712
Test: Build and test ringback tone for Australia
Change-Id: I7409732e57cf8d39ac2248e7e3e10217e30a118e
Modified gb's SupervisoryTone
when the following ToneType is selected to cover
GB market/operators requirement.
- TONE_SUP_DIAL
- TONE_SUP_BUSY
- TONE_SUP_CONGESTION
Bug: 63121347
Test: Build and Test ringback tone for UK.
Change-Id: I248b1b27f4156de37fd07bc878be719e3f6d6b95
This removes the manually rolled IPlayer implementation and instead uses
an aidl generated implementation. The IPlayer aidl file is moved from
frameworks/base/.
Test: run cts --module CtsMediaTestCases
Bug: 64223827
Change-Id: Ia609f7ba1cc6f71ce919d6174dd8b5e0e1b05575
The cause of frequent "EffectModule 0xxx destructor called with unreleased
interface" messages was due to not releasing the effects when purging
stale effects.
The cause of "Effect handle 0xxx disconnected after thread destruction"
message was due to late binder call for disconnecting already purged
effect handle.
Also improved logging to communicate uuids of the effects causing
these issues.
Bug: 62267926
Test: no aforementioned warnings in the log when opening the Effects
panel in Play Music
Change-Id: I6ec6f60c46dc704226931fb59a641e4cd74c2fd1
(cherry picked from commit 424c4f5b76)
Use AIDL to generate the IAudioRecord interface rather than using
a manually implemented interface.
Bug: 64223827
Test: Ran the AudioNativeTest and CtsMediaTestCases CTS tests.
Change-Id: Iade23c73253a97c358050bbd697ebe592b89a4c0
The cause of frequent "EffectModule 0xxx destructor called with unreleased
interface" messages was due to not releasing the effects when purging
stale effects.
The cause of "Effect handle 0xxx disconnected after thread destruction"
message was due to late binder call for disconnecting already purged
effect handle.
Also improved logging to communicate uuids of the effects causing
these issues.
Bug: 62267926
Test: no aforementioned warnings in the log when opening the Effects
panel in Play Music
Change-Id: I6ec6f60c46dc704226931fb59a641e4cd74c2fd1
This releaves reviewing burden from the frameworks/av owners.
Note that the lists of owners are inherited from the parent
directories thus the people listed in these files are owners
*in addition* to people listed in frameworks/av/OWNERS,
and frameworks/av/{media|services}/OWNERS.
Change-Id: I5e2db1c40cb807b906b2701fe446c874a8d19983
Test: not needed
Implement correct indication of client UID and PID to audio flinger
for AAudio MMAP streams in both exclusive mode and shared mode.
- Add start/stop client methods on MMAP streams used only when the MMAP
stream is in AAudio service and carries a mix of shared streams.
- Add "In Service'" indication from "client" side to AAudioServiceStreamMMAP
so that the behavior can be adapted accordingly.
- Modify logic on audio flinger side with regard to mmap tracks and
audio HAL stream activity:
- use same audio session for all clients on a same stream to match
audio policy logic to share same direct output stream for clients on same
session. This is also more consistent with current volume and effect
handling as all MMAP clients sharing the same output stream have the
same volume and use case.
- start/stop the HAL when the stream is started/stopped with the initial client
handle (returned when the stream is opened) but do not create a track.
AAudioService implementation will always send an additional start command before
first client starts and a stop command after last client stops,
in both shared and exclusive mode.
- start/stop a track only if the start/stop stream command is received
with a handle different from the initial handle.
- Allow more than one active client from the same UID on a MMAP input in audio policy.
Bug: 62950008
Test: verify playback and capture in mmap mode
Merged-In: I86151bbb637ff172d2fd5f813056eab13a7bcd3c
Change-Id: I86151bbb637ff172d2fd5f813056eab13a7bcd3c
Implement correct indication of client UID and PID to audio flinger
for AAudio MMAP streams in both exclusive mode and shared mode.
- Add start/stop client methods on MMAP streams used only when the MMAP
stream is in AAudio service and carries a mix of shared streams.
- Add "In Service'" indication from "client" side to AAudioServiceStreamMMAP
so that the behavior can be adapted accordingly.
- Modify logic on audio flinger side with regard to mmap tracks and
audio HAL stream activity:
- use same audio session for all clients on a same stream to match
audio policy logic to share same direct output stream for clients on same
session. This is also more consistent with current volume and effect
handling as all MMAP clients sharing the same output stream have the
same volume and use case.
- start/stop the HAL when the stream is started/stopped with the initial client
handle (returned when the stream is opened) but do not create a track.
AAudioService implementation will always send an additional start command before
first client starts and a stop command after last client stops,
in both shared and exclusive mode.
- start/stop a track only if the start/stop stream command is received
with a handle different from the initial handle.
- Allow more than one active client from the same UID on a MMAP input in audio policy.
Bug: 62950008
Test: verify playback and capture in mmap mode
Change-Id: I86151bbb637ff172d2fd5f813056eab13a7bcd3c
Bug: 62090113
Test: run AAudio test and verify a valid device is reported just
after opening playback or capture streams in legacy mode.
Merged-In: Ic8be42e1735690eb00c811ef0cb8b5abb36172d6
Change-Id: Ic8be42e1735690eb00c811ef0cb8b5abb36172d6
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
Also for AudioRecord
Bug: 62692443
Test: write_sine.cpp
Change-Id: I5b281476af4703798129df66584d813b9a8db8bb
Signed-off-by: Phil Burk <philburk@google.com>
Make AudioStreamInternal derive from PlayerBase to
provide playback and volume control via IPlayer interface.
Bug: 62027849
Test: verify aaudio playback in MMAP mode and registration of aaudio
players in AudioService when active
Change-Id: Ia0878d46637c0a954d8a6259868a2d3bccf19119
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
Make AudioStreamTrack derive from PlayerTrackBase to
provide playback and volume control via IPLayer interface.
Bug: 62027849
Test: verify aaudio playback regressions and registration of aaudio
players in AudioService
Change-Id: I5c04110f1554233eae3f1bc357a64a584d7303d1
Generalized the IPlayer implementation done for OpenSL ES
so that it can be used by other native audio players
Created two classes:
- PlayerBase implementing the interfacin native AudioManager and
IPlayer methods
- TrackPlayerBase, a derived class specialized for AudioTrack.
Bug: 62027849
Test: verify regressions with OpenSL ES buffer queue player
Change-Id: If5ad21a3c1a243fba0b312001c5034102e6d6672
AudioTrack needs to query latency from the output descriptor each
time it uses mAfLatency to calculate timestamp or return the track
latency. Until now, the output descriptor latency was queried and
stored when a track is created. On a device switch, IO descriptors
table saved in AudioSystem is updated to reflected the latest
latency values. Unless a device switch lead to a track teardown,
AudioTrack will be unaware of the latest latency value. Therefore
explicitly check the latest mAfLatency value on each getTimeStamp
call.
Test: Podkicker 2.2x, Photos 240fps and BT
Bug: 35075600
authored-by: Aniket Kumar Lata <alata@codeaurora.org>
Change-Id: I06282182364703574a7d66d2b5cd1301679dfade
Implement device switch detection on legacy path (AudioTrack and
AudioRecord) based on audio routing callbacks forcing the stream state
to disconnected.
Bug: 33355262
Bug: 62090113
Test: tested with write_sine and input_monitor command line tools.
Change-Id: I9e0421fee233964b1bf318acb640569196a00f13
1) Limit number of VolumeShapers that can be created.
a) 16 system VolumeShapers
b) 16 application/client VolumeShapers
2) Return proper volume before VolumeShaper is started.
3) Consistent xOffset definition used internally:
a) this is now always the position on the volumeshaper curve
which can go backwards if in REVERSE.
b) normalized time is always forward going and is scaled
to 0.f and 1.f depending on progress relative to
the curve's duration.
4) Fix replace method.
5) Add comments.
Test: Use updated CTS VolumeShaperTest
Bug: 37536598
Change-Id: I837ab2a481adc0abbd3f1338bfe2cb79831b11fa
Functions in headers that are not static inline will cause duplicate
symbol errors when linking if the header is ever included twice
into different compilation units of the same module. It also causes
-Wunused-function warnings if they are not used in the cpp file, which
were hidden by the use of -isystem frameworks/av/include.
Bug: 31751828
Test: m -j checkbuild
Change-Id: I36f258bb4f5c3df54e874280beab344e63c519d5
(cherry picked from commit 413adafb04)
Functions in headers that are not static inline will cause duplicate
symbol errors when linking if the header is ever included twice
into different compilation units of the same module. It also causes
-Wunused-function warnings if they are not used in the cpp file, which
were hidden by the use of -isystem frameworks/av/include.
Bug: 31751828
Test: m -j checkbuild
Change-Id: I36f258bb4f5c3df54e874280beab344e63c519d5
The libc_malloc_debug_backtrace includes the log functions so there
is no need to also add the libc log library.
Test: Built and booted a bullhead device.
Change-Id: I00457ad0c321b385e68232ee87575588a8188db7
Consider whether VolumeShaper has been started or not when
restoring (position). If the VolumeShaper hasn't been started
we restore in that state. If it has been started already,
we advance to the end assuming the duration has been played out.
Test: CTS and headset / kill audioserver
Bug: 37536598
Change-Id: I4b55dca6f6a859563fd20bad4c8f67d2c92321c0
This will help debuging errors linked the associated bug.
Test: compile
Bug: 36509278
Change-Id: I3034a8a40d20cee15dc394baf0743be3d996a155
Signed-off-by: Kevin Rocard <krocard@google.com>
Make the binder opcode names match the method names
Test: builds OK, this does not change behavior
Change-Id: I7c56ddd1efabc81b5d0ab2d1979ba1001ec76994