summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/service
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE - improve audio effect framwework thread safetyEric Laurent2017-03-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | - Reorganize handle effect creation code to make sure the effect engine is created with both thread and effect chain mutex held. - Reorganize handle disconnect code to make sure the effect engine is released with both thread and effect chain mutex held. - Protect IEffect interface methods in EffectHande with a Mutex. - Only pin effect if the session was acquired first. - Do not use strong pointer to EffectModule in EffectHandles: only the EffectChain has a single strong reference to the EffectModule. Bug: 32707507 CVE-2017-0479 CVE-2017-0480 CVE-2017-0499 Change-Id: Ia1098cba2cd32cc2d1c9dfdff4adc2388dfed80e (cherry picked from commit b378b73dd7480b584340b8028802c9ca2d625123) (cherry picked from commit 22e26d8ee73488c58ba3e7928e5da155151abfd0 with backport by <sultanxda@gmail.com>)
* audiopolicy: Constrain session events to music streamsSteve Kondik2016-07-181-0/+5
| | | | | | | | | * We're really only interested in music streams right now, but events are being generated for all streams (system sounds, etc). * Constrain for now, in the future we will filter based on client registrations. Change-Id: Ic445052028c454eed146addebcdb28c4b26c4f20
* Enforce permission for accessing fm tunerScott Mertz2016-07-082-0/+9
| | | | Change-Id: I13f3ba8fc9caaeee21597a2405a8c3629e985502
* audiopolicy: Add AudioSessionInfo APISteve Kondik2016-04-277-18/+267
| | | | | | | | | | | | | | | | * This patch introduces a new API which allows applications to query the state of the audio effects system, and receive callbacks with the necessary information to attach effects to any stream. * In the future, this may come as part of the AudioPort system, but since that's an active area of development by Google, we will dodge it for now. * The policy now simply keeps a refcounted list of objects which hold various bits of stream metadata. Callbacks are sent on stream open/close to applications which might be listening for them. Change-Id: I2d554d36e1378f4eb7b276010a3bfe8345c22ecd
* audiopolicy: Revert all session callback patches.Steve Kondik2016-04-226-206/+16
| | | | | | | | | | | | | | | | * This has been rearchitected in a better way, as this feature turns out to be more difficult than it seems. * Reverting all of this stuff and rolling it into a single commit. This reverts commit c27a16c33c78a36482336a16199b1b8be794cea4. This reverts commit 32ef0556ae58ff6b7c6fe6fb0a17d3ff7f01de31. This reverts commit 489c9fb62f02e1d23d6d6c89b22f7d19c596e65e. This reverts commit a4123803d0a0e9e0c69faa4207d357cc74a65d58. This reverts commit e13b58b988ab642d4ae5ca6d0a89013510714956. This reverts commit 47f8c7303c9e2054f1492b02b6c7472385c52dc9. This reverts commit 0479d7c79a7fd6f112e8dc7e45c009cf6602dbaa. Change-Id: Iaed9f198d806aa414c95960713e8187c98db248b
* audiopolicy: Fix notification not sent for session releaseSteve Kondik2016-04-222-4/+2
| | | | Change-Id: Ifba4025532debc50c7931d08a9bcd1593d9b1721
* audiopolicy: Clean up the messSteve Kondik2016-04-196-208/+27
| | | | | | | | | | * Since we're not using the policy directly to auto-attach, let's clean it up and remove the unused stuff. * Also fixes notifications for session release. This reverts commit 47f8c7303c9e2054f1492b02b6c7472385c52dc9. Change-Id: Ibe65f427773c6ef012dde4f289d10e4089c094ea
* audiopolicy: Update legacy policy for session callbacksSteve Kondik2016-04-161-12/+26
| | | | Change-Id: Id6f24195721a48dc5a0d3a7ff7fbee2bd8614128
* audiopolicy: Be a little smarter with auto-attachSteve Kondik2016-04-076-48/+191
| | | | | | | | | | | | | | * The edge cases, ZOMG! * Instead of relying on effects to be automatically attached, let's just always notify userspace and send a bit more information. This lets the application decide if effects should be attached rather than relying on a hard-coded configuration file. * Perform the setup in getOutputForAttr, but do it on the command thread so we don't block the client. OPO-593 Change-Id: I3900b349f2e895d51fa3a3dcc2de0c4bdf6dbc08
* audio: Send effect session notifications after startOutput successSteve Kondik2016-04-052-5/+11
| | | | | | | * Because we get a hellish firestorm during offload fallback, and our effects library really dislikes this. Change-Id: I22adb55d04502eedf03ce22f35f8b9f61de1c7b0
* audiopolicy: squashed support for pre-kitkat audio blobsc4572016-03-102-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Squash of the following: commit 40c41a743a4345ad26b6eab41755c5b474f75853 Author: chrmhoffmann <chrmhoffmann@gmail.com> Date: Sat Nov 29 19:32:27 2014 +0100 pre kitkat audio legacy policy fix for hotword (ok google) Change-Id: I5bb90fb90f373461a98609226a5cea50ac5266e9 commit d47b306954b96142323c79b976edeb3eaa3b46dd Author: chrmhoffmann <chrmhoffmann@gmail.com> Date: Sun Nov 23 18:22:35 2014 +0100 commit d47b306954b96142323c79b976edeb3eaa3b46dd Author: chrmhoffmann <chrmhoffmann@gmail.com> Date: Sun Nov 23 18:22:35 2014 +0100 pre-kitkat audio policy blobs re-activated. Change-Id: Idfcb03d0a4aa0a099bf5a17b7bf592ab402e3255 Change-Id: Iae65c6ccb6dcb120a6fc20978b8a69e6af39a51a
* audiopolicy: Defer release of output session effectsSteve Kondik2016-03-084-2/+96
| | | | | | | | | | | | | | * Some effects modules are racy and don't tolerate being destroyed and immediately resurrected on the same session. This is the common case when switching tracks, and the use of default output effects makes the problem even worse. Certain apps which handle gapless in a sloppy way are also to blame. * Instead of immediately nuking the entire descriptor with the stream, just decrease the refcount and defer it for 10 seconds. If it needs resurrected, the refcount will be increased and the delayed release command will not shoot it in the face. Change-Id: I068dd72c4180023a74eb9ccbe8a180f6f0683dbf
* audiopolicy: Add notification when default effects are updatedSteve Kondik2016-03-085-6/+122
| | | | | | | | | | | | | | | | | | | * In M, we now have the ability to define a default set of audio effect on a per-stream basis. This allows us to get around the problem of apps not sending the control intents so we can implement smart global effects for specific media types. * We still need a session id in order to get a handle and configure them from an app like AudioFX, so we'll need to add some plumbing in order to send an event to interested applications. * This patch implements the native side of this. The Java layer will call down thru AudioSystem and register a callback which will be invoked by the audio policy when default effects are updated on a stream. This callback will receive both the stream type as well as the session id. * Attaching this listener requires that the caller hold the MODIFY_AUDIO_ROUTING permission. Change-Id: I142b15f2585ffca6a953c3e828e2a7c07b24f56c
* av: Add support for loading audio_effects_vendor.confSteve Kondik2016-01-121-1/+3
| | | | | | | | | * In case a device has a /vendor partition which cannot be modified, this allows us to short-circuit the audio_effects.conf file which might be placed there with one of our own which lives on /system. Change-Id: Ief87bd4cfba2c3188b0dff122d91f773b7f3d92d
* audiopolicy: Handle legacy startOutput on output command thread tooXuefer2016-01-061-1/+15
| | | | | | | | * Fixes the build for legacy audio policy * Broken by: de3b1c01146d2103f6bf56e2659a9c650734945a Change-Id: I990ce609b3da81c462b35c7dd3f7b11d189e2d2e Signed-off-by: Xuefer <xuefer@gmail.com>
* audiopolicy: Handle startOutput on output command threadHaynes Mathew George2015-12-233-0/+57
| | | | | | | | Handle startOutput on AudioPolicyService output command thread to serialize with concurrent releaseOutput/stopOutput calls. CRs-Fixed: 944129 Change-Id: Ie333c736750c7dfb31d3036d79dfff13cd0486fc
* AudioPolicyService: Synchronize access to AudioPolicyManagerHaynes Mathew George2015-11-071-0/+1
| | | | | | | Synchronize access to APM when getDevicesForStream is called on APM. Change-Id: I2ba6922341f035375270b02000ef5a7e078f6b5a
* Merge tag 'android-6.0.0_r26' into cm-13.0Ricardo Cerqueira2015-11-052-9/+21
|\ | | | | | | | | | | Android 6.0.0 release 26 Change-Id: I8a57007bf6efcd8b95c3cebf5e0444345bdd4cda
| * AudioPolicyService: fix race in AudioCommandThreadEric Laurent2015-09-231-8/+16
| | | | | | | | | | | | | | | | | | | | | | Fixe race condition in AudioCommandThread::threadLoop() where a command can be inserted in first position in the queue after the sleep time has been calculated causing a longer delay than expected. Also fix a failure to hold a wake lock while commands are still in the queue. Bug: 22707905. Change-Id: I813626986677bf00106acb37ee20d3dd75d5cf33
| * audio policy: bind setMode() and setPhoneState() operationsEric Laurent2015-09-161-1/+5
| | | | | | | | | | | | | | | | | | | | No routing operation should be allowed between setMode() and setPhoneState() when starting a call as the audio HAL relies on a precise sequence of mode change and routing change to select the initial audio device for the call. Bug: 24083591. Change-Id: I2d5ef62c11cf7aedc2ec7ca5e5fadd7ac875afbc
* | Stagefright: Add Checks for allocationsSathishKumar Mani2015-10-062-0/+4
| | | | | | | | | | | | | | Warn allocation failures explicitly rather than crash trying to access unallocated memory Change-Id: Ie86c3ac130917e1f4030eb8207ac8350cba7711d
* | audiopolicy: port existing fixes to AudioPolicyManagerSatya Krishna Pindiproli2015-10-061-4/+6
|/ | | | | | | | | | | | | | | | | | This is a squashed commit of the following fixes in AudioPolicyManager. Only some parts of the fixes have been ported as the custom audio policy has the other required changes. audiopolicy: Fix MT call delay Change-Id: I790479eaad9d2d6fd4204cc4cb7698761c30f7cf audiopolicy: support extended feature in audiopolicymanager Change-Id: I1925339b591cd29f11a71c287a2e53c0627e9e62 audiopolicy: additional change for extended feature Change-Id: I9bad6a294ddd7aee72f6f6a314666b892b730c8e Change-Id: I7738d4b0ac11ee6d93bfd67e2553eae8518ff719
* audio policy: protect capture from telephony RX path.Eric Laurent2015-08-071-0/+2
| | | | | | | | Add permission check if the capture device selected is telephony RX path. Bug: 23017158. Change-Id: Iaa34d836e6cf46b7cbbf2483fcd4306dcd27ce90
* Fix build warningGlenn Kasten2015-07-061-0/+1
| | | | Change-Id: I876edc37fb2093ee13c876c2af5c46512763154d
* reduce number of binder calls from mediaserverEric Laurent2015-06-262-3/+25
| | | | | | | | | | | | | | | Reduce the number of audio port, audio patch and IO config changed binder calls from mediaserver to client processes: - Do not call IO config changed callback if selected device is the same as previously selected one on a given audio flinger playback or capture thread. - Do not call the audio port or audo patch list update callback on a client if this client as no listener registered. Bug: 22045560. Change-Id: If780e105404de79b7cb5c80c27b793ceb6b1c423
* Merge "audio policy: session routes continued." into mnc-devEric Laurent2015-04-304-4/+29
|\
| * audio policy: session routes continued.Eric Laurent2015-04-304-4/+29
| | | | | | | | | | | | | | | | | | | | | | - Clear session routes when client process dies. - Enforce the route only when the requesting session is active. - Fix requested route not working if an output mix change is required (e.g forcing to SPEAKER when the default route is USB or A2DP). - Make sure all sessions sharing the strategy with a rerouted session have the same route (needed for volume control consistency) Change-Id: I0ab347a8fb97e73e2c5965374544c5f4fe509ef1
* | Respect the record audio app op - mediaSvet Ganov2015-04-291-3/+3
|/ | | | Change-Id: I3a97977b6e9a09355e2008f780d22d480fb7308b
* Explicit routing in AudioRecordPaul McLean2015-04-283-8/+11
| | | | Change-Id: I9cc5d54883a3e5c75d553fabb619fc8e49f4f9e5
* audio policy: remove permission check for ports and patches gettersEric Laurent2015-04-201-9/+0
| | | | | | | Remove check for MODIFY_AUDIO_ROUTING permission in audio policy methods just getting devices or patches state. Change-Id: Id3bafc5ad0d0bd96210822243139898e314327d8
* audio policy: add binder calls for audio source controlEric Laurent2015-04-153-0/+39
| | | | | | | Add binder methods to IAudioPolicyService to control activity of external audio sources (e.g FM tuner). Change-Id: I2008308a6a996baeae502b68a790d87281efe2ff
* Merge "AudioPolicyManager: notification of dynamic policy mix activity"Jean-Michel Trivi2015-04-153-2/+76
|\
| * AudioPolicyManager: notification of dynamic policy mix activityJean-Michel Trivi2015-04-143-2/+76
| | | | | | | | | | | | | | | | | | | | Implement non-stream type specific ref counting in output descriptors to keep track of mix activity. Notify audio policy client of mix activity changes. Bug 20226914 Change-Id: Iec939cb640c58056f88947b611d23b4bb6d8a11b
* | audio polciy: remove FM audio capture permission.Eric Laurent2015-04-132-4/+2
|/ | | | Change-Id: I2607d89b0bd87cdd2f4084dfdb55135509a824d5
* Adding explicit routing API to AudioTrackPaul McLean2015-04-083-1/+4
| | | | Change-Id: I40c048c7644c46f4e4f7103875206c0785c4b1dc
* Make sure waitRelative is called when waitTime != INT64_MAXWally Yau2015-03-241-1/+1
| | | | | | | | b/19870971 (cherry picked from commit c600af1459c455583e071e653f0d998032aa423e) Change-Id: Ic6bb54067d76c96ff6fc45431dc2d72db9f0a3a8
* Refactor AudioPolicyManagerJean-Michel Trivi2015-02-188-0/+4269
AudioPolicyManager implementation is now split into the following files: files managerdefault/Gains.* class AudioGain class VolumeCurvePoint class StreamDescriptor files managerdefault/Devices.* class DeviceDescriptor class DeviceVector files managerdefault/Ports.* class AudioPort class AudioPortConfig class AudioPatch files managerdefault/IOProfile.* class IOProfile files managerdefault/HwModule.* class HwModule files managerdefault/AudioInputDescriptor.* class AudioInputDescriptor files managerdefault/AudioOutputDescriptor.* class AudioOutputDescriptor All files for libaudiopolicyservice are moved under service/ All files for libaudiopolicymanager are moved under manager/ Change-Id: I43758be1894e37d34db194b51a19ae24461e066e