OSDN Git Service

HFP: Fix not handling Audio Disconnected event in Connected state
authorSzymon Janc <szymon.janc@tieto.com>
Tue, 17 Feb 2015 14:52:31 +0000 (15:52 +0100)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 5 May 2016 09:57:49 +0000 (17:57 +0800)
It is possible that remote will reject SCO connection. In such case
Audio Connecting -> Audio Disconnected intent should be sent.

Change-Id: I882308f8cc1cb4848deec6f809a5a0bdc1adfe26

src/com/android/bluetooth/hfp/HeadsetStateMachine.java

index 0cf5f33..b395df3 100644 (file)
@@ -1109,6 +1109,11 @@ final class HeadsetStateMachine extends StateMachine {
                     broadcastAudioState(device, BluetoothHeadset.STATE_AUDIO_CONNECTING,
                                         BluetoothHeadset.STATE_AUDIO_DISCONNECTED);
                     break;
+                case HeadsetHalConstants.AUDIO_STATE_DISCONNECTED:
+                    mAudioState = BluetoothHeadset.STATE_AUDIO_DISCONNECTED;
+                    broadcastAudioState(device, BluetoothHeadset.STATE_AUDIO_DISCONNECTED,
+                                        BluetoothHeadset.STATE_AUDIO_CONNECTING);
+                    break;
                     // TODO(BT) process other states
                 default:
                     Log.e(TAG, "Audio State Device: " + device + " bad state: " + state);