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

Commit 33e73d50 authored by Hall Liu's avatar Hall Liu
Browse files

Change order of calls to AudioManager

There may sometimes be a delay when calling AudioManager#setMode. If
audio focus is abandoned prior to setting the mode to MODE_NORMAL, there
may be some churn in the audio stack that causes errant noises to be
emitted. Fix this by setting the mode prior to abandoning audio focus.

Fixes: 133197870
Test: manual
Change-Id: I71391abb07ece96bb76056ab8304c68adddbd22a
parent 728c412a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -160,8 +160,8 @@ public class CallAudioModeStateMachine extends StateMachine {
        public void enter() {
            if (mIsInitialized) {
                Log.i(LOG_TAG, "Abandoning audio focus: now UNFOCUSED");
                mAudioManager.abandonAudioFocusForCall();
                mAudioManager.setMode(AudioManager.MODE_NORMAL);
                mAudioManager.abandonAudioFocusForCall();

                mMostRecentMode = AudioManager.MODE_NORMAL;
                mCallAudioManager.setCallAudioRouteFocusState(CallAudioRouteStateMachine.NO_FOCUS);