History log of /frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1b4d229ee6b2abef871bcfcd30e0f1d7a1e42afb 31-Mar-2015 Eric Laurent <elaurent@google.com> DO NOT MERGE - audio policy: fix DeviceVector::getDevicesFromType()

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
3ae5f31393609b7fa92f24132c66e9a8c9244a45 04-Feb-2015 Eric Laurent <elaurent@google.com> audiopolicy: send device connect notification to HALs

Device disconnect notifications are sent from audiopolicy to
the HALs. Send connect notifications as well.

Bug: 19249796.
Bug: 17785277.

Change-Id: Ia823ed154d6a0c7ceb84b0a94f0c3b78392faaf6
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1bf8a21018cc1d95dc3c28b5044aeda327c7b54e 30-Jan-2015 Eric Laurent <elaurent@google.com> Merge "audio policy: add fallback for output selection" into lmp-mr1-dev
a82797faddb37adb2d441737884576684c8515cb 30-Jan-2015 Eric Laurent <elaurent@google.com> audio policy: add fallback for output selection

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
d99c6855901e4b2625aaad3fc24cff5ecf675fa3 30-Jan-2015 Eric Laurent <elaurent@google.com> Merge "audio policy: match attached device to declared devices" into lmp-mr1-dev
a1d525fbf2c1e0b2c61e5d29f338b0a0d8823436 29-Jan-2015 Eric Laurent <elaurent@google.com> audio policy: match attached device to declared devices

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
0d84ba3fd82038cb721ffae234a99e6751ed7fbe 29-Jan-2015 Jean-Michel Trivi <jmtrivi@google.com> Merge "Fix FLAG_BEACON regression" into lmp-mr1-dev
79ad438ed25c59a37244a48899263bbc4bc92f5d 29-Jan-2015 Jean-Michel Trivi <jmtrivi@google.com> Fix FLAG_BEACON regression

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1db89b9c2692fd70eb1cc98b7db2f9beed81e66e 28-Jan-2015 Eric Laurent <elaurent@google.com> Audio policy: fix device gain initialization

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
c447ded04f11169e9b96b31cd196b2c4ffa9f31c 06-Jan-2015 Eric Laurent <elaurent@google.com> fix record from default input source

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
3190e67d5c80c1e39e3be91784110af1180cd182 30-Dec-2014 keunyoung <keunyoung@google.com> close remote submix's output when device is not available.

- 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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
a34c9ce292ea984e92d8f70d2c056e5372c4f452 19-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: fix isSourceActive() for hotword

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
2cbe89a82d4167c5d5bcf3024edc22ab6874143a 19-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: improve accessibility routing

Force re-evaluating accessibility use case routing
when a condition affecting it (ringtone, alarm, call state)
is changing.

Bug: 18761698.
Change-Id: I42ac3a9fdc80bce11cf0a7fc76f680af4271abc9
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
71b52b5bb3be81bffa320241ca486fbf964d743e 17-Dec-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "Fix routing not happening after change in output device list" into lmp-mr1-dev
277c7b8c41436125742339d8c80bccf0f2b086d9 17-Dec-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "Fix permission check for audio recording" into lmp-mr1-dev
fe472e292ab50c121ff93dffa3b54c96feedcfef 16-Dec-2014 Jean-Michel Trivi <jmtrivi@google.com> Fix routing not happening after change in output device list

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
be845fce36a65139eb353ba7442eba951b1ebee3 16-Dec-2014 Eric Laurent <elaurent@google.com> Merge "audiopolicy : Fix for incorrect input device selection" into lmp-mr1-dev
dc136ffee31f21da3b31240f8a22d4d08a658d0d 16-Dec-2014 Eric Laurent <elaurent@google.com> audiopolicy : Fix for incorrect input device selection

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
cd71a69d922eab2929faf8f5652fcd1b9a29cbe8 16-Dec-2014 Eric Laurent <elaurent@google.com> audio: Force audio to Speaker if requested during VOIP call

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
97bb33f58d742539f3382583d7978fca71ffa2d5 13-Dec-2014 Jean-Michel Trivi <jmtrivi@google.com> Fix permission check for audio recording

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
c73ca6ef04136f28306784ad35f444538f081957 12-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: fix remote mic capture

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
c722f30eef03e77054395ae122470cf8dba93937 10-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: suppport for dynamic source

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1767df778e20c1395afc63b3a0479bd903e7b9f0 10-Dec-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicyManager: distinguish between mirroring and rerouting

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
275e8e9de2e11b4b344f5a201f1f0e51fda02d9c 01-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: add support for custom mixes

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
18265202049bfa53fe5b18a95d956325acca9c7b 06-Dec-2014 Eric Laurent <elaurent@google.com> Merge "audio policy: fix inifinite loop in clearAudioPatches()" into lmp-mr1-dev
0add0fd07401c507a77b37868f46a2ae587c30df 05-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: fix inifinite loop in clearAudioPatches()

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
0daea39f02fb1ba60a7b351bb5859e407f9f090b 05-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: fix AudioPort parameter checks

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
caf7f48a0ef558689d39aafd187c1571ff4128b4 26-Nov-2014 Eric Laurent <elaurent@google.com> AudioRecord: use audio attributes instead of audio source.

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
066ceecf4c6ed5ce26c5ddf00d7d9097d560b7a2 25-Nov-2014 Eric Laurent <elaurent@google.com> audio policy: do not route accessibility prompts to compressed output

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
e83b55dc29ca16092ba02f36f55fa6e0e37fd78c 14-Nov-2014 Eric Laurent <elaurent@google.com> audio policy: new getOutputForAttr() prototype.

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
0f78eabb733e1413d7febd00c0bad0f0add02314 25-Nov-2014 Eric Laurent <elaurent@google.com> fix the build.

