summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothManagerService.java
diff options
context:
space:
mode:
authorEtienne Ruffieux <eruffieux@google.com>2022-06-16 22:05:08 -0700
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-17 14:47:00 +0000
commit82dfb05056735f9c336340723ab2daa6e860910a (patch)
tree85b7d30d06731d116f52695928f72f406b7e5a24 /service/java/com/android/server/bluetooth/BluetoothManagerService.java
parent5ddceef31bef6f919b82d069e3e536870e789b84 (diff)
Check sysprop value before trying to bind to service
TbsService and HeadsetService were missing one check before BluetoothManagerService would try to bond to them. Bug: 236196227 Tag: #feature Test: manual Ignore-AOSP-First: will be cherry-picked Change-Id: Iceb6c437216092a7dccc238f396f4d95e341af1d (cherry picked from commit ff0896dbdac477d3e6a3fa35d71f6daff28d37ad) Merged-In: Iceb6c437216092a7dccc238f396f4d95e341af1d
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r--service/java/com/android/server/bluetooth/BluetoothManagerService.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
index 303074574e..a7d9831740 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -1446,21 +1446,21 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
}
synchronized (mProfileServices) {
ProfileServiceConnections psc = mProfileServices.get(new Integer(bluetoothProfile));
+ Intent intent;
+ if (bluetoothProfile == BluetoothProfile.HEADSET
+ && BluetoothProperties.isProfileHfpAgEnabled().orElse(false)) {
+ intent = new Intent(IBluetoothHeadset.class.getName());
+ } else if (bluetoothProfile == BluetoothProfile.LE_CALL_CONTROL
+ && BluetoothProperties.isProfileCcpServerEnabled().orElse(false)) {
+ intent = new Intent(IBluetoothLeCallControl.class.getName());
+ } else {
+ return false;
+ }
if (psc == null) {
if (DBG) {
Log.d(TAG, "Creating new ProfileServiceConnections object for" + " profile: "
+ bluetoothProfile);
}
-
- Intent intent;
- if (bluetoothProfile == BluetoothProfile.HEADSET) {
- intent = new Intent(IBluetoothHeadset.class.getName());
- } else if (bluetoothProfile== BluetoothProfile.LE_CALL_CONTROL) {
- intent = new Intent(IBluetoothLeCallControl.class.getName());
- } else {
- return false;
- }
-
psc = new ProfileServiceConnections(intent);
if (!psc.bindService(DEFAULT_REBIND_COUNT)) {
return false;