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

Commit 60b6e283 authored by Yorke Lee's avatar Yorke Lee
Browse files

Protect against INCALL->RINGING transition in AudioManager

If such a transition occurs, reset to NORMAL first, to prevent the loss
of uplink audio.

Tested with:
1) Answering Call WAITING (before fix in
https://googleplex-android-review.git.corp.google.com/#/c/571861/1 is applied)
2) Receiving an incoming call while in-call tone is still playing

Bug: 18058600
Bug: 18020190
Change-Id: Ib5ec8d202ed6c5d8262853696e8fadfa7a222ac8
parent 127faa82
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -392,7 +392,12 @@ final class CallAudioManager extends CallsManagerListenerBase
        Preconditions.checkState(hasFocus());
        int oldMode = mAudioManager.getMode();
        Log.v(this, "Request to change audio mode from %d to %d", oldMode, newMode);

        if (oldMode != newMode) {
            if (oldMode == AudioManager.MODE_IN_CALL && newMode == AudioManager.MODE_RINGTONE) {
                Log.i(this, "Transition from IN_CALL -> RINGTONE. Resetting to NORMAL first.");
                mAudioManager.setMode(AudioManager.MODE_NORMAL);
            }
            mAudioManager.setMode(newMode);
            mMostRecentlyUsedMode = newMode;
        }