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

Commit 7fb0f9fe authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Merge changes from topic "hfp-audio-state-api-cleanup" am: 2d2bcc4f am: 189e880c

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1999793

Change-Id: I62cbd75bdb3ef4af13a740ee48a970690795ada6
parents 24538a2a 189e880c
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -1485,12 +1485,20 @@ public class HeadsetService extends ProfileService {
    }

    int disconnectAudio() {
        int disconnectResult = BluetoothStatusCodes.ERROR_NO_ACTIVE_DEVICES;
        synchronized (mStateMachines) {
            List<BluetoothDevice> activeAudioDevices = getNonIdleAudioDevices();
            BluetoothDevice activeAudioDevice =
                    activeAudioDevices.get(activeAudioDevices.size() - 1);
            return disconnectAudio(activeAudioDevice);
            for (BluetoothDevice device : getNonIdleAudioDevices()) {
                disconnectResult = disconnectAudio(device);
                if (disconnectResult == BluetoothStatusCodes.SUCCESS) {
                    return disconnectResult;
                } else {
                    Log.e(TAG, "disconnectAudio() from " + device + " failed with status code "
                            + disconnectResult);
                }
            }
        }
        logD("disconnectAudio() no active audio connection");
        return disconnectResult;
    }

    int disconnectAudio(BluetoothDevice device) {