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

Commit 5881f6eb authored by Sungsoo Lim's avatar Sungsoo Lim
Browse files

Revisit audio routing policy when connected

If A2DP only or HFP only devices are connected, don't activate them
automatically.
If there is an active stream via a remote device, do not route the
newly connected devices. For example, when a phone is playing a music
via connected earbuds and then it is connected a speaker, the music
stays in the earbuds.

Bug: 299023147
Bug: 300174072
Test: atest BluetoothInstrumentationTests
Change-Id: Ie63b278bbf6bf93b75141bd705907ecdccd6faf2
parent 42b26763
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -51,6 +53,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.Set;

/**
@@ -270,4 +273,10 @@ public class BluetoothMethodProxy {
    public Looper handlerThreadGetLooper(HandlerThread handlerThread) {
        return handlerThread.getLooper();
    }

    /** Peoziws {@link MediaSessionManager#getActiveSessions} */
    public @NonNull List<MediaController> mediaSessionManagerGetActiveSessions(
            MediaSessionManager manager) {
        return manager.getActiveSessions(null);
    }
}
+136 −91

File changed.

Preview size limit exceeded, changes collapsed.

+58 −50

File changed.

Preview size limit exceeded, changes collapsed.