Change-Id: Iab6b65327ae1adbf0b3a6da5a23b8107468f533e
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
223fd5c9738e9665e495904d37d4632414b68c1e 11-Nov-2014 Eric Laurent <elaurent@google.com> audio: new routing strategies and stream types

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
29e6cecdd8562700ab625c5645ddd6a7753789f1 14-Nov-2014 Eric Laurent <elaurent@google.com> audio policy: do not prevent routing to A2DP when suspended.

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
ddbc6657fa0c55166148ca597980edbaafc418bf 14-Nov-2014 Eric Laurent <elaurent@google.com> audiopolicy: Update input device check in checkInputsForDevice

- 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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
d9cfeb447356cb6334379eaf5da1e49424eb5979 23-Sep-2014 Jean-Michel Trivi <jmtrivi@google.com> Support speaker routing for FLAG_BEACON

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
6e8212b2a02685e50d0c093a6f44d9af636261d9 28-Oct-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "Always use an address for remote submix" into lmp-mr1-dev
b80a2a8871d3af8619bf774a0c9ddbac8d598bf9 28-Oct-2014 Eric Laurent <elaurent@google.com> audio policy: fix output device command after clearing audio patch

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
fd4c14883b268a0bc5514da135fe6b7d1ce2071b 07-Aug-2014 Jean-Michel Trivi <jmtrivi@google.com> Always use an address for remote submix

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
31551f8dd625b8d40961e141d2913b0073f852ab 11-Oct-2014 Eric Laurent <elaurent@google.com> audio policy: fix multiple device volume

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
fa845267f7cb5aede69ff1f62db99e8478db170d 12-Oct-2014 Dave Burke <daveburke@google.com> am 9286354c: Merge "Revert "audio policy: add support for ro.audio.media_deep_buffer"" into lmp-dev

* commit '9286354c0a864ce2348cc7dfc6ca81e84a15f8e2':
Revert "audio policy: add support for ro.audio.media_deep_buffer"
f2ab2191387ce7902c730cc68314ea5fdc4a9237 11-Oct-2014 Vineeta Srivastava <vsrivastava@google.com> Revert "audio policy: add support for ro.audio.media_deep_buffer"

This reverts commit 95511add8ad4d440c67272503559f5042c4e6f1f.

Change-Id: I76a8b86790b06b08d8ca0f8d374e585f964ffba8
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
6337f6032e7bdbf0b4654fb07512a00bd33ef696 11-Oct-2014 Eric Laurent <elaurent@google.com> am ffd5cdbd: Merge "audio policy: add support for ro.audio.media_deep_buffer" into lmp-dev

* commit 'ffd5cdbd3e3faa203539e26adc755f860c8cac80':
audio policy: add support for ro.audio.media_deep_buffer
95511add8ad4d440c67272503559f5042c4e6f1f 11-Oct-2014 Eric Laurent <elaurent@google.com> audio policy: add support for ro.audio.media_deep_buffer

Bug: 17931716.
Change-Id: Ife170f20f5d02b71059fbd384bd29759fafee826
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
23fe3c0a05fcb619eeb5b0c2ece02cdadab2df6e 03-Oct-2014 Hochi Huang <hochi.huang@mediatek.com> [AU] Import gain setting into ports

Review: https://partner-android-review.git.corp.google.com/#/c/183780

Signed-off-by: Hochi Huang <hochi.huang@mediatek.com>

Change-Id: I415d0b494b9bfadf783280aeea6ad46e0a242cfb
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
79e687edb9bd7e2fcc60e06dd779f98c75511045 01-Oct-2014 Nicholas Sauer <nicksauer@google.com> Merge "[AU] Update volume setting and Audio Device API 3.0" into lmp-sprout-dev
327cb70dcbf3a1f1679aeafaaa62d8532abea86d 21-Sep-2014 Hochi Huang <hochi.huang@mediatek.com> [AU] Update volume setting and Audio Device API 3.0

Signed-off-by: Hochi Huang <hochi.huang@mediatek.com>
Review: https://partner-android-review.git.corp.google.com/#/c/182522

Change-Id: Ida2dfedc6eaa3204354cdc182e0ee13a35472661
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
c260784e37dea73a2090d4ccd91472d61d3b6230 29-Sep-2014 Eric Laurent <elaurent@google.com> audio policy: fix HW A/V sync output selection

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
b732cf5af93c33fa183769210ce9954521fb68cd 25-Sep-2014 Eric Laurent <elaurent@google.com> audio policy: favor mixed over direct output for PCM format

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
5dbe47139713292bf45bbf4f1a7af0835a5ff368 20-Sep-2014 Eric Laurent <elaurent@google.com> audio policy: add hw hotword flag for inputs

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
d78f153a21868d870b14169a6928d991e4b82e73 17-Sep-2014 Eric Laurent <elaurent@google.com> audio policy: fix attached devices validation

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
966095ea014bc0f6ae9f523ee7f37f2fed2faeb5 09-Sep-2014 Jon Eklund <jeklund@motorola.com> audio policy: fix relative priorities of PHONE and ENFORCED_AUDIBLE

ENFORCED_AUDIBLE should only be highest priority if system tones
are being forced. Otherwise it should behave like SONIFICATION.

Bug: 17474485.

Change-Id: Ia651779870d51100cc3179c96fa09694bc691ba7
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
58f8eb7ae0ee400585bce6682a7212575115e758 13-Sep-2014 Eric Laurent <elaurent@google.com> audio policy: fix check in creaateAudioPatch()

Bug: 17488759.
Change-Id: I9dd2c3ca7f83de4b3573f4fb0e9934e1bc37c3bc
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
11c9fb1f90cc786485a53aeb1d31ec1ad1dbf840 23-Jun-2014 Jon Eklund <jeklund@motorola.com> AudioPolicyManager: Use "safe" speaker for notifications if available

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
8838a3895c365d443ee22e169ccf45956780c081 09-Sep-2014 Eric Laurent <elaurent@google.com> audio policy: fix output stream selection

