Merge 2e35d279098577236301d3a99cf1bb6b2adca9d7 on remote branch

Change-Id: I77c1f5e91f7988089c874cecdde88e1f9b0391a1
diff --git a/system_bt_ext/bta/tws_plus/ag/bta_ag_twsp_sco.cc b/system_bt_ext/bta/tws_plus/ag/bta_ag_twsp_sco.cc
index 4a22347..99372c3 100644
--- a/system_bt_ext/bta/tws_plus/ag/bta_ag_twsp_sco.cc
+++ b/system_bt_ext/bta/tws_plus/ag/bta_ag_twsp_sco.cc
@@ -376,7 +376,13 @@
 
           /* If SCO was active on this scb, close it */
           if (p_scb == p_sco->p_curr_scb) {
-            p_sco->state = BTA_AG_SCO_SHUTTING_ST;
+            if (p_scb->svc_conn) {
+              p_sco->state = BTA_AG_SCO_SHUTTING_ST;
+            } else {
+              p_sco->state = BTA_AG_SCO_SHUTDOWN_ST;
+              p_scb->sco_idx = BTM_INVALID_SCO_INDEX;
+              p_sco->p_curr_scb = NULL;
+            }
           }
           break;