Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 49cb776c1a5d056c345d90465f8006ef23d947b0 1 parent 3499ca3
Eric Laurent authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 libaudio/AudioHardware.cpp
View
8 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;
}

1 comment on commit 49cb776

@samcorbin

Can this commit merge into gb branch as well?

Please sign in to comment.
Something went wrong with that request. Please try again.