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

Commit a7c68f6a authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Automerger Merge Worker
Browse files

Merge "Retain device properties while connected" into main am: f423f0f6 am: 97f3b020

parents ca602208 97f3b020
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -523,7 +523,7 @@ final class BondStateMachine extends StateMachine {
            return;
        }

        mRemoteDevices.onBondStateChange(device, oldState, newState);
        mRemoteDevices.onBondStateChange(device, newState);

        if (devProp != null) {
            oldState = devProp.getBondState();
+21 −13
Original line number Diff line number Diff line
@@ -1279,20 +1279,15 @@ public class RemoteDevices {
    }

    private void removeAddressMapping(String address) {
        synchronized (mDevices) {
            mDevices.remove(address);
            mDeviceQueue.remove(address); // Remove from LRU cache

            // Remove from dual mode device mappings
            mDualDevicesMap.values().remove(address);
            mDualDevicesMap.remove(address);
        if (Flags.temporaryPairingDeviceProperties()) {
            DeviceProperties deviceProperties = mDevices.get(address);
            if (deviceProperties != null) {
                String pseudoAddress = mDualDevicesMap.get(address);
                if (pseudoAddress != null) {
                    deviceProperties = mDevices.get(pseudoAddress);
                }
            }

    void onBondStateChange(BluetoothDevice device, int oldState, int newState) {
        String address = device.getAddress();
        if (Flags.temporaryPairingDeviceProperties() && oldState != BluetoothDevice.BOND_BONDED) {
            DeviceProperties deviceProperties = mDevices.get(address);
            if (deviceProperties != null) {
                int leConnectionHandle =
                        deviceProperties.getConnectionHandle(BluetoothDevice.TRANSPORT_LE);
@@ -1306,6 +1301,19 @@ public class RemoteDevices {
            }
        }

        synchronized (mDevices) {
            mDevices.remove(address);
            mDeviceQueue.remove(address); // Remove from LRU cache

            // Remove from dual mode device mappings
            mDualDevicesMap.values().remove(address);
            mDualDevicesMap.remove(address);
        }
    }

    void onBondStateChange(BluetoothDevice device, int newState) {
        String address = device.getAddress();

        if (Flags.removeAddressMapOnUnbond() && newState == BluetoothDevice.BOND_NONE) {
            removeAddressMapping(address);
        }