summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-09-05 18:13:06 -0700
committerEric Laurent <elaurent@google.com>2012-09-05 18:13:06 -0700
commit17a73c3394547692457299dc512b5c2312ea0344 (patch)
treebe36534fd5157598e737c52cbe3b85723c4e3b55
parentc8101f5b14e745b348592c5609e55f121a11a6bf (diff)
downloadhardware_libhardware_legacy-17a73c3394547692457299dc512b5c2312ea0344.zip
hardware_libhardware_legacy-17a73c3394547692457299dc512b5c2312ea0344.tar.gz
hardware_libhardware_legacy-17a73c3394547692457299dc512b5c2312ea0344.tar.bz2
audio policy: fix ringtone volume on headphones
When limiting ringtone volume because headphones are connected and music is playing, the volume was not limited against the right music volume. The is because the device used for music (headphone) is not the same as the one used for ringtone (headphone + speaker). Bug 6816207. Change-Id: I3342be1789a1b7c58705812335b788f030bc6d76
-rw-r--r--audio/AudioPolicyManagerBase.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp
index 39ac709..7cd5652 100644
--- a/audio/AudioPolicyManagerBase.cpp
+++ b/audio/AudioPolicyManagerBase.cpp
@@ -2653,10 +2653,11 @@ float AudioPolicyManagerBase::computeVolume(int stream,
// just stopped
if (isStreamActive(AudioSystem::MUSIC, SONIFICATION_HEADSET_MUSIC_DELAY) ||
mLimitRingtoneVolume) {
+ audio_devices_t musicDevice = getDeviceForStrategy(STRATEGY_MEDIA, true /*fromCache*/);
float musicVol = computeVolume(AudioSystem::MUSIC,
- mStreams[AudioSystem::MUSIC].getVolumeIndex(device),
+ mStreams[AudioSystem::MUSIC].getVolumeIndex(musicDevice),
output,
- device);
+ musicDevice);
float minVol = (musicVol > SONIFICATION_HEADSET_VOLUME_MIN) ?
musicVol : SONIFICATION_HEADSET_VOLUME_MIN;
if (volume > minVol) {