Check if a device is added to the cache before returning.

For incoming connections, we don't have the device in the Settings cache.
After we tried to readPairedDevices, check if we added to the cache.
If we successfully added it, continue with the connections, else bail out.

Bug id: 2160617

Change-Id: I25f2afba8ef6d2c32a7940f967cf12f1321ad9e0
This commit is contained in:
Jaikumar Ganesh
2009-10-01 11:34:17 -07:00
parent e5cff2655c
commit fca3c1cf8b

View File

@@ -172,8 +172,14 @@ public class CachedBluetoothDeviceManager {
if (!readPairedDevices()) { if (!readPairedDevices()) {
Log.e(TAG, "Got bonding state changed for " + device + Log.e(TAG, "Got bonding state changed for " + device +
", but we have no record of that device."); ", but we have no record of that device.");
return;
}
cachedDevice = findDevice(device);
if (cachedDevice == null) {
Log.e(TAG, "Got bonding state changed for " + device +
"but device not added in cache");
return;
} }
return;
} }
cachedDevice.onBondingStateChanged(bondState); cachedDevice.onBondingStateChanged(bondState);