Make sure that all outputs considered by selectOutput()
when called from AudioPolicyManager::getOutputForDevice()
support the requested audio format.

Bug: 17340382.
Change-Id: I76520ce60e9a8fe4d2d23125d6143bb016522754
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
2e97b01cecec65e690ac7da5df9433c52ff75bd8 08-Sep-2014 Eric Laurent <elaurent@google.com> Merge "audiopolicy: fix direct output profile probing" into lmp-dev
828bcffa0d5f73461c6c1ba4ef6d3da704c27b7e 07-Sep-2014 Eric Laurent <elaurent@google.com> audiopolicy: fix direct output profile probing

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
a1f9917243caafd1da5fa743c6fda1d0614ed167 05-Sep-2014 Jungshik Jang <jayjang@google.com> Fix "invalid device combination" in system audio mode.

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
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
9a63396f70880772e551e1e4c38f27c635612083 29-Aug-2014 Eric Laurent <elaurent@google.com> Merge "audio policy: fix input source passed to openInput()" into lmp-dev
1c9c2cc4b170b79a83433749808e286eb0fcc449 29-Aug-2014 Eric Laurent <elaurent@google.com> audio policy: fix input source passed to openInput()

The input source passed to openInput() must be
modified from HOTWORD to VOICE_RECOGNITION if the capture does not
correspond to a sound trigger session.

Bug: 16731718.
Change-Id: I48aa4180e75dd5335cd096b48da1c15f2236e6ed
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
f5e7e79bf88b0c08c73262e7992634797a4f81a1 19-Aug-2014 bryant_liu <bryant_liu@htc.com> audiopolicy: Indicate output device change to all input threads for pre-processing

Bug: 17129715

Change-Id: I1fd938cce0b85241c80ea00f3d013a98948d3975
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
8962e08c4989368d2c821b64f42632b6f5fb016e 28-Aug-2014 Paul McLean <pmclean@google.com> Merge "Fix audio dropouts with multiple playback streams." into lmp-dev
47f64f2ed14839a00b3b148d490dc0394282eb54 28-Aug-2014 Eric Laurent <elaurent@google.com> Merge "audio policy: remove audio patch when closing input or output" into lmp-dev
05b90f833337ab5f7b16509e5f1d339a04eb5bf6 28-Aug-2014 Eric Laurent <elaurent@google.com> audio policy: remove audio patch when closing input or output

Make sure that an audio patch having an output as source or input as sink
is removed when this input or output is closed.

Bug: 17303725.

Change-Id: I234d54a25ce0b579eeeafdcfda3a0594f048768c
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
5c477aa6205e2ebafec237411900d89a510cc105 21-Aug-2014 Paul McLean <pmclean@google.com> Fix audio dropouts with multiple playback streams.

Bug 17136569

Change-Id: I7f69cb24168c7d27ce28679735f53c1ece4014c1
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
961ec21a5878517ce6db27bad8da269637c45a44 26-Aug-2014 Marco Nelissen <marcone@google.com> Fix memory leak in getConnectionState

Turns out having an sp<> point at the containing object doesn't really
work so well.

Bug: 17210991
Change-Id: I4bcb0c38adffc574d661f0772583357868f6c5b4
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
47bf8d8f0242bbe9cfa777c96e41e5fcd5294ee4 13-Aug-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "audiopolicy: add dump for audio patches" into lmp-dev
edf103987d71f09dc2acb0a971cb40ff6608f1a5 11-Aug-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "Update audio ports with profile capabilities" into lmp-dev
f17026dfef596cf1c8008fda20f1f2ad23a3df3a 10-Aug-2014 Jean-Michel Trivi <jmtrivi@google.com> Update audio ports with profile capabilities

When opening an output, import the profile capabilities associated
with the device into the AudioPort.

Bug 10549017

Change-Id: If102f5623457542d2c1407ada303c71e43d19a08
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
4d41695d45e2c7211899afa94b20e32120b2b7e0 10-Aug-2014 Eric Laurent <elaurent@google.com> audiopolicy: add dump for audio patches

Bug: 10549017.
Change-Id: I896c8e16c8cf7490bab75295903620a76236f571
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
874c4287a4e49c59ac88767751dce00fcd3edb73 09-Aug-2014 Eric Laurent <elaurent@google.com> audio policy: enable more than one sink per audio patch.

Allow creation of audio patches with more than one sink.
More than one sink is enabled when:
- Connecting an input device to output devices on the same audio HW module.
- Connecting an output mix to output devices on the same audio HA module.

All other patches are limited to one sink.

Bug: 16879363.
Change-Id: I95be6948ef29df64e51e5b8ace38c2db7f3e89f2
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
7f04ec2a4ec94ada7ef89db8c50fd1e5c3a93a3b 07-Aug-2014 Eric Laurent <elaurent@google.com> Merge "audio policy: add support for USB devices for voice call" into lmp-dev
c2730ba7c5e9559b7499ef5e0d7742deb18c5110 21-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: add support for USB devices for voice call

Add possibility to use sink and source devices not on
the primary HW module for voice calls (e.g. USB headsets).

Bug: 15520724.

Change-Id: Ib27db4ba759b6d91ea1104dc2e35c87733517b30
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
93c3d41bdb15e39dac0faea9c5b60f1637cd477c 01-Aug-2014 Eric Laurent <elaurent@google.com> AudioSystem: add API to query audio HW sync source

Add a method to query from the audio HAL the HW sync
source used for a given audio session.
Modify audio policy to select a direct output with HW sync
when requested.

Bug: 16132368.

