From 1e01d0870033a0a9ba2f05ede7502a3fc1529569 Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Wed, 12 Aug 2015 22:41:19 +0530 Subject: PBAP: Disconnect PBAP profile only if connected This patch is needed to handle the PBAP cases for multicast scenarios. This change will let the disconnection of the PBAP profile with that remote device only which was actually connected via PBAP among all the BT connected devices. Change-Id: I76f6215d1d407d789654e78e448aea5324816a71 CRs-Fixed: 843160 --- .../src/com/android/settingslib/bluetooth/PbapServerProfile.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java index 9e76933..fea7b34 100755 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java @@ -88,8 +88,13 @@ public final class PbapServerProfile implements LocalBluetoothProfile { } public boolean disconnect(BluetoothDevice device) { - if (mService == null) return false; - return mService.disconnect(); + if (mService == null || device == null) return false; + + if (getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED) + return mService.disconnect(); + + Log.d(TAG, "pbap server not connected to " + device.getAddress()); + return false; } public int getConnectionStatus(BluetoothDevice device) { -- cgit v1.1