summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-08-06 00:37:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-05 00:34:22 +0000
commit92ce4715315bddd158c7d4028556632f0547e3b9 (patch)
tree3d57deb9798654f163f4f04764c63ddc94b55298 /services/audiopolicy
parent1c8d1e4079f2b8efd71423158e7f298cf1dc2c31 (diff)
parentcf817a2330936947df94c11859f48771f5596a59 (diff)
downloadframeworks_av-92ce4715315bddd158c7d4028556632f0547e3b9.zip
frameworks_av-92ce4715315bddd158c7d4028556632f0547e3b9.tar.gz
frameworks_av-92ce4715315bddd158c7d4028556632f0547e3b9.tar.bz2
Merge "audio: fix crashes upon USB device connection" into lmp-dev
Diffstat (limited to 'services/audiopolicy')
-rw-r--r--services/audiopolicy/AudioPolicyManager.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index b09300b..c519593 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -240,10 +240,14 @@ status_t AudioPolicyManager::setDeviceConnectionState(audio_devices_t device,
// register new device as available
index = mAvailableOutputDevices.add(devDesc);
if (index >= 0) {
- mAvailableOutputDevices[index]->mId = nextUniqueId();
sp<HwModule> module = getModuleForDevice(device);
- ALOG_ASSERT(module != NULL, "setDeviceConnectionState():"
- "could not find HW module for device %08x", device);
+ if (module == 0) {
+ ALOGD("setDeviceConnectionState() could not find HW module for device %08x",
+ device);
+ mAvailableOutputDevices.remove(devDesc);
+ return INVALID_OPERATION;
+ }
+ mAvailableOutputDevices[index]->mId = nextUniqueId();
mAvailableOutputDevices[index]->mModule = module;
} else {
return NO_MEMORY;