Snap for 6748571 from 677ab566b988a49df146c027f604fb7336875956 to q-keystone-qcom-release

Change-Id: Id0fcb5041ddd6eb5d196a271c2b12ef4ee1b250b
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index ceef453..d8a64be 100644
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -1372,6 +1372,7 @@
                 // devices that previously successfully connected.
                 removeDeferredMessages(CONNECT);
             }
+            broadcastStateTransitions();
             if ((mPrevState == mAudioOn) || (mPrevState == mAudioDisconnecting)||
                  (mPrevState == mAudioConnecting)) {
                 if (!(mSystemInterface.isInCall() || mSystemInterface.isRinging())) {
@@ -1380,7 +1381,6 @@
                         mHeadsetService.getHfpA2DPSyncInterface().releaseA2DP(mDevice);
                 }
             }
-            broadcastStateTransitions();
         }
 
         @Override
@@ -1742,6 +1742,7 @@
                         //any devices before letting Audio knowing about it
                         stateLogI("TWS+ device and other SCO is still Active, no BT_SCO=off");
                     } else {
+                        mSystemInterface.getAudioManager().setBluetoothScoOn(false);
                         if(mSystemInterface.getAudioManager().isSpeakerphoneOn()) {
                             mSystemInterface.getAudioManager().setSpeakerphoneOn(true);
                         }
@@ -1825,6 +1826,7 @@
                          //any devices before letting Audio knowing about it
                          stateLogI("TWS+ device and other SCO is still Active, no BT_SCO=off");
                     } else {
+                        mSystemInterface.getAudioManager().setBluetoothScoOn(false);
                         if(mSystemInterface.getAudioManager().isSpeakerphoneOn()) {
                             mSystemInterface.getAudioManager().setSpeakerphoneOn(true);
                         }