Change-Id: I03038f9188f2d389f8a5fd76a671854013a4513e
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
92ce4715315bddd158c7d4028556632f0547e3b9 06-Aug-2014 Eric Laurent <elaurent@google.com> Merge "audio: fix crashes upon USB device connection" into lmp-dev
cf817a2330936947df94c11859f48771f5596a59 05-Aug-2014 Eric Laurent <elaurent@google.com> audio: fix crashes upon USB device connection

- Audio policy:
Replace unknown device assertion by debug log in setDeviceConnectionState().
It is possible that some kernels indicate connection of a legacy device type
when a USB audio device is connected.
We should just ignore this device.

- Audio flinger:
Make sure FastMixer thread is idle before exiting the normal mixer thread and
closing the output stream.

Change-Id: Ia10a20176a60a8aa56765538093a555fc998508a
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
a57ab8da6fe56fdb91dfc95ebd0282eb879dde53 30-Jul-2014 Eric Laurent <elaurent@google.com> policy manager: recognize AUDIO_DEVICE_IN_AMBIENT from policy.conf

Change-Id: If46b8d13f216bad4aa62598531d406d3303134f5
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
ac29afacbb34b92f1948188e5353fce5a252ccb3 28-Jul-2014 Jon Eklund <jeklund@motorola.com> audio policy: support line output device

Change-Id: Iddf1b6486430270d871a45c75615e54339a818e9
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
df3dc7e2fe6c639529b70e3f3a7d2bf0f4c6e871 28-Jul-2014 Eric Laurent <elaurent@google.com> Add sound trigger control by audio policy

Audio policy:
- Added active capture indication to sound trigger service:
recognition stops if concurrent capture is not supported.
- Added generation of reserved I/O handle and session ID for
utterance capture.

Sound trigger service
- Added sound model update callback handling.
- Added service state callback
- Simplified callback shared memory allocation.

Bug: 12378680.

Change-Id: Ib0292c2733e6df90fdae480633dd9953d0016ef1
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
77cce80fa9d44f1e2a6bc486ad957fbbebfce3b2 05-Aug-2014 Phil Burk <philburk@google.com> [audio][policy] fix crash when offloadInfo is NULL

Added check for NULL pointer to avoid crash
in AudioPolicyManager when playing AC3 data.

Change-Id: Ie56788f6277be6da47d4218b1b4a6b359fce6473
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
222260168c144cca5a4e8f1c79df8c8baa22b591 02-Aug-2014 Eric Laurent <elaurent@google.com> audio policy: fix service fuzz test crash

Bug: 13744391.
Change-Id: I2430e09ad00476b9ac28dc55466942c61fb0531d
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
a6d28be0be0fa813080a021bd6a5920a8cb4fbb1 30-Jul-2014 Andy Hung <hunga@google.com> Merge "Add Quad channel output to AudioPolicyManager" into lmp-dev
e1d37b784f3970e44a7331c189cbfdca15404648 29-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: add missing enums in config file parsing

Change-Id: I4edd6cde11de62c9c19dfa623d08cddf42c953db
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
3a0fe12fbd08b13e9f57d79b0391186be05072f5 30-Jul-2014 Andy Hung <hunga@google.com> Add Quad channel output to AudioPolicyManager

Matches some USB device configurations.

Change-Id: I2429f9de87816b4ad1d39516e3821562617c76ee
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
8b685b9e56cc207d44b08d124148e7d752ef2241 30-Jul-2014 Andy Hung <hunga@google.com> Merge "Update multichannel audio policy handling" into lmp-dev
9a60538b9ee2b097770dcd378281b31f4218ae56 29-Jul-2014 Andy Hung <hunga@google.com> Update multichannel audio policy handling

Ensure AUDIO_FORMAT_PCM_FLOAT and AUDIO_FORMAT_PCM_32_BIT
have proper precedence.
Allow more mixer channels than 2.

Change-Id: I02af97dad6218b25cbada4d93077a213314c6725
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
4dc680607181e6a76f4e91a39366c4f5dfb7b03e 29-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: pass session ID to capture activity methods

Indicate the audio session ID when calling getInput(),
startInput(), stopInput(), releaseInput().

Bug: 12378680.
Change-Id: I763793752f93e2f4e1445a5ab217c895af011038
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
cf2c0210c8afbe7d0661ccbbae3835b5ce73c0bf 26-Jul-2014 Eric Laurent <elaurent@google.com> AudioFlinger: update openInput() and openOutput()

Add parameters to openInput() and openOutput(): device address,
input source.
Allow caller to specify a given I/O handle
Group parameters in a struct audio_config.

Bug: 12378680.
Change-Id: I7e9af74c0d996561cc13cbee7d9012d2daf33025
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
97117153a0d681be70bfa9dc9876541375355c47 28-Jul-2014 Glenn Kasten <gkasten@google.com> Merge "audio policy: compatible sample rates and channel masks" into lmp-dev
d8622371d5ac5b98abcc5d388bd952bb3dd4fda9 27-Jul-2014 Eric Laurent <elaurent@google.com> audiopolicy: fix output audio format selection

Fix two problems in output stream audio format selection
added by commit 1e693b55:
- flags must be set before picking the format.
- fix logic error in best format selection.

Change-Id: I6458b32725f771da5a08108932d64e71964ae9f1
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
cbd48023d0a0e3fd59955011538c0087a439f905 24-Jul-2014 Glenn Kasten <gkasten@google.com> audio policy: compatible sample rates and channel masks

Change-Id: I50d068a968aa6bd9e53e5b3111a1b09a6c2d219c
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
0fb47759256ecdaedbc34c880238bc9d102ef160 23-Jul-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicyManager: handle outputs for different addresses

Add the notion of device types that cause the device address
to be taken into account, i.e. multiple devices of the
same type but with a different address can be connected/
disconnected.
AUDIO_DEVICE_OUT_REMOTE_SUBMIX is such a device type.
When making those devices available / unavailable, look for
all outputs with a matching address.

Bug 16009464

