Loading android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +17 −0 Original line number Diff line number Diff line Loading @@ -1082,6 +1082,12 @@ final class HeadsetStateMachine extends StateMachine { switch (state) { case HeadsetHalConstants.AUDIO_STATE_CONNECTED: if (!isScoAcceptable()) { Log.e(TAG,"Audio Connected without any listener"); disconnectAudioNative(getByteAddress(device)); break; } // TODO(BT) should I save the state for next broadcast as the prevState? mAudioState = BluetoothHeadset.STATE_AUDIO_CONNECTED; setAudioParameters(device); /*Set proper Audio Paramters.*/ Loading Loading @@ -1947,6 +1953,11 @@ final class HeadsetStateMachine extends StateMachine { switch (state) { case HeadsetHalConstants.AUDIO_STATE_CONNECTED: if (!isScoAcceptable()) { Log.e(TAG,"Audio Connected without any listener"); disconnectAudioNative(getByteAddress(device)); break; } mAudioState = BluetoothHeadset.STATE_AUDIO_CONNECTED; setAudioParameters(device); /* Set proper Audio Parameters. */ mAudioManager.setBluetoothScoOn(true); Loading Loading @@ -3207,6 +3218,12 @@ final class HeadsetStateMachine extends StateMachine { (mPhoneState.getCallState() != HeadsetHalConstants.CALL_STATE_IDLE)); } // Accept incoming SCO only when there is active call, VR activated, // active VOIP call private boolean isScoAcceptable() { return (mVoiceRecognitionStarted || isInCall()); } boolean isConnected() { IState currentState = getCurrentState(); return (currentState == mConnected || currentState == mAudioOn); Loading Loading
android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +17 −0 Original line number Diff line number Diff line Loading @@ -1082,6 +1082,12 @@ final class HeadsetStateMachine extends StateMachine { switch (state) { case HeadsetHalConstants.AUDIO_STATE_CONNECTED: if (!isScoAcceptable()) { Log.e(TAG,"Audio Connected without any listener"); disconnectAudioNative(getByteAddress(device)); break; } // TODO(BT) should I save the state for next broadcast as the prevState? mAudioState = BluetoothHeadset.STATE_AUDIO_CONNECTED; setAudioParameters(device); /*Set proper Audio Paramters.*/ Loading Loading @@ -1947,6 +1953,11 @@ final class HeadsetStateMachine extends StateMachine { switch (state) { case HeadsetHalConstants.AUDIO_STATE_CONNECTED: if (!isScoAcceptable()) { Log.e(TAG,"Audio Connected without any listener"); disconnectAudioNative(getByteAddress(device)); break; } mAudioState = BluetoothHeadset.STATE_AUDIO_CONNECTED; setAudioParameters(device); /* Set proper Audio Parameters. */ mAudioManager.setBluetoothScoOn(true); Loading Loading @@ -3207,6 +3218,12 @@ final class HeadsetStateMachine extends StateMachine { (mPhoneState.getCallState() != HeadsetHalConstants.CALL_STATE_IDLE)); } // Accept incoming SCO only when there is active call, VR activated, // active VOIP call private boolean isScoAcceptable() { return (mVoiceRecognitionStarted || isInCall()); } boolean isConnected() { IState currentState = getCurrentState(); return (currentState == mConnected || currentState == mAudioOn); Loading