Merge "pal: reset isAbrEnabled flag when fb device start cnt goes zero"
diff --git a/resource_manager/src/ResourceManager.cpp b/resource_manager/src/ResourceManager.cpp
index 91d1061..133e387 100644
--- a/resource_manager/src/ResourceManager.cpp
+++ b/resource_manager/src/ResourceManager.cpp
@@ -9057,8 +9057,10 @@
                                param_bt_a2dp.dev_id = PAL_DEVICE_OUT_BLUETOOTH_A2DP;
                                param_bt_a2dp.a2dp_suspended = true;
                                PAL_DBG(LOG_TAG, "Applying cached a2dp_suspended true param");
+                               mResourceManagerMutex.unlock();
                                status = dev->setDeviceParameter(PAL_PARAM_ID_BT_A2DP_SUSPENDED,
                                                                 &param_bt_a2dp);
+                               mResourceManagerMutex.lock();
                            } else {
                                a2dp_suspended = false;
                            }
diff --git a/stream/src/Stream.cpp b/stream/src/Stream.cpp
index 355d35e..17f8314 100644
--- a/stream/src/Stream.cpp
+++ b/stream/src/Stream.cpp
@@ -866,6 +866,16 @@
 
     a2dpSuspend = false;
 
+    /* Check for BT device connected state */
+    for (int32_t i = 0; i < mDevices.size(); i++) {
+        pal_device_id_t dev_id = (pal_device_id_t)mDevices[i]->getSndDeviceId();
+        if (rm->isBtDevice(dev_id) && !(rm->isDeviceAvailable(dev_id))) {
+            PAL_ERR(LOG_TAG, "BT device %d not connected", dev_id);
+            status = -ENODEV;
+            goto exit;
+        }
+    }
+
     /* SCO device is not ready */
     if (rm->isDeviceAvailable(mDevices, PAL_DEVICE_OUT_BLUETOOTH_SCO) &&
         !rm->isDeviceReady(PAL_DEVICE_OUT_BLUETOOTH_SCO)) {