Change-Id: I260f8248b7794c4932094e876afdf29fdea007a3
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
74a8e2533561f04029873446206ab407cd2e033b 24-Jul-2014 Glenn Kasten <gkasten@google.com> audio policy: clean up checking for active input

Change-Id: I85cc089df32e6d469e8aef307599f1021ea5b835
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
6a8ab05f0598f4ebdd5ef82e93cf32fde0598189 24-Jul-2014 Glenn Kasten <gkasten@google.com> audio policy: add audio_input_flags_t and mOpenRefCount

Change-Id: I5f9c7b5ebf03b9bc94efe70d3677edfabb99c194
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
83b8808faad1e91690c64d7007348be8d9ebde73 21-Jun-2014 Eric Laurent <elaurent@google.com> audio flinger: add patch connection between hw modules

Add support for audio device connections between different audio
hw modules.
The patch is performed by creating a bridge between the playback
thread connected to the sink device and the record thread connected
to the source device using a pair of specialized PlaybackTrack and
RecordTrack.
- Added PatchTrack and PatchRecord classes.
- Added TrackBase type to indicate more clearly the track behavior.
- A TrackBase can allocate the buffer or reuse an existing one.
- Factored some code in openOutput() and openInput() for internal use
by PatchPanel.

Bug: 14815883.

Change-Id: Ib9515fcda864610458a4bc81fa8f59096ff4d7db
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
c15c265676da2226a18a5373812608b19d4719d7 23-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: remove redundant fixed volume management

Remove code handling fixed device volume in
AudioPolicyManager::computeVolume() as this is already
managed by AudioService.

Change-Id: Ib2be7578e40652c85a7d44c685ff9cc703d0c969
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
daf92cc876a1952059794e6d0f558f0f6dd9ac8c 23-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: fix hotword capture

commit 1c333e2 introduced a regression causing the
wrong input source type to be communicated to
the audio HAL when starting hotword (background) capture.

Change-Id: Iec6b3c58cbc15b9988793077232ff3e7e72a4d6d
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
a204994e7dd7dab931297176c66b5d3b82e2c90b 22-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: add missing formats to audio_policy.conf parser.

Change-Id: I872c11d080c505abe3025e7bbb554ca9711de9af
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
ec40d284218466d8f0e832e7eb88e6ea6c479c88 16-Jul-2014 Glenn Kasten <gkasten@google.com> Add audio_input_flags_t to IAudioFlinger::openInput

For backward compatibility, until flags are correctly calculated,
we will assume that the request is for a low latency input stream.

Change-Id: I76746834e870df00833dc77cbdaa2edd2ffeec95
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
7b24ee381e806dcb53308c1cafc8a45f4e2d8300 15-Jul-2014 Jungshik Jang <jayjang@google.com> Revisit HDMI-CEC system audio mode in AudioService.

From recent feedback on HDMI-CEC system audio mode,
it would be unnecessary to enforce output from AudioService.
Instead, it would follow audio policy according to status
of HDMI-CEC system audio mode.
For that removed two params of setHdmiSystemAudioModeSupported
api of AudioManager.

In terms of speaker mute, it will be handled by removing speaker
from audio ouput instead of changing gain control. For that
added new force usage type, FOR_HDMI_SYSTEM_AUDIO_MODE and
new force config type, FORCE_HDMI_SYSTEM_AUDIO_ENFORCED.
This is used to notify change of system audio mode to
audio policy manager.

Bug: 16305986
Bug: 16002150
Change-Id: I702e0f9ce7c7887d5f5dd02b06a40d20e4c950df
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1e693b55d888b9d3e0a2ce770ae2b72b59c1a317 10-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: add rules to select audio parameters

Added rules to select most appropriate sampling rate, format and
channel mask from an input or output profile.
Moved mFlags from IOProfile to its base class AudioPort.
Removed bogus mChannelMask member in DeviceDescriptor class.
Improveed dump of dynamic parameters in AudioPort.

Change-Id: Ic09d320386002a8bafee4a28db00b1001a386678
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
2829edccd7d2bb8244246f316face82b650b8949 18-Jun-2014 aarti jadhav-gaikwad <agaikwad@nvidia.com> stagefright: Pass audio aac sub formats in offloadinfo

Pass audio aac sub formats in offloadinfo according to
aac profile. Audio HAL can take decision about offload
using DSP capabilities

Change-Id: If269a3654b5d2b09c183212b0646ef03e06f2d8f
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
0c94309d3c6db555b57f2e2e2dc3a0a2676ac6b7 08-Jul-2014 Jungshik Jang <jayjang@google.com> Revamp HDMI-CEC system audio mode integration with audio service.

In previous change we use setForceUse(FORCE_MEDIA, XXX) method
in order to set specific audio output type, such as LINE, HDMI_ARC,
and SPDIF. But it turns out that it conflicts with bluetooth
a2dp which uses the same setForceUse(FORCE_MEDIA, yyy).

This change is based on several conditions.

1. When other non-speaker devices are on, prevent system audio
from turing on.
2. In order to keep track of other devices' connectivity and to
turn off system audio if other device like bluetooth or
headphone preempts current output, register OnAudioPortChangeListner
to audio manager.
3. All possible system audio outputs can be merged with other
outputs without priority.

Change-Id: Ic5ccc80f9b48fb77433c347de7969837c69e58c1
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
817d3356b5c23f01620105141633616b48002779 09-Jul-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "Revise speaker volume curve for media on devices with speaker DRC"
98c6043e089743355bb6686176877f2ba5125213 09-Jul-2014 Jean-Michel Trivi <jmtrivi@google.com> Revise speaker volume curve for media on devices with speaker DRC

Bug 15318604

