From e4dc456d4b0fb474ca3821967b0913c820a713f7 Mon Sep 17 00:00:00 2001 From: Joseph Pirozzo Date: Thu, 10 Sep 2020 06:55:30 -0700 Subject: [PATCH] Configure Bluetooth profiles displayed in settings Two profiles were displayed on automotive targets at the wrong times, MAP was displayed for all devices, PBAP was displayed only when enabled. This updates those two profiles to appear in the profiles only when the service is enabled locally and the remote device supports the other half of the connection. Bug: 173818456 Bug: 109783106 Test: pair with bluetooth devices that support (and don't support) MAP and PBAP, and verify settings slider appears when appropriate specifically when disabled. Change-Id: I62b8778517730076554ba996cee80862ce72539b Merged-In: I62b8778517730076554ba996cee80862ce72539b --- .../settingslib/bluetooth/LocalBluetoothProfileManager.java | 5 +++-- .../com/android/settingslib/bluetooth/MapClientProfile.java | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index 35bbbc0e8b396..34fdc1e455671 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -543,12 +543,13 @@ public class LocalBluetoothProfileManager { mPbapProfile.setEnabled(device, true); } - if (mMapClientProfile != null) { + if ((mMapClientProfile != null) + && BluetoothUuid.containsAnyUuid(uuids, MapClientProfile.UUIDS)) { profiles.add(mMapClientProfile); removedProfiles.remove(mMapClientProfile); } - if ((mPbapClientProfile != null) && ArrayUtils.contains(localUuids, BluetoothUuid.PBAP_PCE) + if ((mPbapClientProfile != null) && BluetoothUuid.containsAnyUuid(uuids, PbapClientProfile.SRC_UUIDS)) { profiles.add(mPbapClientProfile); removedProfiles.remove(mPbapClientProfile); diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java index 19cb2f59f321b..4881a86b398af 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java @@ -47,8 +47,6 @@ public final class MapClientProfile implements LocalBluetoothProfile { private final LocalBluetoothProfileManager mProfileManager; static final ParcelUuid[] UUIDS = { - BluetoothUuid.MAP, - BluetoothUuid.MNS, BluetoothUuid.MAS, };