summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/AudioPolicyManager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE - audio policy: fix DeviceVector::getDevicesFromType()Eric Laurent2015-03-311-2/+6
| | | | | | | | | | | | Fix device type comparison in DeviceVector::getDevicesFromType(): AUDIO_DEVICE_BIT_IN bit must be excluded from type comparison and used as an orthogonal match criterium. Manual cherry-pick from master 4c91f90 Bug: 19957479 Change-Id: Ica9f440384bcb85e669864bd29504a4fda862ce7
* audiopolicy: send device connect notification to HALsEric Laurent2015-02-041-2/+15
| | | | | | | | | | Device disconnect notifications are sent from audiopolicy to the HALs. Send connect notifications as well. Bug: 19249796. Bug: 17785277. Change-Id: Ia823ed154d6a0c7ceb84b0a94f0c3b78392faaf6
* Merge "audio policy: add fallback for output selection" into lmp-mr1-devEric Laurent2015-01-301-0/+4
|\
| * audio policy: add fallback for output selectionEric Laurent2015-01-301-0/+4
| | | | | | | | | | | | | | | | | | When getOutputForDevice() finds a matching direct output profile but fails to open it, try to fallback to downmix on mixer output when format is PCM and sampling rate allows it. Bug: 19197137. Change-Id: I197b9b202504265b6928e69740875cb7aba5c2c5
* | Merge "audio policy: match attached device to declared devices" into lmp-mr1-devEric Laurent2015-01-301-28/+43
|\ \
| * | audio policy: match attached device to declared devicesEric Laurent2015-01-291-28/+43
| |/ | | | | | | | | | | | | | | | | | | Make sure that when a new audio device is connected, and a specific profile for this device is listed in audio_policy.conf, this particular profile is used instead of a default generic profile. Bug: 19188567. Change-Id: I5f576fcd697adc041b2cfbd2bac7a51bcc2143b9
* | Merge "Fix FLAG_BEACON regression" into lmp-mr1-devJean-Michel Trivi2015-01-291-0/+3
|\ \ | |/ |/|
| * Fix FLAG_BEACON regressionJean-Michel Trivi2015-01-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | Fix regression where FLAG_BEACON is not honored anymore in terms of routing and muting behavior When converting from AudioAttributes to stream types, also look at FLAG_BEACON for mapping to STREAM_TTS Bug 19185342 Change-Id: I5871c1b94480ae3da544aef99ea9ab4dff97443d
* | Audio policy: fix device gain initializationEric Laurent2015-01-271-3/+9
|/ | | | | | | | | | | Fix initilization of default gain configuration for audio devices loaded from audio_policy.conf. Initialization cannot be done in constructor as the possible gain configurations are not loaded yet. Bug: 19120566. Change-Id: I78f057ecfa1a121365ac3d8f317912a6f1647627
* fix record from default input sourceEric Laurent2015-01-061-7/+13
| | | | | | | | | Commit caf7f48a0e broke capture from default input source on some devices: the input source is now specified as part of the audio attributes and the default source was not remapped to mic source. Bug: 18736417. Change-Id: I3f5da33cdb56f959aaef68ed1952342babc63aa0
* close remote submix's output when device is not available.keunyoung2015-01-051-23/+9
| | | | | | | | | | | - change output close logic to find the device from IOProfile rather than AudioPatch as AudioPatch handle can be cleared before disconnect. - Otherwise, remote submix can be stuck as output is never closed and does not work any more as subsequent open fails as output is already taken. bug: 18733215 Change-Id: Iddb481c91e81070e6be18996a4c8837dabd7ebdb
* audio policy: fix isSourceActive() for hotwordEric Laurent2014-12-191-5/+16
| | | | | | | | | | | Only condider AUDIO_SOURCE_HOTWORD equivalent to AUDIO_SOURCE_VOICE_RECOGNITION if the active capture was triggered by a hardware hotword recognition. Also fix activeInputsCount(). Bug: 18802896. Change-Id: I471aafcae29a76e9c323c6c0c314ef083991476b
* audio policy: improve accessibility routingEric Laurent2014-12-191-0/+8
| | | | | | | | | Force re-evaluating accessibility use case routing when a condition affecting it (ringtone, alarm, call state) is changing. Bug: 18761698. Change-Id: I42ac3a9fdc80bce11cf0a7fc76f680af4271abc9
* Merge "Fix routing not happening after change in output device list" into ↵Jean-Michel Trivi2014-12-171-0/+18
|\ | | | | | | lmp-mr1-dev
| * Fix routing not happening after change in output device listJean-Michel Trivi2014-12-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | If an output stream is active while rerouting rules are installed and recording starts, the list of outputs is not updated and therefore the stream is not rerouted to the new virtual device. The fix consists in also taking into account all the policy-related outputs when evaluating the before and after list of outputs following a connection state event. Bug 18736417 Change-Id: I6697976b3f89e2c0995e888e9046a2273361bb97
* | Merge "Fix permission check for audio recording" into lmp-mr1-devJean-Michel Trivi2014-12-171-1/+19
|\ \ | |/
| * Fix permission check for audio recordingJean-Michel Trivi2014-12-151-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define input types covering the different usecases for audio recording, and check the corresponding permissions when starting to record. Move the permission check from audio flinger to audio policy, as only the policy has the information to determine which permission to enforce. Fix missing permission when an application records audio and the audio is injected by an external policy. Bug 18736417 Change-Id: If7ec040502242c990ac8ea464db484339bdce573
* | Merge "audiopolicy : Fix for incorrect input device selection" into lmp-mr1-devEric Laurent2014-12-161-0/+3
|\ \
| * | audiopolicy : Fix for incorrect input device selectionEric Laurent2014-12-161-0/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | Some VoIP applications do not use source as VOICE_COMM but MIC and policy manager ignores the force usage in that case and selects handset-mic as input device even when BT-SCO headset is connected. Check the force usage for the AUDIO_SOURCE_MIC as well. Bug: 18606571 Change-Id: I5d5010ab396f85bf58573943c91fd815f39f57c1
* | audio: Force audio to Speaker if requested during VOIP callEric Laurent2014-12-161-1/+1
|/ | | | | | | | | | | | | | | getDeviceForStrategy is returning AUDIO_DEVICE_OUT_USB even when setForceUse is called with Speaker during VOIP call. Actual Intention is to route audio for phone strategy to USB device even after setForceUse is called with Speaker when not in voice call. It is supposed to exclude VOIP call too Added additional check for MODE_IN_COMMUNICATION so that it returns SPEAKER when setForceUse is called with speaker Bug: 18758599 Change-Id: I1c51128cc1c7bfce1cf6f1fde60b428d3a9379fc
* audio policy: fix remote mic captureEric Laurent2014-12-121-15/+32
| | | | | | | | | | | | commit 275e8e9de introduced a regression for platforms overriding AudioPolicyManager::getDeviceForInputSource() method. Fixed by defining specific non virtual methods when overiding would break remote submix implementation. Bug: 18736417. Change-Id: Id4d0a6c48da987e6fb24422f2d61c7ab0fbfc921
* audio policy: suppport for dynamic sourceEric Laurent2014-12-101-43/+97
| | | | | | | | | | | Completed support for dynamic sources: - remote submix input device is dynamically connected/disconnected when corresponding AudioTrack starts/stops. Also do not create a duplicated output for mixes used by dynamic policies. Bug: 16006090. Change-Id: Ib5b5a2159fcac9d9f410a5a2f1c64d7ebad79f72
* AudioPolicyManager: distinguish between mirroring and reroutingJean-Michel Trivi2014-12-091-2/+6
| | | | | | | | | | | | | | | | In the screen mirroring case, the notification manager queries the policy to see if media "is playing remotely": if yes, it will not request audio focus before playing a notification. This is the correct behavior for screen mirroring, but doesn't work when audio is rerouted to an external policy. This change consists in not reporting "remote" activity when playing to a mix of an external policy by looking at the address of the output on which playback is active for the given stream type. Bug 16009464 Change-Id: Iebbf5a8c738ab36c1cf2055e921c0a3472503125
* audio policy: add support for custom mixesEric Laurent2014-12-091-97/+399
| | | | | | | | | | | | | | | | | Add support for custom mixes in AudioPolicyManager. Two methods are added to register or unregister a list of custom mixes with their attributes and format. getOutputForAttr() and getInputForAttr() first look for a match in registered mixes before defaulting to normal output/input selection Remote submix device connection disconnection now takes address into account to identify the correspnoding custom mix. Bug: 16009464. Change-Id: I3f1c2a485a0fb71b1f984ed0adc9b68aa971e408
* Merge "audio policy: fix inifinite loop in clearAudioPatches()" into lmp-mr1-devEric Laurent2014-12-061-5/+2
|\
| * audio policy: fix inifinite loop in clearAudioPatches()Eric Laurent2014-12-051-5/+2
| | | | | | | | | | | | | | | | | | releaseAudioPatch() does not necessarily remove the audio patch from the list. Scan the list from the top down to avoid adjusting the index. Bug: 18621514. Change-Id: I58787154680f7cb1818509017835b1693d62190f
* | audio policy: fix AudioPort parameter checksEric Laurent2014-12-041-0/+20
|/ | | | | | | | Accept any value for sampling rate, format or channel mask if the list of supported values is empty in the AudioPort. Bug: 18575607. Change-Id: I93e1942b89c630e3fee490799a8f8d79f7831ab7
* AudioRecord: use audio attributes instead of audio source.Eric Laurent2014-11-251-35/+36
| | | | | | | | | | | | | | | | 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-251-23/+93
| | | | | | | | | | | | | | | | | | | | | | | 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-211-8/+95
| | | | | | | | | | | | | 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
* 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-311-9/+126
| | | | | | | | | | | | | | | | | | | | 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
* 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 9286354c: Merge "Revert "audio policy: add support for ↵Dave Burke2014-10-121-11/+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-111-11/+1
| | | | | | | | | | | | This reverts commit 95511add8ad4d440c67272503559f5042c4e6f1f. Change-Id: I76a8b86790b06b08d8ca0f8d374e585f964ffba8
* | am ffd5cdbd: Merge "audio policy: add support for ↵Eric Laurent2014-10-111-1/+11
|\ \ | |/ | | | | | | | | | | 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-101-1/+11
| | | | | | | | | | Bug: 17931716. Change-Id: Ife170f20f5d02b71059fbd384bd29759fafee826
* | [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-011-2/+11
|\ \ | |/ |/|
| * [AU] Update volume setting and Audio Device API 3.0Hochi Huang2014-09-301-2/+11
| | | | | | | | | | | | 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
* 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 policy: add hw hotword flag for inputsEric Laurent2014-09-191-27/+64
| | | | | | | | | | | | | 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