summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-06-13 15:19:32 -0700
committerThe Android Automerger <android-build@android.com>2012-06-15 14:12:16 -0700
commit4113a42b37257141322c78e5388dcdf42c7a0bf7 (patch)
treea6199dc46ea2681885fe0f32af65791b6456d4d2
parente3f43309a68a31f6389b0fda6cad91e4d6ab45c6 (diff)
downloadhardware_libhardware_legacy-4113a42b37257141322c78e5388dcdf42c7a0bf7.zip
hardware_libhardware_legacy-4113a42b37257141322c78e5388dcdf42c7a0bf7.tar.gz
hardware_libhardware_legacy-4113a42b37257141322c78e5388dcdf42c7a0bf7.tar.bz2
audio policy: fix volume upon A2DP connection
setForceUse() should not force new device selection on outputs if the selected device is 0. If a device 0 (no device) selection is forced on a duplicated output, this causes volumes to be reset to their default on outputs the duplicated output is connected to. Also force reapply volumes when a new output is created. It is safer and more explicit than relying on the fact that the selected volume is different from default volume and thus is actually sent to audioflinger. Bug 6658021. Change-Id: I0a14d5229847e001b0d44f60d41c241efdb9946a
-rw-r--r--audio/AudioPolicyManagerBase.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index aaae2c2..cce60b5 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -403,8 +403,8 @@ void AudioPolicyManagerBase::setForceUse(AudioSystem::force_use usage, AudioSyst
for (size_t i = 0; i < mOutputs.size(); i++) {
audio_io_handle_t output = mOutputs.keyAt(i);
audio_devices_t newDevice = getNewDevice(output, true /*fromCache*/);
- setOutputDevice(output, newDevice, true);
- if (forceVolumeReeval) {
+ setOutputDevice(output, newDevice, (newDevice != 0));
+ if (forceVolumeReeval && (newDevice != 0)) {
applyStreamVolumes(output, newDevice, 0, true);
}
}
@@ -1630,7 +1630,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device,
// add output descriptor
addOutput(output, desc);
// set initial stream volume for device
- applyStreamVolumes(output, device);
+ applyStreamVolumes(output, device, 0, true);
//TODO: configure audio effect output stage here
@@ -1647,7 +1647,7 @@ status_t AudioPolicyManagerBase::checkOutputsForDevice(audio_devices_t device,
dupOutputDesc->mChannelMask = desc->mChannelMask;
dupOutputDesc->mLatency = desc->mLatency;
addOutput(duplicatedOutput, dupOutputDesc);
- applyStreamVolumes(duplicatedOutput, device);
+ applyStreamVolumes(duplicatedOutput, device, 0, true);
} else {
ALOGW("checkOutputsForDevice() could not open dup output for %d and %d",
mPrimaryOutput, output);