summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-09-08 18:36:19 -0700
committerEric Laurent <elaurent@google.com>2011-09-08 18:40:31 -0700
commit49cb776c1a5d056c345d90465f8006ef23d947b0 (patch)
tree16ff9c7ac4b998a75a45f0ee3df2507f342f1bc9 /libaudio
parent3499ca31761d6b17066773167bed14b80b2e48c8 (diff)
downloaddevice_samsung_crespo-49cb776c1a5d056c345d90465f8006ef23d947b0.zip
device_samsung_crespo-49cb776c1a5d056c345d90465f8006ef23d947b0.tar.gz
device_samsung_crespo-49cb776c1a5d056c345d90465f8006ef23d947b0.tar.bz2
audio HAL: fix some audio mode transitions
The logic controlling the CP clock and audio path in setMode() was incorrect for certain transitions. In particular, the sequence IN_CALL -> RINGTONE -> IN_COMMUNICATION -> IN_CALL would cause a loss of call audio. Change-Id: I4a6bcca32e6e33f965874ad2219f2728b9035e4a
Diffstat (limited to 'libaudio')
-rw-r--r--libaudio/AudioHardware.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index c58e084..a189510 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -376,8 +376,10 @@ status_t AudioHardware::setMode(int mode)
status = AudioHardwareBase::setMode(mode);
LOGV("setMode() : new %d, old %d", mMode, prevMode);
if (status == NO_ERROR) {
+ bool modeNeedsCPActive = mMode == AudioSystem::MODE_IN_CALL ||
+ mMode == AudioSystem::MODE_RINGTONE;
// activate call clock in radio when entering in call or ringtone mode
- if (prevMode == AudioSystem::MODE_NORMAL)
+ if (modeNeedsCPActive)
{
if ((!mActivatedCP) && (mSecRilLibHandle) && (connectRILDIfRequired() == OK)) {
setCallClockSync(mRilClient, SOUND_CLOCK_START);
@@ -402,7 +404,7 @@ status_t AudioHardware::setMode(int mode)
setVoiceVolume_l(mVoiceVol);
mInCallAudioMode = true;
}
- if (mMode == AudioSystem::MODE_NORMAL && mInCallAudioMode) {
+ if (mMode != AudioSystem::MODE_IN_CALL && mInCallAudioMode) {
setInputSource_l(mInputSource);
if (mMixer != NULL) {
TRACE_DRIVER_IN(DRV_MIXER_GET)
@@ -431,7 +433,7 @@ status_t AudioHardware::setMode(int mode)
mInCallAudioMode = false;
}
- if (mMode == AudioSystem::MODE_NORMAL) {
+ if (!modeNeedsCPActive) {
if(mActivatedCP)
mActivatedCP = false;
}