Change-Id: I14b451e2d8d4439fe286dd98c45d09b9dadbb4f6
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
72d039f007722c92ee5ea7ffd03ece19d2781103 09-Jul-2014 Terry Heo <terryheo@google.com> Merge "audio policy: add new input audio device"
7999a2236cb641dc1d7bf7bd8d2499d40d0a806d 27-Jun-2014 Terry Heo <terryheo@google.com> audio policy: add new input audio device

Add entry for AUDIO_DEVICE_IN_LOOPBACK to string to enum table.

Bug: 15437484
Change-Id: I552df0969c745bdf66ff9e5d7bd864ef9e3f438d
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
839e4f33906b650140b578d42d6a51300f26703c 26-Jun-2014 Jungshik Jang <jayjang@google.com> Add force usage and category for System Audio Control.

System Audio Control in HDMI-CEC delegate audio control
to audio receiver. When system audio control is selected
in audio settings as audio output it should select one of ARC, SPDIF,
and LINE as audio output.
Whenever user select System Audio as audio output, audio
setting should call
setForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM_AUDIO, AUDIO_POLICY_FORCE_XXX);
and if other output is selected it should call
setForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM_AUDIO, AUDIO_POLICY_FORCE_NONE);

Change-Id: I1c237ee9291a4e0acf01a86aff3176edce5c14e0
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
b919dd3334fed73e16ebac7b7e10cf2add34c338 26-Jun-2014 Paul McLean <pmclean@google.com> Enabling USB Device and Android Device Vol inc/dec functionality for USB Audio Output

Bug: 13747844
Change-Id: Ied5bb44f63a4e7183c52f8111e9a389b60ffe75f
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
84c70244bfea51b3413a8d8ffbf74ca737436251 23-Jun-2014 Eric Laurent <elaurent@google.com> audio policy: fix several issues on routing APIs.

- Do not list duplicated outputs in listAudioPorts(): duplicated
outputs are not valid sources for audio patches.
Also add asserts to make sure that an audio port with no valid profile
is never used by audio routing APIs.
- Fix typos causing the wrong device type to be used
when creating an audio patch.
- Fix error in building config mask in toAudioPortConfig().

Change-Id: I4505891dbed2c2fa92804d45505c3c2deb921f3e
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
beb9e30471701d7b76bc14fd0d5dd1de95edd680 19-Jun-2014 Mark Salyzyn <salyzyn@google.com> audiopolicy: 64-bit compile warnings

Change-Id: I71db11499c4b0c434df8144c633d42282f5823c2
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
ab5cdbaf65ca509681d2726aacdf3ac8bfb6b3fa 10-Jun-2014 Eric Laurent <elaurent@google.com> AudioTrack: add support for compressed audio

Add support for compressed audio playback by use
of an AudioTrack attached to a direct output thread.

Bug: 9428304.

Change-Id: I4a61be9cf0e31003ca85935d6e0ee38ca8192e03
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
5bd3f38638acab633d181359cc9ec27b80f84d43 14-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicyManager: return output for audio attributes

In AudioPolicyManager, support querying an output
or playback strategy for audio attributes,
instead of a stream type,
In AudioTrack creation, use the output returned
for the track's attributes.

Change-Id: I0fef05845ba676404775e2e338c10e6a96237268
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
7e45ef9db7446d33c941961c14555413641e444b 07-Jun-2014 Eric Laurent <elaurent@google.com> am 318cd78e: Merge "audio policy: added audio HAL version in audio_policy.conf" into lmp-preview-dev

* commit '318cd78e3b8503113919191b3711eb8be5d23d35':
audio policy: added audio HAL version in audio_policy.conf
eb108a4622825688b02d7afc981014d149913cd8 06-Jun-2014 Eric Laurent <elaurent@google.com> audio policy: added audio HAL version in audio_policy.conf

Each hardware module section in audio_policy.conf indicates
the audio HAL version it implements.

Also added a template audio_policy.conf file with examples
of device and gain descriptors added for audio HAL version3.0.

Bug: 14815883.
Change-Id: Id219d121f81f687363f6c18f2d1684b2448dcdf4
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
6f264ac08317a27958f2b0d3c35133b368dd9f3c 06-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "Audio policy: new media volume curve for speaker with DRC"
ccd8e4a9da4d0bcc2c715452c5a18fabb23f86ac 06-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> Audio policy: new media volume curve for speaker with DRC

For devices with DRC on speaker (using the flag "speaker_drc_enabled"
in audio_policy.conf), set the speaker media volume to use a
new curve with more aggressive attenuation in the upper range.

Bug 15318604

Change-Id: Ia5fb9fdd608fddad22fadfb1065d35574030bb52
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
e40ed90293eeb0feecb5b7729cf24f8ecea9b412 05-Jun-2014 Eric Laurent <elaurent@google.com> am 26594add: Merge "audio policy: new setAudioPortConfig implementation" into lmp-preview-dev

* commit '26594add1ec0b6255c96b39e43ccdc95b2c480aa':
audio policy: new setAudioPortConfig implementation
a408743e8a759b344ac95322ae336459a81edf24 04-Jun-2014 Eric Laurent <elaurent@google.com> am 4bd9d452: Merge "audio policy: removed raw pointers." into lmp-preview-dev

* commit '4bd9d45230cd69c0409591874db3e6f2e3a226b3':
audio policy: removed raw pointers.
a121f90f388343dc48793cbc7eb899aba42e7664 03-Jun-2014 Eric Laurent <elaurent@google.com> audio policy: new setAudioPortConfig implementation

Rewrite setAudioPortConfig() to take advantage of the new
AudioPortConfig class.

The configuration is now checked against AudioPort capabilities
and stored in the AudioPortConfig.

Fix a bug where the config mask was not set properly when calling
setAudioPortConfig at the PatchPanel interface.

Remove debug log in IAudioPolicyService.

Bug: 14815883.
Change-Id: I7eb7683a96e049581c13f2a212486507883d008d
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1f2f2230900581e5de9cf01a883e5d9338f0df94 02-Jun-2014 Eric Laurent <elaurent@google.com> audio policy: removed raw pointers.

