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

Commit d153a82f authored by Rongxuan Liu's avatar Rongxuan Liu Committed by Android (Google) Code Review
Browse files

Merge "Control broadcast assistant profile connection with le toggle" into main

parents 8edc0b70 54c2f4dd
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -353,6 +353,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
        }

        LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
        LocalBluetoothProfile broadcastAssistant =
                mProfileManager.getLeAudioBroadcastAssistantProfile();

        for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
            Log.d(TAG,
@@ -362,6 +364,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
            if (asha != null) {
                asha.setEnabled(leAudioDevice.getDevice(), true);
            }
            if (broadcastAssistant != null) {
                Log.d(TAG,
                        "device:" + leAudioDevice.getDevice().getAnonymizedAddress()
                                + " disable LE broadcast assistant profile");
                broadcastAssistant.setEnabled(leAudioDevice.getDevice(), false);
            }
        }

        if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
@@ -388,6 +396,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
            disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
        }
        LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
        LocalBluetoothProfile broadcastAssistant =
                mProfileManager.getLeAudioBroadcastAssistantProfile();

        for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
            Log.d(TAG,
@@ -397,6 +407,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
            if (asha != null) {
                asha.setEnabled(leAudioDevice.getDevice(), false);
            }
            if (broadcastAssistant != null) {
                Log.d(TAG,
                        "device:" + leAudioDevice.getDevice().getAnonymizedAddress()
                                + " enable LE broadcast assistant profile");
                broadcastAssistant.setEnabled(leAudioDevice.getDevice(), true);
            }
        }
    }