Skip to content

Commit 2f99bb5

Browse files
John WangAndroid (Google) Code Review
authored andcommitted
Merge "Remain in call audio mode while phone is offhook." into ics-mr1
2 parents 2d9ccdb + f885e87 commit 2f99bb5

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)