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

Commit e8d55d48 authored by xiaotonj's avatar xiaotonj Committed by Grace Jia
Browse files

Set audio mode back to normal before we abandon the audio focus after

call.

Currently, we set the audio mode back to normal after we abandon the
audio focus when the call disconnected. This may cause audio playback
switching delay after the call.

Bug: b/281841785
Test: Manually test audio switching after call using Youtube music.
Change-Id: I5b2db68b4b4d2420be34295064413d8b70daac7e
parent 9f42309c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ aconfig_declarations {
      "telecom_incallservice_flags.aconfig",
      "telecom_default_phone_account_flags.aconfig",
      "telecom_callaudioroutestatemachine_flags.aconfig",
      "telecom_callaudiomodestatemachine_flags.aconfig",
      "telecom_calllog_flags.aconfig",
      "telecom_resolve_hidden_dependencies.aconfig"
    ],
+8 −0
Original line number Diff line number Diff line
package: "com.android.server.telecom.flags"

flag {
  name: "set_audio_mode_before_abandon_focus"
  namespace: "telecom"
  description: "Set audio mode to MODE_NORMAL before abandon the audio focus."
  bug: "281841785"
}
+9 −2
Original line number Diff line number Diff line
@@ -277,8 +277,15 @@ public class CallAudioModeStateMachine extends StateMachine {
            Log.i(LOG_TAG, "Audio focus entering UNFOCUSED state");
            mLocalLog.log("Enter UNFOCUSED");
            if (mIsInitialized) {
                mCallAudioManager.setCallAudioRouteFocusState(CallAudioRouteStateMachine.NO_FOCUS);
                if (mFeatureFlags.setAudioModeBeforeAbandonFocus()) {
                    mAudioManager.setMode(AudioManager.MODE_NORMAL);
                    mCallAudioManager.setCallAudioRouteFocusState(
                            CallAudioRouteStateMachine.NO_FOCUS);
                } else {
                    mCallAudioManager.setCallAudioRouteFocusState(
                            CallAudioRouteStateMachine.NO_FOCUS);
                    mAudioManager.setMode(AudioManager.MODE_NORMAL);
                }
                mLocalLog.log("Mode MODE_NORMAL");
                mMostRecentMode = AudioManager.MODE_NORMAL;
                // Don't release focus here -- wait until we get a signal that any other audio