diff options
-rwxr-xr-x | packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java | 9 |
1 files 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) { |