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

Commit 1381b4ed authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Automerger Merge Worker
Browse files

Merge "Prefer LE Audio over ASHA if both devices support both profiles." am: 1112627a

parents de2961eb 1112627a
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)