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

Commit 2d0ebcf3 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix Bluetooth OOB pairing not working for unseen devices

When Out Of Band info is provided, first time we learn about
device is when it's state is changed to "Bonding". This currently cause
this event to be discarded and pairing fails. Instead, we should add
CachedDevice object for newly added device.

Bug: 30188629
Change-Id: I4046bfe30e8bf32b888f608ac06d5041e2999dc9
(cherry picked from commit 3eb490f9)
parent 8fcff25c
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -268,16 +268,16 @@ public final class BluetoothEventManager {
            if (cachedDevice == null) {
            if (cachedDevice == null) {
                Log.w(TAG, "CachedBluetoothDevice for device " + device +
                Log.w(TAG, "CachedBluetoothDevice for device " + device +
                        " not found, calling readPairedDevices().");
                        " not found, calling readPairedDevices().");
                if (!readPairedDevices()) {
                if (readPairedDevices()) {
                    Log.e(TAG, "Got bonding state changed for " + device +
                            ", but we have no record of that device.");
                    return;
                }
                    cachedDevice = mDeviceManager.findDevice(device);
                    cachedDevice = mDeviceManager.findDevice(device);
                }

                if (cachedDevice == null) {
                if (cachedDevice == null) {
                    Log.e(TAG, "Got bonding state changed for " + device +
                    Log.w(TAG, "Got bonding state changed for " + device +
                            ", but device not added in cache.");
                            ", but we have no record of that device.");
                    return;

                    cachedDevice = mDeviceManager.addDevice(mLocalAdapter, mProfileManager, device);
                    dispatchDeviceAdded(cachedDevice);
                }
                }
            }
            }