[Audiosharing] Returns BluetoothDevice when fetchConnectedDevicesByGroupId

CachedBluetoothDevice can change its member variable mDevice, so we can
not rely on the CachedBluetoothDevice#getDevice when we add source to
it. This change will return BluetoothDevice instead of
CachedBluetoothDevice when fetchConnectedDevicesByGroupId, so that we
won't add source to unintended BluetoothDevice via
CachedBluetoothDevice#getDevice.

Fix: 350877510
Test: atest
Flag: com.android.settingslib.flags.enable_le_audio_sharing
Change-Id: I4ee41b8f1449e7176f0a05a7dd4e59034c161824
This commit is contained in:
Yiyi Shen
2024-07-31 20:28:09 +08:00
parent b6e0cd99c1
commit 7edad1c84a
5 changed files with 107 additions and 98 deletions

View File

@@ -23,7 +23,6 @@ import static com.android.settings.connecteddevice.audiosharing.audiostreams.Aud
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;