[Fix] Bluetooth device ordering
-Caused by sorting whole list
-It should sort connected devices, and then, to add all disconnected
devices from getMostRecentlyConnectedDevices()
Bug: 176850941
Test: atest LocalMediaManagerTest
Change-Id: I123e70d0616d3fab0a29658e29421ee94aec3094
(cherry picked from commit a4cf89aa16)
This commit is contained in:
@@ -205,7 +205,6 @@ public class LocalMediaManager implements BluetoothCallback {
|
||||
|
||||
void dispatchDeviceListUpdate() {
|
||||
final List<MediaDevice> mediaDevices = new ArrayList<>(mMediaDevices);
|
||||
Collections.sort(mediaDevices, COMPARATOR);
|
||||
for (DeviceCallback callback : getCallbacks()) {
|
||||
callback.onDeviceListUpdate(mediaDevices);
|
||||
}
|
||||
@@ -465,6 +464,7 @@ public class LocalMediaManager implements BluetoothCallback {
|
||||
synchronized (mMediaDevicesLock) {
|
||||
mMediaDevices.clear();
|
||||
mMediaDevices.addAll(devices);
|
||||
Collections.sort(devices, COMPARATOR);
|
||||
// Add disconnected bluetooth devices only when phone output device is available.
|
||||
for (MediaDevice device : devices) {
|
||||
final int type = device.getDeviceType();
|
||||
|
||||
Reference in New Issue
Block a user