diff options
author | Eric Laurent <elaurent@google.com> | 2010-10-22 12:03:02 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-10-22 12:03:02 -0700 |
commit | 84efbbc0cf303a135ec48ce56c6e1b8dd526dbfb (patch) | |
tree | f10325c3951ace680a4171e6a4fdeee21f896d7b /libaudio2 | |
parent | 399345f89c4a69d80df78564122d757ffdd06c1e (diff) | |
download | device_samsung_crespo-84efbbc0cf303a135ec48ce56c6e1b8dd526dbfb.zip device_samsung_crespo-84efbbc0cf303a135ec48ce56c6e1b8dd526dbfb.tar.gz device_samsung_crespo-84efbbc0cf303a135ec48ce56c6e1b8dd526dbfb.tar.bz2 |
Fix issue 3123882.
When in call and an incoming call is received, the call mode is temporarily
switched back to ringtone before the new call is answered. This was deconfiguring
in call audio path and we did not recover properly when transitioning back from
ring tone to in call.
The fix consists in not changing the in call audio config when changing from
in call to ring tone but only when going back to normal mode.
Change-Id: I78928e4a0043f114accf1f602f255321161c45ad
Diffstat (limited to 'libaudio2')
-rw-r--r-- | libaudio2/AudioHardware.cpp | 37 | ||||
-rw-r--r-- | libaudio2/AudioHardware.h | 1 |
2 files changed, 21 insertions, 17 deletions
diff --git a/libaudio2/AudioHardware.cpp b/libaudio2/AudioHardware.cpp index 1a8975f..6773109 100644 --- a/libaudio2/AudioHardware.cpp +++ b/libaudio2/AudioHardware.cpp @@ -56,6 +56,7 @@ AudioHardware::AudioHardware() : mMixer(NULL), mPcmOpenCnt(0), mMixerOpenCnt(0), + mInCallAudioMode(false), mVrModeEnabled(false), mBluetoothNrec(true), mSecRilLibHandle(NULL), @@ -283,7 +284,7 @@ status_t AudioHardware::setMode(int mode) // make sure that doAudioRouteOrMute() is called by doRouting() // when entering or exiting in call mode even if the new device // selected is the same as current one. - if ((mMode == AudioSystem::MODE_RINGTONE) || (mMode == AudioSystem::MODE_IN_CALL)) + if (prevMode == AudioSystem::MODE_NORMAL) { if ((!mActivatedCP) && (mSecRilLibHandle) && (connectRILDIfRequired() == OK)) { setCallClockSync(mRilClient, SOUND_CLOCK_START); @@ -291,24 +292,26 @@ status_t AudioHardware::setMode(int mode) } } - if (((prevMode != AudioSystem::MODE_IN_CALL) && (mMode == AudioSystem::MODE_IN_CALL)) || - ((prevMode == AudioSystem::MODE_IN_CALL) && (mMode != AudioSystem::MODE_IN_CALL))) { - if (mMode == AudioSystem::MODE_IN_CALL) { - openPcmOut_l(); - openMixer_l(); - setVoiceRecognition_l(false); - } + if (mMode == AudioSystem::MODE_IN_CALL && !mInCallAudioMode) { + LOGV("setMode() openPcmOut_l()"); + openPcmOut_l(); + openMixer_l(); + setVoiceRecognition_l(false); setIncallPath_l(mOutput->device()); - if (mMode != AudioSystem::MODE_IN_CALL) { - setVoiceRecognition_l(mVrModeEnabled); - closeMixer_l(); - mOutput->setNextRoute(getOutputRouteFromDevice(mOutput->device())); - closePcmOut_l(); - AudioStreamInALSA *input = getActiveInput_l(); - if (input != NULL) { - input->setNextRoute(getInputRouteFromDevice(input->device())); - } + mInCallAudioMode = true; + } + if (mMode == AudioSystem::MODE_NORMAL && mInCallAudioMode) { + setVoiceRecognition_l(mVrModeEnabled); + LOGV("setMode() closePcmOut_l()"); + closeMixer_l(); + mOutput->setNextRoute(getOutputRouteFromDevice(mOutput->device())); + LOGV("setMode() closePcmOut_l()"); + closePcmOut_l(); + AudioStreamInALSA *input = getActiveInput_l(); + if (input != NULL) { + input->setNextRoute(getInputRouteFromDevice(input->device())); } + mInCallAudioMode = false; } if (mMode == AudioSystem::MODE_NORMAL) { diff --git a/libaudio2/AudioHardware.h b/libaudio2/AudioHardware.h index ab81d9c..4fdb437 100644 --- a/libaudio2/AudioHardware.h +++ b/libaudio2/AudioHardware.h @@ -145,6 +145,7 @@ private: struct mixer* mMixer; uint32_t mPcmOpenCnt; uint32_t mMixerOpenCnt; + bool mInCallAudioMode; bool mVrModeEnabled; bool mBluetoothNrec; |