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

Commit 0a89afe0 authored by Yuyang Huang's avatar Yuyang Huang Committed by Gerrit Code Review
Browse files

Merge "Prefer LE audio profile over ASHA for dual mode hearing aid profile connection"

parents 9a20d4ac 86b0282c
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -5684,11 +5684,17 @@ public class AdapterService extends Service {
        }
        }
        if (mHearingAidService != null && isProfileSupported(
        if (mHearingAidService != null && isProfileSupported(
                device, BluetoothProfile.HEARING_AID)) {
                device, BluetoothProfile.HEARING_AID)) {
            if (mHapClientService != null && isProfileSupported(
                    device, BluetoothProfile.HAP_CLIENT)) {
                Log.i(TAG, "connectAllEnabledProfiles: Hearing Access Client Profile is enabled"
                        + " at the same time with Hearing Aid Profile, ignore Hearing Aid Profile");
            } else {
                Log.i(TAG, "connectAllEnabledProfiles: Connecting Hearing Aid Profile");
                Log.i(TAG, "connectAllEnabledProfiles: Connecting Hearing Aid Profile");
                mHearingAidService.setConnectionPolicy(device,
                mHearingAidService.setConnectionPolicy(device,
                    BluetoothProfile.CONNECTION_POLICY_ALLOWED);
                    BluetoothProfile.CONNECTION_POLICY_ALLOWED);
                numProfilesConnected++;
                numProfilesConnected++;
            }
            }
        }
        if (mHapClientService != null && isProfileSupported(
        if (mHapClientService != null && isProfileSupported(
                device, BluetoothProfile.HAP_CLIENT)) {
                device, BluetoothProfile.HAP_CLIENT)) {
            Log.i(TAG, "connectAllEnabledProfiles: Connecting Hearing Access Client Profile");
            Log.i(TAG, "connectAllEnabledProfiles: Connecting Hearing Access Client Profile");
+2 −0
Original line number Original line Diff line number Diff line
@@ -420,6 +420,8 @@ class PhonePolicy {
                == BluetoothProfile.CONNECTION_POLICY_UNKNOWN)) {
                == BluetoothProfile.CONNECTION_POLICY_UNKNOWN)) {
            if (isLeAudioProfileAllowed) {
            if (isLeAudioProfileAllowed) {
                debugLog("LE Audio preferred over ASHA for device " + device);
                debugLog("LE Audio preferred over ASHA for device " + device);
                mAdapterService.getDatabase().setProfileConnectionPolicy(device,
                        BluetoothProfile.HEARING_AID, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN);
            } else {
            } else {
                debugLog("setting hearing aid profile priority for device " + device);
                debugLog("setting hearing aid profile priority for device " + device);
                if (mAutoConnectProfilesSupported) {
                if (mAutoConnectProfilesSupported) {