summaryrefslogtreecommitdiff
path: root/packages/SettingsLib/src
diff options
context:
space:
mode:
author Yiyi Shen <yiyishen@google.com> 2025-02-13 16:16:08 +0800
committer Yiyi Shen <yiyishen@google.com> 2025-02-13 16:16:08 +0800
commitfae222ffb3608f209682f1173ff9c19fc5adfe5c (patch)
tree9ede7b4997408cd3fee19db918723946c7d10465 /packages/SettingsLib/src
parentefeea6290cca46e42330549e1e22b875243c1dcd (diff)
Add method to check if CachedBluetoothDevice has connected LEA member
Test: manual Bug: 396009828 Flag: EXEMPT simple fix Change-Id: I3ac57f30b7bf7f19c7d5e7eebefb5fcf8f18d18c
Diffstat (limited to 'packages/SettingsLib/src')
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index 7374f80fd9db..2d8d8a822325 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -1949,6 +1949,17 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
}
/**
+ * @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
*/
public boolean isConnectedLeAudioBroadcastAssistantDevice() {