Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4cf89aa authored by Tim Peng's avatar Tim Peng
Browse files

[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
parent c048b1c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
        }
@@ -472,6 +471,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();