Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f885e878 authored by John Wang's avatar John Wang
Browse files

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
parent b1dbf8e6
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -379,19 +379,20 @@ 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) {
                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;
        }
        // calling audioManager.setMode() multiple times in a short period of