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

Commit 86b0282c authored by Yuyang Huang's avatar Yuyang Huang
Browse files

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

Bug: 273356187
Test: manual
Change-Id: Ie3a9ba1a909b42ec4eb52663c08d43f9d2c230af
parent 1391c878
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -5487,11 +5487,17 @@ public class AdapterService extends Service {
        }
        if (mHearingAidService != null && isProfileSupported(
                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");
                mHearingAidService.setConnectionPolicy(device,
                    BluetoothProfile.CONNECTION_POLICY_ALLOWED);
                numProfilesConnected++;
            }
        }
        if (mHapClientService != null && isProfileSupported(
                device, BluetoothProfile.HAP_CLIENT)) {
            Log.i(TAG, "connectAllEnabledProfiles: Connecting Hearing Access Client Profile");
+2 −0
Original line number Diff line number Diff line
@@ -423,6 +423,8 @@ class PhonePolicy {
                == BluetoothProfile.CONNECTION_POLICY_UNKNOWN)) {
            if (isLeAudioProfileAllowed) {
                debugLog("LE Audio preferred over ASHA for device " + device);
                mAdapterService.getDatabase().setProfileConnectionPolicy(device,
                        BluetoothProfile.HEARING_AID, BluetoothProfile.CONNECTION_POLICY_FORBIDDEN);
            } else {
                debugLog("setting hearing aid profile priority for device " + device);
                if (mAutoConnectProfilesSupported) {