From 99fecc0dd7e1c2db0f4b173a69e2b3a96fef12ff Mon Sep 17 00:00:00 2001 From: Joseph Pirozzo Date: Thu, 7 Apr 2016 13:43:49 -0700 Subject: [PATCH] HFP Client Permission Add the permission checkbox to the bluetooth profiles in settings if an HFP client profile exists on the local device and HFP server profile exists on the remote device rather than relying on the remote device attempting to connect before presenting it. Bug: 28071400 Change-Id: I32707a709489c7383a6e1709eac844a3d17f4428 --- .../bluetooth/LocalBluetoothProfileManager.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index 6052ccd4ff8e7..7f0e27a96c0aa 100755 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -399,6 +399,9 @@ public final class LocalBluetoothProfileManager { // Copy previous profile list into removedProfiles removedProfiles.clear(); removedProfiles.addAll(profiles); + if (DEBUG) { + Log.d(TAG,"Current Profiles" + profiles.toString()); + } profiles.clear(); if (uuids == null) { @@ -415,6 +418,13 @@ public final class LocalBluetoothProfileManager { } } + if ((mHfpClientProfile != null) && + BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.Handsfree_AG) && + BluetoothUuid.isUuidPresent(localUuids, BluetoothUuid.Handsfree)) { + profiles.add(mHfpClientProfile); + removedProfiles.remove(mHfpClientProfile); + } + if (BluetoothUuid.containsAnyUuid(uuids, A2dpProfile.SINK_UUIDS) && mA2dpProfile != null) { profiles.add(mA2dpProfile); @@ -425,7 +435,7 @@ public final class LocalBluetoothProfileManager { mA2dpSinkProfile != null) { profiles.add(mA2dpSinkProfile); removedProfiles.remove(mA2dpSinkProfile); - } + } if (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.ObexObjectPush) && mOppProfile != null) { @@ -461,5 +471,9 @@ public final class LocalBluetoothProfileManager { profiles.remove(mPbapProfile); removedProfiles.add(mPbapProfile); } + + if (DEBUG) { + Log.d(TAG,"New Profiles" + profiles.toString()); + } } }