Skip to content

Commit f885e87

Browse files
author
John Wang
committed
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
1 parent b1dbf8e commit f885e87

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

telephony/java/com/android/internal/telephony/CallManager.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -379,18 +379,19 @@ public void setAudioMode() {
379379
mode = AudioManager.MODE_RINGTONE;
380380
break;
381381
case OFFHOOK:
382-
Phone fgPhone = getFgPhone();
383-
// While foreground call is in DIALING,
384-
// ALERTING, ACTIVE and DISCONNECTING state
385-
if (getActiveFgCallState() != Call.State.IDLE
386-
&& getActiveFgCallState() != Call.State.DISCONNECTED) {
387-
if (fgPhone instanceof SipPhone) {
388-
// enable IN_COMMUNICATION audio mode for sipPhone
389-
mode = AudioManager.MODE_IN_COMMUNICATION;
390-
} else {
391-
// enable IN_CALL audio mode for telephony
392-
mode = AudioManager.MODE_IN_CALL;
393-
}
382+
Phone offhookPhone = getFgPhone();
383+
if (getActiveFgCallState() == Call.State.IDLE) {
384+
// There is no active Fg calls, the OFFHOOK state
385+
// is set by the Bg call. So set the phone to bgPhone.
386+
offhookPhone = getBgPhone();
387+
}
388+
389+
if (offhookPhone instanceof SipPhone) {
390+
// enable IN_COMMUNICATION audio mode for sipPhone
391+
mode = AudioManager.MODE_IN_COMMUNICATION;
392+
} else {
393+
// enable IN_CALL audio mode for telephony
394+
mode = AudioManager.MODE_IN_CALL;
394395
}
395396
break;
396397
}

0 commit comments

Comments
 (0)