diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java index 380c484cabb..25c7f14bc4a 100644 --- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java @@ -396,11 +396,13 @@ public class CachedBluetoothDevice implements Comparable int preferredProfiles = 0; for (Profile profile : mProfiles) { - LocalBluetoothProfileManager profileManager = - LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile); - if (profileManager.isPreferred(mDevice)) { - ++preferredProfiles; - queueCommand(new BluetoothJob(BluetoothCommand.CONNECT, this, profile)); + if (isConnectableProfile(profile)) { + LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager + .getProfileManager(mLocalManager, profile); + if (profileManager.isPreferred(mDevice)) { + ++preferredProfiles; + queueCommand(new BluetoothJob(BluetoothCommand.CONNECT, this, profile)); + } } } if (DEBUG) Log.d(TAG, "Preferred profiles = " + preferredProfiles); @@ -417,10 +419,12 @@ public class CachedBluetoothDevice implements Comparable mIsConnectingErrorPossible = true; for (Profile profile : mProfiles) { - LocalBluetoothProfileManager profileManager = - LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile); - profileManager.setPreferred(mDevice, false); - queueCommand(new BluetoothJob(BluetoothCommand.CONNECT, this, profile)); + if (isConnectableProfile(profile)) { + LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager + .getProfileManager(mLocalManager, profile); + profileManager.setPreferred(mDevice, false); + queueCommand(new BluetoothJob(BluetoothCommand.CONNECT, this, profile)); + } } }