Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff0896db authored by Etienne Ruffieux's avatar Etienne Ruffieux
Browse files

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
parent 22cc8e2a
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -1445,21 +1445,21 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
        }
        synchronized (mProfileServices) {
            ProfileServiceConnections psc = mProfileServices.get(new Integer(bluetoothProfile));
            if (psc == null) {
                if (DBG) {
                    Log.d(TAG, "Creating new ProfileServiceConnections object for" + " profile: "
                            + bluetoothProfile);
                }

            Intent intent;
                if (bluetoothProfile == BluetoothProfile.HEADSET) {
            if (bluetoothProfile == BluetoothProfile.HEADSET
                    && BluetoothProperties.isProfileHfpAgEnabled().orElse(false)) {
                intent = new Intent(IBluetoothHeadset.class.getName());
                } else if (bluetoothProfile== BluetoothProfile.LE_CALL_CONTROL) {
            } 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);
                }
                psc = new ProfileServiceConnections(intent);
                if (!psc.bindService()) {
                    return false;