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

Commit b3c5837e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Prevent bonded device from being removed from the property map"

parents ab49939b b0f4ebe3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -95,10 +95,15 @@ final class RemoteDevices {
            prop.mAddress = address;
            String key = Utils.getAddressStringFromByte(address);
            DeviceProperties pv = mDevices.put(key, prop);

            if (pv == null) {
                mDeviceQueue.offer(key);
                if (mDeviceQueue.size() > MAX_DEVICE_QUEUE_SIZE) {
                    String deleteKey = mDeviceQueue.poll();
                    for (BluetoothDevice device : mAdapterService.getBondedDevices()) {
                        if (device.getAddress().equals(deleteKey)) return prop;
                    }
                    debugLog("Removing device " + deleteKey + " from property map");
                    mDevices.remove(deleteKey);
                }
            }