[BUG] AudioPolicyManager: prevent patch leak on SwOutput used for bridges
When using either SwBridge or HwBridge, a SwOutput is always involved.
SwBridge: for playback, HwBridge: for volume control (it hosts the
Source Client).
When the bridge ends, the SwOutput shall be rerouted (Sw) or
unrouted (Hw bridge to prevent patch leak).
This CL generalizes the ClientDescriptor usage for all audio patches.
For patches created from APM::createAudioPatch API or call patches witch
are not associated to an active client, it creates an internal client descriptor.
Sink device is expressed as a preferredDevices. Then APM forbids to change
it using UID enforcement in getNewOutputDevices.
It alos allows to track client hence volume sources active on a SwOutput,
even for HwBridge. Waiting for cleaner HwAudioOutputDescriptor, we will use
the mandatory SwOutput declared in configuration file for a given sink device
for HwBridge to attach the Audio Source and control activity, thus volume.
This SwOutput will be routed (aka setOutputDevices to be called) and unrouted
if not needed anymore.
Bug: 187173302
Test: build & audio UC involving bridges
(functional on emulator):
adb shell ./data/AudioPolicyEmulatorTests --gtest_filter=*AudioPatchTest*
adb shell ./data/AudioPolicyEmulatorTests --gtest_filter=*AudioSourceTest*
Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
Change-Id: Ib4dc2ae32a89464bd8ac3b96833f324760012799
Loading
Please register or sign in to comment