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

Commit 0e792ab9 authored by Sanket Agarwal's avatar Sanket Agarwal Committed by android-build-merger
Browse files

Merge "A2dpSink sends CONNECTED instead of DISCONNECTED when connection timeout"

am: ea1dca72

Change-Id: I44166c77dec9915f6fe7d94352077ea1d07590bd
parents 9653e340 ea1dca72
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -241,7 +241,7 @@ final class A2dpSinkStateMachine extends StateMachine {
        private void processConnectionEvent(int state, BluetoothDevice device) {
        private void processConnectionEvent(int state, BluetoothDevice device) {
            switch (state) {
            switch (state) {
            case CONNECTION_STATE_DISCONNECTED:
            case CONNECTION_STATE_DISCONNECTED:
                logw("Ignore HF DISCONNECTED event, device: " + device);
                logw("Ignore A2DP DISCONNECTED event, device: " + device);
                break;
                break;
            case CONNECTION_STATE_CONNECTING:
            case CONNECTION_STATE_CONNECTING:
                if (okToConnect(device)){
                if (okToConnect(device)){
@@ -354,6 +354,8 @@ final class A2dpSinkStateMachine extends StateMachine {
        // in Pending state
        // in Pending state
        private void processConnectionEvent(int state, BluetoothDevice device) {
        private void processConnectionEvent(int state, BluetoothDevice device) {
            log("processConnectionEvent state " + state);
            log("processConnectionEvent state " + state);
            log("Devices curr: " + mCurrentDevice + " target: " + mTargetDevice +
                " incoming: " + mIncomingDevice + " device: " + device);
            switch (state) {
            switch (state) {
                case CONNECTION_STATE_DISCONNECTED:
                case CONNECTION_STATE_DISCONNECTED:
                    mAudioConfigs.remove(device);
                    mAudioConfigs.remove(device);
@@ -383,7 +385,7 @@ final class A2dpSinkStateMachine extends StateMachine {
                        }
                        }
                    } else if (mTargetDevice != null && mTargetDevice.equals(device)) {
                    } else if (mTargetDevice != null && mTargetDevice.equals(device)) {
                        // outgoing connection failed
                        // outgoing connection failed
                        broadcastConnectionState(mTargetDevice, BluetoothProfile.STATE_CONNECTED,
                        broadcastConnectionState(mTargetDevice, BluetoothProfile.STATE_DISCONNECTED,
                                                 BluetoothProfile.STATE_CONNECTING);
                                                 BluetoothProfile.STATE_CONNECTING);
                        synchronized (A2dpSinkStateMachine.this) {
                        synchronized (A2dpSinkStateMachine.this) {
                            mTargetDevice = null;
                            mTargetDevice = null;