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

Commit 5844f1d3 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Check for state before disconnecting.

This is a race condition exposed after we turned off some STOPSHIP
logging and some other logging. We drop the ACl connection after 2 secs
of inactivity and hence the device didn't exist -> DBUS crash.

Bug: 3097224
Change-Id: I90adbbee2c5793924037685e484027ed5cd2e0d0
parent bd57eeaf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -367,6 +367,11 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
        int state = getSinkState(device);
        String path = mBluetoothService.getObjectPathFromAddress(device.getAddress());

        switch (state) {
            case BluetoothA2dp.STATE_DISCONNECTED:
            case BluetoothA2dp.STATE_DISCONNECTING:
                return false;
        }
        // State is CONNECTING or CONNECTED or PLAYING
        handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTING);
        if (!disconnectSinkNative(path)) {