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

Commit 0b4d65d7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Properly update profile connection state"

parents 639e30b2 921e34fc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -625,6 +625,10 @@ final class A2dpStateMachine extends StateMachine {
                        broadcastConnectionState(device, BluetoothProfile.STATE_DISCONNECTED,
                                       BluetoothProfile.STATE_CONNECTING);
                        break;
                    } else {
                        broadcastConnectionState(mCurrentDevice,
                                BluetoothProfile.STATE_DISCONNECTING,
                                BluetoothProfile.STATE_CONNECTED);
                    }

                    synchronized (A2dpStateMachine.this) {
@@ -643,7 +647,7 @@ final class A2dpStateMachine extends StateMachine {
                                   BluetoothProfile.STATE_CONNECTED);
                    if (!disconnectA2dpNative(getByteAddress(device))) {
                        broadcastConnectionState(device, BluetoothProfile.STATE_CONNECTED,
                                       BluetoothProfile.STATE_DISCONNECTED);
                                BluetoothProfile.STATE_DISCONNECTING);
                        break;
                    }
                    synchronized (A2dpStateMachine.this) {
+12 −3
Original line number Diff line number Diff line
@@ -503,15 +503,24 @@ class AdapterProperties {
    private boolean updateCountersAndCheckForConnectionStateChange(int state, int prevState) {
        switch (prevState) {
            case BluetoothProfile.STATE_CONNECTING:
                if (mProfilesConnecting > 0)
                    mProfilesConnecting--;
                else
                    Log.e(TAG, "mProfilesConnecting " + mProfilesConnecting);
                break;

            case BluetoothProfile.STATE_CONNECTED:
                if (mProfilesConnected > 0)
                    mProfilesConnected--;
                else
                    Log.e(TAG, "mProfilesConnected " + mProfilesConnected);
                break;

            case BluetoothProfile.STATE_DISCONNECTING:
                if (mProfilesDisconnecting > 0)
                    mProfilesDisconnecting--;
                else
                    Log.e(TAG, "mProfilesDisconnecting " + mProfilesDisconnecting);
                break;
        }

+4 −0
Original line number Diff line number Diff line
@@ -753,6 +753,10 @@ final class HeadsetStateMachine extends StateMachine {
                    if (mConnectedDevicesList.contains(device)) {
                        Log.w(TAG, "Connected: CONNECT, device " + device + " is connected");
                        break;
                    } else {
                        broadcastConnectionState(mCurrentDevice,
                                BluetoothProfile.STATE_DISCONNECTING,
                                BluetoothProfile.STATE_CONNECTED);
                    }
                    if (mConnectedDevicesList.size() >= max_hf_connections) {
                        BluetoothDevice DisconnectConnectedDevice = null;