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

Commit eb729938 authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

A2DP Sink focus handling

No need to continue setting the setWillPauseWhenDucked flag.  The audio
policy should handle it.

Test: runtest bluetooth -c com.android.bluetooth.a2dpsink.A2dpSinkStreamHandlerTest
Bug: 122710846

Change-Id: I26496f0ba8c13626f8f4d3baa20a31e466e93085
(cherry picked from commit db619253)
parent e3862f95
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -258,12 +258,10 @@ public class A2dpSinkStreamHandler extends Handler {
                new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA)
                new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA)
                        .setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN)
                        .setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN)
                        .build();
                        .build();
        // Bluetooth ducking is handled at the native layer so tell the Audio Manger to notify the
        // Bluetooth ducking is handled at the native layer at the request of AudioManager.
        // focus change listener via .setWillPauseWhenDucked().
        AudioFocusRequest focusRequest =
        AudioFocusRequest focusRequest =
                new AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN).setAudioAttributes(
                new AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN).setAudioAttributes(
                        streamAttributes)
                        streamAttributes)
                        .setWillPauseWhenDucked(true)
                        .setOnAudioFocusChangeListener(mAudioFocusListener, this)
                        .setOnAudioFocusChangeListener(mAudioFocusListener, this)
                        .build();
                        .build();
        int focusRequestStatus = mAudioManager.requestAudioFocus(focusRequest);
        int focusRequestStatus = mAudioManager.requestAudioFocus(focusRequest);