aboutsummaryrefslogtreecommitdiff
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
committerEtienne Ruffieux <eruffieux@google.com>2022-06-16 22:05:08 -0700
commitff0896dbdac477d3e6a3fa35d71f6daff28d37ad (patch)
treea02eff8a34f67d5c82c8639cd7c54b370a760863 /service/java/com/android/server/bluetooth/BluetoothManagerService.java
parent22cc8e2a09247f2c7b6f5f9b8c63d9dcd5edbc45 (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
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 0f2fcc9778..fdd567286c 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -1445,21 +1445,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()) {
return false;