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

Commit 1468a6f9 authored by Yiyi Shen's avatar Yiyi Shen Committed by Android (Google) Code Review
Browse files

Merge "Add method to check if CachedBluetoothDevice has connected LEA member" into main

parents 9a110e09 fae222ff
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1987,6 +1987,17 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
                BluetoothProfile.STATE_CONNECTED;
    }

    /**
     * @return {@code true} if {@code cachedBluetoothDevice} has member which is LeAudio device
     */
    public boolean hasConnectedLeAudioMemberDevice() {
        LeAudioProfile leAudio = mProfileManager.getLeAudioProfile();
        return leAudio != null && getMemberDevice().stream().anyMatch(
                cachedDevice -> cachedDevice != null && cachedDevice.getDevice() != null
                        && leAudio.getConnectionStatus(cachedDevice.getDevice())
                        == BluetoothProfile.STATE_CONNECTED);
    }

    /**
     * @return {@code true} if {@code cachedBluetoothDevice} supports broadcast assistant profile
     */