pal: ensure combo device routing when a2dp is resumed
If a stream is active on SCO+Speaker, add Speaker device to the list
of suspended device during A2dpResume handling. This will ensure
stream gets resumed on the combo device(A2dp+Speaker).
Change-Id: I0276ed49fdc3e79a8d28a29102462e8006c3303c
diff --git a/resource_manager/src/ResourceManager.cpp b/resource_manager/src/ResourceManager.cpp
index a0151a0..8c5ba19 100644
--- a/resource_manager/src/ResourceManager.cpp
+++ b/resource_manager/src/ResourceManager.cpp
@@ -8497,11 +8497,24 @@
if ((device->getSndDeviceId() > PAL_DEVICE_OUT_MIN &&
device->getSndDeviceId() < PAL_DEVICE_OUT_MAX) &&
((*sIter)->suspendedDevIds.size() == 1 /* non combo */)) {
- streamDevDisconnect.push_back({ (*sIter), device->getSndDeviceId() });
+ streamDevDisconnect.push_back({(*sIter), device->getSndDeviceId()});
}
}
}
-
+ restoredStreams.push_back((*sIter));
+ streamDevConnect.push_back({(*sIter), &a2dpDattr});
+ } else if (std::find((*sIter)->suspendedDevIds.begin(), (*sIter)->suspendedDevIds.end(),
+ PAL_DEVICE_OUT_BLUETOOTH_SCO) != (*sIter)->suspendedDevIds.end()) {
+ std::vector<std::shared_ptr<Device>> devices;
+ (*sIter)->getAssociatedDevices(devices);
+ if (devices.size() > 0) {
+ for (auto device: devices) {
+ if (device->getSndDeviceId() == PAL_DEVICE_OUT_BLUETOOTH_SCO) {
+ streamDevDisconnect.push_back({(*sIter), PAL_DEVICE_OUT_BLUETOOTH_SCO});
+ break;
+ }
+ }
+ }
restoredStreams.push_back((*sIter));
streamDevConnect.push_back({(*sIter), &a2dpDattr});
}
@@ -8523,6 +8536,7 @@
}
mActiveStreamMutex.lock();
+ SortAndUnique(restoredStreams);
for (sIter = restoredStreams.begin(); sIter != restoredStreams.end(); sIter++) {
if (((*sIter) != NULL) && isStreamActive(*sIter, mActiveStreams)) {
(*sIter)->lockStreamMutex();
@@ -9509,7 +9523,7 @@
(streamType == PAL_STREAM_COMPRESSED) ||
(streamType == PAL_STREAM_GENERIC)) {
(*sIter)->suspendedDevIds.clear();
- (*sIter)->suspendedDevIds.push_back(a2dp_dattr.id);
+ (*sIter)->suspendedDevIds.push_back(PAL_DEVICE_OUT_BLUETOOTH_SCO);
PAL_DBG(LOG_TAG, "a2dp resumed, mark sco streams as to route them later");
}
}