Remain in call audio mode while phone is offhook.

While offhook, even the call is on hold, setAudioMode() remains in
MODE_IN_CALL (or MODE_IN_COMMUNICATION for SIP) rather than
switching back to NORMAL.

bug:5546901
Change-Id: I0189dc010d1109895cc38e17b1b80418445d514a
This commit is contained in:
John Wang
2011-11-07 15:45:18 -08:00
parent b1dbf8e605
commit f885e87884

View File

@@ -379,18 +379,19 @@ public final class CallManager {
mode = AudioManager.MODE_RINGTONE;
break;
case OFFHOOK:
Phone fgPhone = getFgPhone();
// While foreground call is in DIALING,
// ALERTING, ACTIVE and DISCONNECTING state
if (getActiveFgCallState() != Call.State.IDLE
&& getActiveFgCallState() != Call.State.DISCONNECTED) {
if (fgPhone instanceof SipPhone) {
// enable IN_COMMUNICATION audio mode for sipPhone
mode = AudioManager.MODE_IN_COMMUNICATION;
} else {
// enable IN_CALL audio mode for telephony
mode = AudioManager.MODE_IN_CALL;
}
Phone offhookPhone = getFgPhone();
if (getActiveFgCallState() == Call.State.IDLE) {
// There is no active Fg calls, the OFFHOOK state
// is set by the Bg call. So set the phone to bgPhone.
offhookPhone = getBgPhone();
}
if (offhookPhone instanceof SipPhone) {
// enable IN_COMMUNICATION audio mode for sipPhone
mode = AudioManager.MODE_IN_COMMUNICATION;
} else {
// enable IN_CALL audio mode for telephony
mode = AudioManager.MODE_IN_CALL;
}
break;
}