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

Commit be63faf3 authored by Sanket Agarwal's avatar Sanket Agarwal Committed by Gerrit Code Review
Browse files

Merge "Fix connection state broadcasts"

parents 9dc8695a 1aa7d25c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -437,9 +437,12 @@ final class A2dpSinkStateMachine extends StateMachine {
                    }
                } else {
                    loge("Unknown device Connected: " + device);
                    // something is wrong here, but sync our state with stack
                    // something is wrong here, but sync our state with stack by connecting to
                    // the new device and disconnect from previous device.
                    broadcastConnectionState(device, BluetoothProfile.STATE_CONNECTED,
                                             BluetoothProfile.STATE_DISCONNECTED);
                    broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED,
                        BluetoothProfile.STATE_CONNECTING);
                    synchronized (A2dpSinkStateMachine.this) {
                        mCurrentDevice = device;
                        mTargetDevice = null;
+3 −3
Original line number Diff line number Diff line
@@ -1092,8 +1092,8 @@ final class HeadsetClientStateMachine extends StateMachine {
                      transitionTo(mDisconnected);
                      broadcastConnectionState(
                          mCurrentDevice,
                          BluetoothProfile.STATE_CONNECTING,
                          BluetoothProfile.STATE_DISCONNECTED);
                          BluetoothProfile.STATE_DISCONNECTED,
                          BluetoothProfile.STATE_CONNECTING);
                      break;

                default:
@@ -1240,7 +1240,7 @@ final class HeadsetClientStateMachine extends StateMachine {
                    if (!disconnectNative(getByteAddress(dev))) {
                        // disconnecting failed
                        broadcastConnectionState(dev, BluetoothProfile.STATE_CONNECTED,
                                BluetoothProfile.STATE_DISCONNECTED);
                                BluetoothProfile.STATE_DISCONNECTING);
                        break;
                    }
                    break;