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

Commit 7e44e26d authored by Gaurav Asati's avatar Gaurav Asati
Browse files

Bluetooth:Handling Connect request in AudioOn state.

While in active call, connected to the first BT HS, when we
initiate connection to a second BT HS, connection was not
happening because of which the call audio was routing to the
speaker. Added Connect message handling in the AudioOn state.

Change-Id: I3d9f4265aa2cfddf141ac60f7da82fabfd4bc383
CRs-Fixed: 534731
parent 5cd8529f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -932,6 +932,21 @@ final class HeadsetStateMachine extends StateMachine {

            boolean retValue = HANDLED;
            switch(message.what) {
                case CONNECT:
                {
                    BluetoothDevice device = (BluetoothDevice) message.obj;
                    if (mCurrentDevice.equals(device)) {
                        break;
                    }
                    deferMessage(obtainMessage(DISCONNECT, mCurrentDevice));
                    deferMessage(obtainMessage(CONNECT, message.obj));
                    if (disconnectAudioNative(getByteAddress(mCurrentDevice))) {
                        log("Disconnecting SCO audio");
                    } else {
                        Log.e(TAG, "disconnectAudioNative failed");
                    }
                }
                break;
                case DISCONNECT:
                {
                    BluetoothDevice device = (BluetoothDevice) message.obj;