Use only RefBase objects for the following classes:
- AudioOutputDescriptor
- AudioInputDescriptor
- HwModule
- EffectDescriptor

Create a common base class AudioPortConfig for:
AudioOutputDescriptor, AudioInputDescriptor and DeviceDescriptor

Bug: 14815883.

Change-Id: I1bd193ef1020780d8b94c13142029903615aba97
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
43466a133984182b250453cea244eb146e83c010 02-Jun-2014 Eric Laurent <elaurent@google.com> am 62aaabb3: audio policy: fix unitialized hw module in audio port

* commit '62aaabb3905c61bb7acd6037414c206240a31c32':
audio policy: fix unitialized hw module in audio port
62aaabb3905c61bb7acd6037414c206240a31c32 02-Jun-2014 Eric Laurent <elaurent@google.com> audio policy: fix unitialized hw module in audio port

The hw module handle was not initialized when creating
and audio port configuration from an input stream descriptor.

Bug 15376641.

Change-Id: I6c784cded68a5c665fd22c3643765c63f70eb241
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
481c8837c7f67852e06137d636915ea6e96247e3 31-May-2014 Eric Laurent <elaurent@google.com> am e1715a46: audio policy: add audio port gain control

* commit 'e1715a465a29db625da9d0ea365edf371e39e201':
audio policy: add audio port gain control
68f5fb51f6ef2f54a0955bac98c16c2aa811f809 31-May-2014 Eric Laurent <elaurent@google.com> am 1afeecb8: audio policy: parse device descriptors in config file

* commit '1afeecb88bea660b2c10b2096be0fd02433303ce':
audio policy: parse device descriptors in config file
72aa32f7dbbfb658097930b57659d8e50f24a953 31-May-2014 Eric Laurent <elaurent@google.com> resolved conflicts for merge of b52c152d to master

Change-Id: I34869bda071d511c9595ea0a5ff6571eb34da059
e1715a465a29db625da9d0ea365edf371e39e201 20-May-2014 Eric Laurent <elaurent@google.com> audio policy: add audio port gain control

Implement setAudioPortConfig() API to configure an
audio port.
Currently limited to gain control.

Bug: 14815883.

Change-Id: Ic1b268e5ba5c277e9f5b8fa63c81dd7c0b250024
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
671714b80cad4725d07691fbd8284cb869a0c27f 30-May-2014 Eric Laurent <elaurent@google.com> am 6a94d69d: audio policy: implement routing control

* commit '6a94d69dc4f32abb53c466a96f905bb199be6417':
audio policy: implement routing control
c0008d1146ccdeda0a4eb08f8225225b1b1237dc 30-May-2014 Eric Laurent <elaurent@google.com> Merge "handle in and out audio device connection separately"
1afeecb88bea660b2c10b2096be0fd02433303ce 14-May-2014 Eric Laurent <elaurent@google.com> audio policy: parse device descriptors in config file

Implement parsing of audio_policy.conf for device and gain
controller definitions.
Copy audio_policy_conf.h from hardware_legacy.
New syntax for devices and gain controllers description will not
be parsed by legacy audio policy manager.

Bug: 14815883.

Change-Id: I7f1035d514dcf55fb3e45ed1f633a2f63ee398f5
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
b52c152d553556b2d227ffc943489de0c60b4b02 20-May-2014 Eric Laurent <elaurent@google.com> audio policy: add routing update client interface

Added IAudioPolicyServiceClient client binder interface
for client process to receive notifications from AudioPolicyService
when audio ports are added/removed or audio patches created/released.

The audio patches owned by a given client are automatically released when
this client binder dies.

Bug: 14815883.

Change-Id: I6013f6aec03b50565cffb1ad2cd1f0f8852032c5
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
6a94d69dc4f32abb53c466a96f905bb199be6417 20-May-2014 Eric Laurent <elaurent@google.com> audio policy: implement routing control

Add implementation of audio routing control via AudioSystem APIs.

The following APIs are implemented:
- listAudioPorts(): return a list of devices and output/input mixers ports
that can be used as sources or sinks for audio patches.
- createAudioPatch()/releaseAudioPatch(): create/release a connection patch between
two audio ports (e.g. to connect input from an HDMI device to a speaker output device).
Only one client application can own a patch from a given source.
When an audio port (device or mix) is part of an application created patch, its routing cannot
not be changed by a policy decision.
- listAudioPatches(): return a list of existing patches.

Each audio port addition/removal and each audio patch creation/release increments a generation count.
This generation count is used to ensure consistency betwen calls to
listAudioPorts() and listAudioPatches().

Bug: 14815883.

Change-Id: I022b638c2f5f0bb41543c7cfca7488fb45cfdd80
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
b71e58b64cd4992355cf6afaf3f3530f723bc72c 30-May-2014 Eric Laurent <elaurent@google.com> handle in and out audio device connection separately

AudioService now indicates in and out device connection
separately in case of combined devices like wired headset
or BT SCO headset.

Change-Id: I97adf8343d0ce32c279ffc3cce5c84ca7a349e16
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1afdf38e0d8979e0a6bd5f3cc9b6751ca132753e 28-May-2014 Mike Lockwood <lockwood@google.com> Merge "Add audio policy support for A2DP sink"
951f455566775e5f01e67c5ee26863d7d19209d7 20-May-2014 Eric Laurent <elaurent@google.com> DO NOT MERGE - audioflinger: first patch panel implementation.

