From fca3c1cf8ba9c0f831e3b1cd012c83ca6b31a7a4 Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Thu, 1 Oct 2009 11:34:17 -0700 Subject: [PATCH] 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 --- .../settings/bluetooth/CachedBluetoothDeviceManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java index a7f44ecd658..1214636c335 100644 --- a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java @@ -172,8 +172,14 @@ public class CachedBluetoothDeviceManager { if (!readPairedDevices()) { Log.e(TAG, "Got bonding state changed for " + 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);