summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
Commit message (Collapse)AuthorAgeFilesLines
* AudioRecord: use audio attributes instead of audio source.Eric Laurent2014-11-256-94/+99
| | | | | | | | | | | | | | | | Added AudioRecord constructor with audio attributes. Replaced AudioPolicymanager::getInput() by getInputForAttr(). No new functionality for now. Also: - Fixed warnings in AudioPolicyManager - Allocate audio session ID before calling getOutputForAttr() in AudioTrack. Bug: 16006090. Change-Id: I15df21e4411db688e3096dd801cf579d76d81711
* audio policy: do not route accessibility prompts to compressed outputEric Laurent2014-11-251-0/+15
| | | | | | | | | | | | | When a digital output (HDMI or S/PDIF) is configured with a non linear PCM audio format it is likely that the audio HAL or HW will not be able to mix other sounds with the main media stream being played. In this case, do not condider HDMI or S/PDIF as a valid route for accessibilty strategy so that accessibility prompts are always audible. Bug: 18067208. Change-Id: If20603a1dc1dc470f206f841308bed2b87daf21c
* audio policy: new getOutputForAttr() prototype.Eric Laurent2014-11-257-92/+213
| | | | | | | | | | | | | | | | | | | | | | | Update getOutputForAttr() prototype and group all logic dealing with audio attributes to stream type conversion in audio policy manager. getOutputForAttr(): - specifies the audio session (for future use) - returns a status code - receives either stream type (for legacy) or audio attributes - returns an updated streamtype Remove logic dealing with legacy stream types to attributes conversion from AudioTrack. Use correct type for audio sessions in other APIs (startOutput() ...). releaseOutput() specifies the audio session (for future use). Bug: 18067208. Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
* fix the build.Eric Laurent2014-11-251-8/+1
| | | | Change-Id: Iab6b65327ae1adbf0b3a6da5a23b8107468f533e
* audio: new routing strategies and stream typesEric Laurent2014-11-216-35/+130
| | | | | | | | | | | | | Added new routing strategies and stream type for internal use by audio policy manager and audio flinger: - One for accessibility to allow different routing than media - One for re-routing (remote submix) in preparation of dynamic policies - Added stream type for "internal" audio flinger tracks used for audio patches and duplication. Bug: 18067208. Change-Id: I88f884b552e51e4a49c29125e5a1204cf58ff434
* AudioSystem: fix cross deadlockEric Laurent2014-11-202-8/+11
| | | | | | | | | | | | | | | | | | | | Do not hold gLockAPS when calling AudioPolicyService::registerClient() in get_audio_policy_service(). registerClient() will need to acquire the AudioPolicyService mutex and if at the same time a method called from AudioPolicyService (with mutex held) calls back into AudioSystem and get_audio_policy_service() a cross deadlock occurs. Same preventive fix for get_audio_flinger(). Use a separate mutex for notification client list in AudioPolicyService. This prevents deadlocking if registerClient() is called as a consequence of AudioFlinger calling back into AudioPolicyManager while executing a method with AudioPolicyService locked Bug: 18403952. Bug: 18450065. Change-Id: Ia832e41aede8bc6c843fc615508fbdd74e0863b5
* audio policy: do not prevent routing to A2DP when suspended.Eric Laurent2014-11-171-4/+12
| | | | | | | | | | | | | | | | | Allow A2DP sink selection even if A2DP is suspended. It is not because use of A2DP is temporarily disabled by SCO selection that the policy rule routing a given use case to A2DP should be altered. The source will be routed to A2DP but it will remain silent until suspend condition is cleared which is the purpose of suspend mode. Also make sure that accessibility prompts are audible while in call by forcing stream type to STREAM_VOICE_CALL. Fix inconsistent logic between AudioTrack::setStreamTypeFromAttributes() and AudioPolicyManager::getStrategyForAttr() Bug: 18095151. Change-Id: I1c75dd8288ed3dd494eb942060eac9c9660dca50
* audiopolicy: Update input device check in checkInputsForDeviceEric Laurent2014-11-171-3/+6
| | | | | | | | | | | | | | | | - When an input device is disconnected, checkInputsForDevice clears dynamic fields of input profiles that are supporting the disconnected device. AUDIO_DEVICE_BIT_IN mask is missing while comparing with the supported input devices of a profile which is resulting in clearing wrong fields - Fix is to include AUDIO_DEVICE_BIT_IN in this comparison - also fix two other places where comparison with input device was not masked with AUDIO_DEVICE_BIT_IN. Bug: 18367045 Change-Id: Icc94b8353bc49567d8a6d6a75293c3b0dd42d83c
* Support speaker routing for FLAG_BEACONJean-Michel Trivi2014-10-312-9/+148
| | | | | | | | | | | | | | | | | | | | Add support for routing audio stream to the speaker when audio attributes carry the FLAG_BEACON value: - associate streams with FLAG_BEACON to the up-to-now unused STREAM_TTS ("Transmitted Through Speaker"). The remapping happens in AudioTrack. - AudioPolicyManager: define new strategy for handling the Beacon behavior, that only goes to speaker. Define new volume curves for STREAM_TTS that are not silence only for the speaker device category. Keep ref count of other streams and never play Beacon streams when anything else is playing: either don't start playback if something else is playing, or unmute STREAM_TTS when it's allowed to play and mute when it's done. - Take into account muting latency when starting an output. Bug 15415971 Change-Id: I26539c7ec1a486accd85bbeb1623e9c7d3a1192f
* audio policy: fix commit dea1541fEric Laurent2014-10-302-18/+18
| | | | | | | | | | | | Fix return types in early returns added by commit dea1541f in AudioPolicy binder call methods. Also fix former similar mistakes found nearby. Bug: 18001784. Bug: 18002005. Change-Id: I088c6029ca04e2c2c2f78e560c9cb6b9576dd88f
* Merge "audio policy: validate stream type received from binder calls." into ↵Eric Laurent2014-10-302-0/+42
|\ | | | | | | lmp-mr1-dev
| * audio policy: validate stream type received from binder calls.Eric Laurent2014-10-282-0/+42
| | | | | | | | | | | | Bug: 18001784. Bug: 18002005. Change-Id: I8efa674dceff5a6e10251b1c7a55e9bb2d532395
* | Merge "Always use an address for remote submix" into lmp-mr1-devJean-Michel Trivi2014-10-281-4/+27
|\ \
| * | Always use an address for remote submixJean-Michel Trivi2014-10-271-4/+27
| |/ | | | | | | | | | | | | | | | | | | | | Usage of remote submix device for audio rerouting (e.g. wifi display) didn't mandate the use of addresses. Use "0" as the default address when none is specificed. In logs, only use hex format for audio devices Bug 16009464 Change-Id: Ibfb1ce6881eba8b7e34420293b8a7077a6e659e6
* | audio policy: fix output device command after clearing audio patchEric Laurent2014-10-281-4/+8
|/ | | | | | | | Make sure that a valid audio patch is created again on an output stream following the disconneciton and reconnection of the same output device. Bug: 18144611. Change-Id: I72387ad8e93f8fb2571da2a6c58a6e167ac7fc4d
* audio policy: fix multiple device volumeEric Laurent2014-10-271-2/+8
| | | | | | | | | | | | | | Whem multiple devices are selected by a strategy, apply volume to all these devices when one of them is changed by setStreamVolumeIndex() API. Also only consider devices supported by current output profile in checkDeviceMuteStrategies() to avoid muting a stream because of devices connected to another output stream. Bug: 17507571. Change-Id: I83ef9fb7f294214d30f7f890db44c64ece3be387
* am 7de5ac1f: audio policy: fix effect handle leakEric Laurent2014-10-211-36/+41
|\ | | | | | | | | * commit '7de5ac1f067ec61f7ea424d5534cfd40987b11fa': audio policy: fix effect handle leak
| * audio policy: fix effect handle leakEric Laurent2014-10-211-36/+41
| | | | | | | | | | | | | | | | Fix ref counting error in AudioPolicyEffect::addInputEffects() and addOutputSessionEffects() Bug: 17675112. Change-Id: I5267d1024a585919f66ead83662e57b78ba53540
* | am a2d4a6da: audio policy: Fix for voice call audio lossHaynes Mathew George2014-10-161-0/+20
|\ \ | |/ | | | | | | * commit 'a2d4a6dac432f0c4f543d79b9a63c55ae91f81d6': audio policy: Fix for voice call audio loss
| * audio policy: Fix for voice call audio lossHaynes Mathew George2014-10-151-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Audio Policy service filters out one of the create patch commands when it finds two pending commands with the same patch handles. Due to this routing command is not received to audio HAL and the voice call set up fails. Fix this by filtering create patch commands only when they are issued on the same output. authored-by: Karthik Reddy Katta <a_katta@codeaurora.org> Bug: 17787282 Change-Id: If36f0ab71e9b72d6a8eb61d31f762bc5e1683b89
* | fix FM no sound issueHochi Huang2014-10-142-4/+8
| | | | | | | | | | | | | | | | Review: https://partner-android-review.git.corp.google.com/#/c/184276 Signed-off-by: Carson Liao <carson.liao@mediatek.com> Change-Id: I0847c8a6e6d054a9258b52402c914105d902c573
* | am 9286354c: Merge "Revert "audio policy: add support for ↵Dave Burke2014-10-122-13/+1
|\ \ | |/ | | | | | | | | | | ro.audio.media_deep_buffer"" into lmp-dev * commit '9286354c0a864ce2348cc7dfc6ca81e84a15f8e2': Revert "audio policy: add support for ro.audio.media_deep_buffer"
| * Revert "audio policy: add support for ro.audio.media_deep_buffer"Vineeta Srivastava2014-10-112-13/+1
| | | | | | | | | | | | This reverts commit 95511add8ad4d440c67272503559f5042c4e6f1f. Change-Id: I76a8b86790b06b08d8ca0f8d374e585f964ffba8
* | am ffd5cdbd: Merge "audio policy: add support for ↵Eric Laurent2014-10-112-1/+13
|\ \ | |/ | | | | | | | | | | ro.audio.media_deep_buffer" into lmp-dev * commit 'ffd5cdbd3e3faa203539e26adc755f860c8cac80': audio policy: add support for ro.audio.media_deep_buffer
| * audio policy: add support for ro.audio.media_deep_bufferEric Laurent2014-10-102-1/+13
| | | | | | | | | | Bug: 17931716. Change-Id: Ife170f20f5d02b71059fbd384bd29759fafee826
* | am f5ada6ed: audio policy: move intializations to onFirstRef()Eric Laurent2014-10-102-0/+7
|\ \ | |/ | | | | | | * commit 'f5ada6edcc83bb1b313abcd4c4fbdc4f7724f04d': audio policy: move intializations to onFirstRef()
| * audio policy: move intializations to onFirstRef()Eric Laurent2014-10-102-0/+7
| | | | | | | | | | | | Bug: 17896324. Change-Id: I3bb74f5397142ac354bd815eb362e5ddacdcb463
* | am 07811789: Merge "audio policy: fix build with USE_LEGACY_AUDIO_POLICY" ↵Eric Laurent2014-10-072-2/+3
|\ \ | |/ | | | | | | | | | | into lmp-dev * commit '07811789ebf31f5317403356f624d04282e666aa': audio policy: fix build with USE_LEGACY_AUDIO_POLICY
| * audio policy: fix build with USE_LEGACY_AUDIO_POLICYEric Laurent2014-10-072-2/+3
| | | | | | | | | | Bug: 17894512. Change-Id: I6431c0b03ba02cf561413c34848a334caa0261fa
* | am 5bee844f: Merge "audio policy: fix lockup during mediaserver restart" ↵Eric Laurent2014-10-075-115/+186
|\ \ | |/ | | | | | | | | | | into lmp-dev * commit '5bee844fd8c2f6d9fa78ed5e063a8e3df9f2f7b6': audio policy: fix lockup during mediaserver restart
| * audio policy: fix lockup during mediaserver restartEric Laurent2014-10-075-115/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When pre or post processing effects are applied by audio policy service automatically there is a potential lockup if the first call into AudioPolicyService is made while creating one of those effects. This is because effects are created with AudioPolicyService mutex held and effect creation calls into methods (e.g registerClient()) which also acquire the mutex. The fix consists in adding a new mutex to AudioPolicyEffects class and not hold the AudioPolicyService mutex when calling methods in of class. Bug: 17830596. Change-Id: Ie61c3671d3147f46e99ba208f39c1a3bf180779f
* | [AU] Import gain setting into portsHochi Huang2014-10-031-0/+16
| | | | | | | | | | | | | | | | Review: https://partner-android-review.git.corp.google.com/#/c/183780 Signed-off-by: Hochi Huang <hochi.huang@mediatek.com> Change-Id: I415d0b494b9bfadf783280aeea6ad46e0a242cfb
* | Merge "[AU] Update volume setting and Audio Device API 3.0" into lmp-sprout-devNicholas Sauer2014-10-012-6/+16
|\ \ | |/ |/|
| * [AU] Update volume setting and Audio Device API 3.0Hochi Huang2014-09-302-6/+16
| | | | | | | | | | | | Signed-off-by: Hochi Huang <hochi.huang@mediatek.com> Review: https://partner-android-review.git.corp.google.com/#/c/182522 Change-Id: Ida2dfedc6eaa3204354cdc182e0ee13a35472661
* | audio policy: fix HW A/V sync output selectionEric Laurent2014-09-291-1/+3
|/ | | | | | | | | | | commit b732cf5a broke the selection mechanism for the HW A/V sync direct output. Add a rule to only select a mixed output for basic PCM stereo content when a direct output is not explicitly requested. Bug: 17702382. Change-Id: I1387690ace77cd4d6a8faf0b525c3d1008fba3f1
* Merge "audio policy: favor mixed over direct output for PCM format" into lmp-devEric Laurent2014-09-261-1/+11
|\
| * audio policy: favor mixed over direct output for PCM formatEric Laurent2014-09-261-1/+11
| | | | | | | | | | | | | | | | | | | | | | modify getOutputForDevice() to skip direct output selection if the request can obviously be attached to a mixed output This prevents from selecting a direct output profile that can manage stereo PCM format if a mixer output is available to reach the same device. Bug: 17628413. Change-Id: I02e9a0b02c9ae5f44ff5768ac4ed02ce84d521c5
* | audio: fix stream type for accessibility usageEric Laurent2014-09-254-1/+18
|/ | | | | | | | | Make sure that accessibility prompts are heard when a ringtone is active by forcing stream type to AUDIO_STREAM_RING when phone state is AUDIO_MODE_RINGTONE. Bug: 17558149. Change-Id: Ia3bead8052fca5cbf282c267f7b9b06014fef628
* audio policy: add hw hotword flag for inputsEric Laurent2014-09-192-31/+69
| | | | | | | | | | | | | Audio input profiles can indicate flag AUDIO_INPUT_FLAG_HW_HOTWORD meaning they allow capture from the same source as HW hotword detection. When a client requests capture with this flag, the policy will try to find an input profile matching this request first and fallback to a regular input if not found. Bug: 17575019. Change-Id: Ia463211597d7fa363527d776389f2257f0ced9a2
* audio policy: fix attached devices validationEric Laurent2014-09-161-76/+94
| | | | | | | | | | | | Consider all supported devices in an io profile and not only the first one when looking for a match with attached devices. Failing to do so would cause the device validation to fail if supported devices are not declared in a specific order in the io profile descriptor in audio_policy.conf Bug: 17532764. Change-Id: Id27c9192e21de7f075076e17eb8c48e7e42847f6
* audio policy: fix relative priorities of PHONE and ENFORCED_AUDIBLEJon Eklund2014-09-121-7/+15
| | | | | | | | | ENFORCED_AUDIBLE should only be highest priority if system tones are being forced. Otherwise it should behave like SONIFICATION. Bug: 17474485. Change-Id: Ia651779870d51100cc3179c96fa09694bc691ba7
* audio policy: fix check in creaateAudioPatch()Eric Laurent2014-09-121-3/+3
| | | | | Bug: 17488759. Change-Id: I9dd2c3ca7f83de4b3573f4fb0e9934e1bc37c3bc
* AudioPolicyManager: Use "safe" speaker for notifications if availableJon Eklund2014-09-101-0/+21
| | | | | | | | | | | | | | | On particularly loud devices, unexpected audio bursts can be harmful. For longer audio events, the conventional mitigation strategy is to somehow soft-start (ramp) the loudspeaker volume, but this strategy can severely impact the audibility of short audio events. Use of the "safe" speaker path hints to AudioHAL to immediately output at best allowable level for transient audio events. SPEAKER_SAFE is aliased to SPEAKER for purposes of volume control. Bug: 17319721 Change-Id: I75187c23f3d1f18e9f638c5d14e7b0bf805a67bc
* audio policy: fix output stream selectionEric Laurent2014-09-082-6/+27
| | | | | | | | | Make sure that all outputs considered by selectOutput() when called from AudioPolicyManager::getOutputForDevice() support the requested audio format. Bug: 17340382. Change-Id: I76520ce60e9a8fe4d2d23125d6143bb016522754
* Merge "audiopolicy: fix direct output profile probing" into lmp-devEric Laurent2014-09-081-7/+39
|\
| * audiopolicy: fix direct output profile probingEric Laurent2014-09-071-7/+39
| | | | | | | | | | | | | | | | | | Do not select maximum sampling rate and channel count when opening a direct output for the first time to make sure that the combination of sampling rate and channel count is supported by the connected sink. Bug: 17047809. Change-Id: I077a3c1436158378f2762343469ceb39fab9775e
* | Merge "Fix "invalid device combination" in system audio mode." into lmp-devJungshik Jang2014-09-061-0/+7
|\ \ | |/ |/|
| * Fix "invalid device combination" in system audio mode.Jungshik Jang2014-09-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | HDMI-CEC system audio mode removes speaker from output list. It also has multiple outputs by connected outputs. However, getDeviceForVolume() doesn't cover multiple output with no speaker or bluetooth case. This change picks one of system audio outputs in order. Bug: 17400026 Change-Id: I102fd0052c9c4c9543f9e8f3b16ec6815d7485d8
* | audio policy service: filter out delayed audio patch commands if needed.Eric Laurent2014-09-051-1/+35
|/ | | | | | | | | | As for set parameters commands, create or release audio patch commands modifying the same patch handle should be filtered by the audio policy service command thread so that an immediate command is not overridden by a pending delayed command. Bug: 17379728. Change-Id: I6aa4652b4bfec59eebd3c3cb7d1d9ac1bc1d6e49
* Merge "audio policy: fix input source passed to openInput()" into lmp-devEric Laurent2014-08-291-2/+4
|\