Added a new PatchPanel subclass to AudioFlinger
to handle audio ports and audio patches configuration
and connection.
The first implementation does not add new functionnality.
AudioPolicyManager uses patch panel interface to control
device routing.
AudioFlinger:
- Added PatchPanel class. The first implementation does not
add new functionnality. PatchPanel handles routing commands
for audio HAL after 3.0 or converts to setParameters for audio
HALs before 3.0.
- Added config events to ThreadBase to control synchronized
audio patch connection.
AudioPolicyManager:
- Use PatchPanel API to control device selection isntead of setParameters.
- New base class AudioPort common to audio device descriptors
and input output stream profiles. This class is RefBase and groups
attributes common to audio ports.
- Use same device selection flow for input as for outputs:
getNewInputDevice -> getDeviceForInptusiource -> setInputDevice

Change-Id: Idaa5a883b19a45816651c58cac697640dc717cd9
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
41b0e2421a0cf8dc22f224ea078678d7db651bda 14-May-2014 Mike Lockwood <lockwood@google.com> Add audio policy support for A2DP sink

Change-Id: Ifcad9c1d4bdb79668e03a31d843ec46670dd0bd8
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1c333e252cbca3337c1bedbc57a005f3b7d23fdb 20-May-2014 Eric Laurent <elaurent@google.com> audioflinger: first patch panel implementation.

Added a new PatchPanel subclass to AudioFlinger
to handle audio ports and audio patches configuration
and connection.
The first implementation does not add new functionnality.
AudioPolicyManager uses patch panel interface to control
device routing.
AudioFlinger:
- Added PatchPanel class. The first implementation does not
add new functionnality. PatchPanel handles routing commands
for audio HAL after 3.0 or converts to setParameters for audio
HALs before 3.0.
- Added config events to ThreadBase to control synchronized
audio patch connection.
AudioPolicyManager:
- Use PatchPanel API to control device selection isntead of setParameters.
- New base class AudioPort common to audio device descriptors
and input output stream profiles. This class is RefBase and groups
attributes common to audio ports.
- Use same device selection flow for input as for outputs:
getNewInputDevice -> getDeviceForInptusiource -> setInputDevice

Change-Id: Idaa5a883b19a45816651c58cac697640dc717cd9
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1b776237ec911f4bb09f42f295b41e13f5f49113 20-May-2014 Eric Laurent <elaurent@google.com> audio policy: add new audio devices

Add entries for new audio devices to string to enum table used
for audio_policy.conf file parsing.

Change-Id: Ica04c34af037d890a343af0b9eeb2ff0e5c86b02
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
99401131e58f2ff7f5571037d0d53b6f684e5543 08-May-2014 Eric Laurent <elaurent@google.com> audio policy: fix mute delay when setting output device

The duration of the temporary mute applied on each output
when switching device must be more than twice the actual delay
we wait for the mute to be effective at the output.
Otherwise some outputs with short latencies will be unmuted before the
device switch is actually executed.

This change makes sure that we take the maximum wait time into account
when requesting the delayed unmuting of each output.

Change-Id: Id92c201b47786082a44b6a5c1c8015273835a42e
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
5b61dddd0dba28922068da2487894761486aec6c 07-May-2014 Eric Laurent <elaurent@google.com> audio policy: fix typo in AudioPolicyManager constructor

Fix cut/paste error in new AudioPolicyManager constructor
causing the same index variable to be reused in nested for loops.

Change-Id: Id57ff19bf6dd8974486b07c8252029e377df2747
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
d46929666d7e4b1cad45afd7dcb883ec4dd2d49f 06-May-2014 Eric Laurent <elaurent@google.com> audio policy: update from libhardware_legacy

Merge changes made to AudioPolicyManagerBase in libhardware_legacy
since it was forked here:

fd61179 Update policy handling for USB inputs
c7b6e3c audio: allow compiling for 64-bit
c26f454 Initial implementation of USB Audio output.
a7b1bc9 Audio policy is 32-bit only
26101ad audio policy : add AUDIO_DEVICE_IN_USB_DEVICE to sDeviceNameToEnumTable

Change-Id: I22bc883c20603a6598c6ee3ded636e9cc4d9ec03
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
2f8a36fc8df14cba33fa7c5c1c9d5a52f8a133c2 27-Mar-2014 Eric Laurent <elaurent@google.com> Fix the build

Change-Id: I2169a3d26f4e35e5cfa35a1264175aab6ac4db41
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
1b512c05f46465a7b1a1d69f82937d7199d5d926 17-Mar-2014 Eric Laurent <elaurent@google.com> audio policy: remove obsolete AudioPolicyManager class members

Remove mHasA2dp, mHasUsb and mHasRemoteSubmix members from
AudoPolicyManager. They are not needed any more since
we use device descriptors with additional attributes.

Also remove obsolete limitation on device address
length (MAX_DEVICE_ADDRESS_LEN).

Change-Id: Iffe760a521692a4b50be3f6b935af84afb61bb86
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
3a4311c68348f728558e87b5db67d47605783890 17-Mar-2014 Eric Laurent <elaurent@google.com> audio policy: use new audio device representation

Represent audio devices with more attributes than just the
type (audio_device_t).
This is in preparation for new routing APIs allowing
device selection based on more criteria than just the type
(address, channel mask...)
A new class DeviceDescriptor is created and used by functions
needing more information than just the device type.
Bit fields for available and supported input or output devices are
replaced by vectors of device descriptors.
Each available device is allocated a unique ID for future use.
Removed obsolete mA2dpDeviceAddress, mScoDeviceAddress and mUsbCardAndDevice
fields replaced by address stored in DeviceDescriptor.

Policy decisions like getDeviceForStrategy() are still based
only on the device type.

Change-Id: I5de3b3ffb12ff8dcfb746782ab1e6b15bf040d0c
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
e07208765fcd5904165e425ec714a25c350a2f40 11-Mar-2014 Eric Laurent <elaurent@google.com> audio policy: renamed AudioPolicyManagerBase to AudioPolicyManager

Change-Id: Ia8b5ae9c3a9cf6ed98f162614ea331efc78e9ff2
/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp