[Audiosharing] Fix volume control error display.

Avoid showing the volume control when the device is not acting as the
sharing source.

Bug: 305620450
Test: manual
Change-Id: I162681d5d0cd84d19c351dce8cfdf833734bbb1b
This commit is contained in:
Yiyi Shen
2023-12-13 17:13:24 +08:00
parent 928942c80f
commit b107bfc9ac

View File

@@ -51,9 +51,10 @@ public class AudioSharingDeviceVolumeControlUpdater extends BluetoothDeviceUpdat
public boolean isFilterMatched(CachedBluetoothDevice cachedDevice) {
boolean isFilterMatched = false;
if (isDeviceConnected(cachedDevice) && isDeviceInCachedDevicesList(cachedDevice)) {
// If device is LE audio device and has a broadcast source,
// it would show in audio sharing devices group.
// If device is LE audio device and in a sharing session on current sharing device,
// it would show in volume control group.
if (cachedDevice.isConnectedLeAudioDevice()
&& AudioSharingUtils.isBroadcasting(mLocalBtManager)
&& AudioSharingUtils.hasBroadcastSource(cachedDevice, mLocalBtManager)) {
isFilterMatched = true;
}