Merge "DO NOT MERGE: Use a copy of bt device profile list when updating" into qt-qpr1-dev

This commit is contained in:
TreeHugger Robot
2020-01-31 20:02:08 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 1 deletions

View File

@@ -661,6 +661,10 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
return Collections.unmodifiableList(mProfiles);
}
public List<LocalBluetoothProfile> getProfileListCopy() {
return new ArrayList<>(mProfiles);
}
public List<LocalBluetoothProfile> getConnectableProfiles() {
List<LocalBluetoothProfile> connectableProfiles =
new ArrayList<LocalBluetoothProfile>();

View File

@@ -277,7 +277,7 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa
boolean otherProfileConnected = false;
for (CachedBluetoothDevice device : getDevices()) {
for (LocalBluetoothProfile profile : device.getProfiles()) {
for (LocalBluetoothProfile profile : device.getProfileListCopy()) {
int profileId = profile.getProfileId();
boolean isConnected = device.isConnectedProfile(profile);
if (profileId == BluetoothProfile.HEADSET