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

Commit f0c1bf54 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Jakub Pawłowski
Browse files

Prefer LE Audio over ASHA if both devices support both profiles.

Test: tested on UPF
Bug: 266437713
Change-Id: I29fb7bf5773ccf7de6d0de8bf6c1d4a067622a93
parent 08bc5ece
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -355,10 +355,12 @@ class PhonePolicy {
                    BluetoothProfile.PAN, BluetoothProfile.CONNECTION_POLICY_ALLOWED);
        }

        boolean isLeAudioProfileAllowed = false;
        if ((leAudioService != null) && Utils.arrayContains(uuids,
                BluetoothUuid.LE_AUDIO) && (leAudioService.getConnectionPolicy(device)
                == BluetoothProfile.CONNECTION_POLICY_UNKNOWN)) {
            debugLog("setting le audio profile priority for device " + device);
            isLeAudioProfileAllowed = true;
            mAdapterService.getDatabase().setProfileConnectionPolicy(device,
                    BluetoothProfile.LE_AUDIO, BluetoothProfile.CONNECTION_POLICY_ALLOWED);
            if (mPreferLeAudioOnlyMode) {
@@ -384,10 +386,14 @@ class PhonePolicy {
        if ((hearingAidService != null) && Utils.arrayContains(uuids,
                BluetoothUuid.HEARING_AID) && (hearingAidService.getConnectionPolicy(device)
                == BluetoothProfile.CONNECTION_POLICY_UNKNOWN)) {
            if (isLeAudioProfileAllowed) {
                debugLog("LE Audio preferred over ASHA for device " + device);
            } else {
                debugLog("setting hearing aid profile priority for device " + device);
                mAdapterService.getDatabase().setProfileConnectionPolicy(device,
                        BluetoothProfile.HEARING_AID, BluetoothProfile.CONNECTION_POLICY_ALLOWED);
            }
        }

        if ((volumeControlService != null) && Utils.arrayContains(uuids,
                BluetoothUuid.VOLUME_CONTROL) && (volumeControlService.getConnectionPolicy(device)