diff options
author | Eric Laurent <elaurent@google.com> | 2011-03-15 14:26:03 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-03-15 14:26:03 -0700 |
commit | 257b2d0b8070be80376480a834134acdd0b4aca7 (patch) | |
tree | 4a3e91638168b43a5b0a9ce28a3520b22400a55c | |
parent | 65c282042dab1dfa75b10517190ba38834782c3b (diff) | |
download | frameworks_base-257b2d0b8070be80376480a834134acdd0b4aca7.zip frameworks_base-257b2d0b8070be80376480a834134acdd0b4aca7.tar.gz frameworks_base-257b2d0b8070be80376480a834134acdd0b4aca7.tar.bz2 |
Improvement for issue 3489986: BT SCO volume
This change makes sure that the VOICE_CALL stream volume tracks
the BLUETOOTH_SCO stream volume when SCO audio is enabled.
The down link audio volume now reflects what is being displayed
when pressing volume hard keys on the device while in a video chat
with a BT SCO headset.
Volume settings on the headset and the device are still independent as
we do not support handsfree profile yet.
Change-Id: Ie0d2714730ea359b9318b9cbe6f0b2557ef0f976
-rw-r--r-- | services/audioflinger/AudioPolicyManagerBase.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/services/audioflinger/AudioPolicyManagerBase.cpp b/services/audioflinger/AudioPolicyManagerBase.cpp index 74be4e0..f653dc5 100644 --- a/services/audioflinger/AudioPolicyManagerBase.cpp +++ b/services/audioflinger/AudioPolicyManagerBase.cpp @@ -339,6 +339,7 @@ void AudioPolicyManagerBase::setForceUse(AudioSystem::force_use usage, AudioSyst LOGW("setForceUse() invalid config %d for FOR_COMMUNICATION", config); return; } + forceVolumeReeval = true; mForceUse[usage] = config; break; case AudioSystem::FOR_MEDIA: @@ -384,7 +385,7 @@ void AudioPolicyManagerBase::setForceUse(AudioSystem::force_use usage, AudioSyst updateDeviceForStrategy(); setOutputDevice(mHardwareOutput, newDevice); if (forceVolumeReeval) { - applyStreamVolumes(mHardwareOutput, newDevice); + applyStreamVolumes(mHardwareOutput, newDevice, 0, true); } audio_io_handle_t activeInput = getActiveInput(); @@ -1973,7 +1974,13 @@ status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, int index, audio_ // offset value to reflect actual hardware volume that never reaches 0 // 1% corresponds roughly to first step in VOICE_CALL stream volume setting (see AudioService.java) volume = 0.01 + 0.99 * volume; + // Force VOICE_CALL to track BLUETOOTH_SCO stream volume when bluetooth audio is + // enabled + if (stream == AudioSystem::BLUETOOTH_SCO) { + mpClientInterface->setStreamVolume(AudioSystem::VOICE_CALL, volume, output, delayMs); + } } + mpClientInterface->setStreamVolume((AudioSystem::stream_type)stream, volume, output, delayMs); } @@ -1986,6 +1993,7 @@ status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, int index, audio_ } else { voiceVolume = 1.0; } + if (voiceVolume != mLastVoiceVolume && output == mHardwareOutput) { mpClientInterface->setVoiceVolume(voiceVolume, delayMs); mLastVoiceVolume = voiceVolume; @@ -1995,12 +2003,12 @@ status_t AudioPolicyManagerBase::checkAndSetVolume(int stream, int index, audio_ return NO_ERROR; } -void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs) +void AudioPolicyManagerBase::applyStreamVolumes(audio_io_handle_t output, uint32_t device, int delayMs, bool force) { LOGV("applyStreamVolumes() for output %d and device %x", output, device); for (int stream = 0; stream < AudioSystem::NUM_STREAM_TYPES; stream++) { - checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs); + checkAndSetVolume(stream, mStreams[stream].mIndexCur, output, device, delayMs, force); } } |