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

Commit f8d97800 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Pass current call into CallAudioManager#setIsRinging.

It is possible that when setIsRinging() is called on CallAudioManager
that the initial audio state will be set at that point.  However,
setInitialAudioState requires the current call to determine the appropriate
audio route.  It defaults to wired or earpiece if there is no call.

Fixed by ensuring setIsRinging takes a call as context so that the initial
audio state can be properly set.

Bug: 22515446
Change-Id: I9c01cf6cf27e916d7e4117aa13e603682a5059fb
parent 9c090d4d
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -360,12 +360,17 @@ final class CallAudioManager extends CallsManagerListenerBase
        }
    }

    void setIsRinging(boolean isRinging) {
    /**
     * Sets the audio stream and mode based on whether a call is ringing.
     *
     * @param call The call which changed ringing state.
     * @param isRinging {@code true} if the call is ringing, {@code false} otherwise.
     */
    void setIsRinging(Call call, boolean isRinging) {
        if (mIsRinging != isRinging) {
            Log.i(this, "setIsRinging %b -> %b", mIsRinging, isRinging);
            Log.i(this, "setIsRinging %b -> %b (call = %s)", mIsRinging, isRinging, call);
            mIsRinging = isRinging;

            updateAudioStreamAndMode();
            updateAudioStreamAndMode(call);
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ final class Ringer extends CallsManagerListenerBase {
                    Log.event(call, Log.Events.START_RINGER);
                    mState = STATE_RINGING;
                }
                mCallAudioManager.setIsRinging(true);
                mCallAudioManager.setIsRinging(call, true);

                // Because we wait until a contact info query to complete before processing a
                // call (for the purposes of direct-to-voicemail), the information about custom
@@ -261,7 +261,7 @@ final class Ringer extends CallsManagerListenerBase {

        // Even though stop is asynchronous it's ok to update the audio manager. Things like audio
        // focus are voluntary so releasing focus too early is not detrimental.
        mCallAudioManager.setIsRinging(false);
        mCallAudioManager.setIsRinging(call, false);
    }

    private void stopCallWaiting(Call call) {