summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
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: engineconfigurable: Don't include the exampleDiogo Ferreira2016-05-231-1/+1
| | | | | | | | | | | | | When using the configurable policy engine, the audiopolicy makefile implicitly declares dependencies on the configuration files. However, the example folder already contains the example files which we wan't to override. This patch removes the example from the makefile inclusion path so that we can declare it on a per-device basis without getting errored out by duplicate module names. Change-Id: Ie47ebff6b13606c93630c017252ebaa204203a76
* audiopolicy: Add AudioSessionInfo APISteve Kondik2016-04-278-18/+270
| | | | | | | | | | | | | | | | * 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-227-212/+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-077-49/+195
| | | | | | | | | | | | | | * 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
* audio: Remove LEGACY_ALSA_AUDIO ifdefs from AudioPolicyManager.cppArne Coucheron2016-03-171-54/+0
| | | | | | This is moved to custom policy manager in HAL sources. Change-Id: I716580f7d3399f1628c26bd3b79bd6c6a52fbbf6
* audiopolicy: squashed support for pre-kitkat audio blobsc4572016-03-103-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | 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-086-6/+125
| | | | | | | | | | | | | | | | | | | * 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
* audiopolicy: Set sane defaults for QC audio featuresSteve Kondik2015-12-162-2/+2
| | | | Change-Id: If91536d2be0165c90effccdfa2b92722223eb905
* stagefright: Additional fixes for extended offload supportSteve Kondik2015-12-141-2/+0
| | | | | | | | | | | * Fix compilation with debug enabled * Allow FLAC offload to be enabled independent of QCOM_HARDWARE, tested with the Nexus 5X and is working! * Disable the FLACExtractor if offload is enabled since it can only output decoded PCM. This will force FFMPEG to be used, which does everything we need for FLAC offload Change-Id: I7d71c153a6a6ea7df8e32bc73f5cbe9f51cdcf64
* audiopolicy: Add voip flag to output flag listKarthik Reddy Katta2015-12-072-1/+3
| | | | | | | | | Direct output is not selected for voip usecases as AUDIO_OUTPUT_FLAG_VOIP_RX is not added to sOutputFlagNameToEnumTable. Add this flag to output flags list. Change-Id: Ifccb78a7b8579da0a65eb3ea7347756c664246a8
* Merge tag 'android-6.0.1_r3' of ↵Steve Kondik2015-12-071-2/+31
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/av into cm-13.0 Android 6.0.1 release 3 Change-Id: I2f2a1fe1b58c828e8341556996211562d6e195ab
| * audio policy: fix transition from VoIP to voice call on USBEric Laurent2015-10-151-0/+23
| | | | | | | | | | | | | | | | | | Make sure no active capture takes place while in call and the capture device is the same as the call TX device. Bug: 23977713. Change-Id: Ia379d5e626c150ea49f0cdd581c881dbf0b8399d
| * audio policy: fix USB mic selection for VoIPEric Laurent2015-10-151-2/+8
| | | | | | | | | | | | | | | | | | When transitioning from speaker phone to normal mode and a USB headset is connected, we must force a teardown of active input as the new input device cannot be reached via current input stream. Bug: 24406915. Change-Id: I9f7c1d3f3cba285c25a6da1d54a3d15a5c1f378a
* | Volume should take VOLUME_MIN_DB value when audio is muted.Safa Boumaiza2015-12-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Audio can be heard when muting volume as the minimum volume value takes 0.0f instead of VOLUME_MIN_DB (-758). This patch fixes the minimum volume value which should be VOLUME_MIN_DB instead of 0.0f. Change-Id: I4cb8093b6d9f18e5330ba5f770b9133baa77542f Signed-off-by: Safa Boumaiza <Safax.boumaiza@intel.com> Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
* | audio: Changes to enable BT A2DPShreyas Nagasandra Chandrasekhar2015-11-202-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | For Proxy thread to be started , a2dp state has to updated from the audiopolicy. Now , added changes to send the BT A2DP status to audio HAL. - A- Family doesn't support separate output for a2dp , removed the getA2dpOutput(). getDeviceForStrategy() is selecting the proper device using mA2dpSuspended flag. CRs-Fixed: 751090 Change-Id: I599de562a8674ee611e10575fcc85e4715707a63
* | audiopolicy: Remove unused variables with LEGACY_ALSA_AUDIOAdrianDC2015-11-201-1/+3
| | | | | | | | | | Change-Id: If037b4eb6bbd864ccab050565899ce508ee90f9e Signed-off-by: AdrianDC <radian.dc@gmail.com>
* | Merge branch 'LA.BF64.1.2.2_rb4.7' of ↵Steve Kondik2015-11-162-0/+8
|\ \ | | | | | | | | | | | | | | | git://codeaurora.org/platform/frameworks/av into cm-13.0 Change-Id: Ia41df61c3ccfeb809572b63a4b1a8ca6bd85dfb2
| * | audiopolicy: Add synchronization to EffectDescriptorCollectionHaynes Mathew George2015-11-092-0/+8
| | | | | | | | | | | | | | | | | | | | | Synchronize public APIs of EffectDescriptorCollection CRs-Fixed: 920103 Change-Id: I04ccac526c6f99e61e43288776653d6b7ff325c4
| * | AudioPolicyService: fix race in AudioCommandThreadEric Laurent2015-11-041-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
| * | AudioPolicyService: Synchronize access to AudioPolicyManagerHaynes Mathew George2015-11-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Synchronize access to APM when getDevicesForStream is called on APM. CRs-Fixed: 913227 Change-Id: I2ba6922341f035375270b02000ef5a7e078f6b5a
* | | audiopolicy: Fix call recording for legacy qcom HALnadlabak2015-11-072-0/+21
| | | | | | | | | | | | Change-Id: I774f75b493c47386ca1eaf004d663432f1041a66
* | | audio: Send USB connection events only for USB accessoryRamjee Singh2015-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | - Send USB connected/disconnected events to Audio HAL only in case of USB AOA as these are used only in case of USB AOA Change-Id: I7db508f6eff5e8601d54f1e1bfa603358f9d6703
* | | audio: Fixed Audio Source in Voice CallPavan Chikkala2015-11-072-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | setPhoneState calls getDeviceForInputSource to check if voice_tx device is available as part of Primary Audio Module. getDeviceForInputSource always returns DEVICE_IN_COMMUNICATION for SOURCE_VOICE_COMMUNICATION on A Family and this is not added to Available devices This is leading to creation of txPatch when it is not needed Fix is to use AUDIO_SOURCE_VOICE_CALL instead of AUDIO_SOURCE_VOICE_COMMUNICATION Change-Id: I9aa7dd2139b8374ec7f06676d06ef5addea4b2a9
* | | audiopolicy: Add DEVICE_IN_COMMUNICATION for VOIPPavan Chikkala2015-11-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | - On A family, Only DEVICE_IN_COMMUNICATION is supported by voip_tx profile. getDeviceForInputSource should always return DEVICE_IN_COMMUNICATION to load voip_tx profile Change-Id: I3bb2fb70a89eadc35c2ced0c7f717ec15120bfe7
* | | audio: Added support for USB AOA connect/disconnect eventsRamjee Singh2015-11-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | USB AOA is supported by primary HAL on A family through customized connect/disconnect parameters.Added support for that in AudioPolicyManager Change-Id: I5212027b2711c24a9750629774f69d669a9d164f
* | | audiopolicy: Update DeviceNametoEnumTablePavan Chikkala2015-11-071-0/+3
| | | | | | | | | | | | | | | | | | | | | Added entry for DEVICE_IN_COMMUNICATION to support VOIP usecase. Change-Id: Ie7e5131b776d7b93c53ca0796dffa11316091805
* | | audio: Change the default init value for StreamDescriptorRalph Nathan2015-11-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, audio doesn't play on Brillo because the policy manager's default value for all streams is set to 0. In Android, this value is changed by calls from AudioService.java. If we set the default value to 1 in Brillo, then even if there are no calls, we will have audio. BUG=none TEST=manual Change-Id: I1418c9ecfb4f1c81c9c0946eee11deed3c65b358
* | | 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-057-19/+85
|\ \ \ | |/ / |/| / | |/ | | | | Android 6.0.0 release 26 Change-Id: I8a57007bf6efcd8b95c3cebf5e0444345bdd4cda
| * Merge "audio policy: fix preemtible capture race" into mnc-dr-devEric Laurent2015-09-243-3/+41
| |\
| | * audio policy: fix preemtible capture raceEric Laurent2015-09-223-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because a preemtible capture session can preempt another one, we end up in an endless loop situation were each session is allowed to restart after being preempted, thus preempting the other one which restarts and so on. To avoid this situation, we store which audio session was preempted when a particular input started and prevent preemption of this active input by this session. We also inherit sessions from the preempted input to avoid a 3 way preemption loop etc... Bug: 24007220. Change-Id: I0eab5299440ef3ab9e987635dc9a300cf42f2c79
| * | 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
| * AudioPolicy: don't always change ACCESSIBILITY volumeJean-Michel Trivi2015-09-141-1/+3
| | | | | | | | | | | | | | | | | | Only change the volume for AUDIO_STREAM_ACCESSIBILITY when changing the media volume. Bug 23366575 Change-Id: Ic42c726ec4d47615c20500c20e4d43cef159b3c6
| * Force fixed volume for TTS streamEric Laurent2015-09-111-4/+4
| | | | | | | | | | | | | | | | Always play Transmitted Through Speaker stream at max volume instead of tracking media stream volume. Bug: 23729461. Change-Id: I61021f59617bb851a4cd7da80924e587029e96a3
| * Merge "audio policy: refine TTS stream mute management" into mnc-dr-devEric Laurent2015-08-132-2/+16
| |\
| | * audio policy: refine TTS stream mute managementEric Laurent2015-08-122-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | Do not mute the TTS stream if a dedicated output for TTS is available. Bug: 22100304. Change-Id: Ic126100ce1144f765bc0ae42c8ea87fa47cfb822
* | | audio policy: move output handle to AudioOutputDescriptor base classDhananjay Kumar2015-10-202-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Output handle of AudioOutputDescriptor is required by derived implementation of some AudioPolicyManager methods. These methods need to access attributes of an output which is not accessible through AudioOutputDescriptor base class unless output handle is made available here. Change-Id: I96ef9fd1c5a94874acb897245501ba2f9c9ab0c0
* | | stagefright: Add support for custom size i/p buffervivek mehta2015-10-062-0/+15
| | | | | | | | | | | | | | | | | | | | | - handle non default input buffer size - fix issues associated with non-default buffer size Change-Id: Iad31f5c85601983b01e18e130b1c3eecb3988e30