From 829a00bd6e54ce78fe1a28d8739988e24ec4ab6d Mon Sep 17 00:00:00 2001 From: jiabin Date: Wed, 4 Apr 2018 16:28:32 -0700 Subject: [PATCH] Clear input routing when closeAllInputs(). When the device disconnect, all inputs will be closed before calling releaseInput(). In that case, input route ref count will be wrong due to route couldn't be removed in releaseInput() since the input is already closed, that may cause the routing error. Clear input routes to prevent the routing error when closing all inputs. Bug: 77520691 Test: Reconnecting the usb device, check the input routing. Change-Id: I754cf2774c9c38b751f918b32e881b6d464a7a01 --- services/audiopolicy/managerdefault/AudioPolicyManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp index 8f6db461b5..ee68900027 100644 --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp @@ -2141,6 +2141,7 @@ void AudioPolicyManager::closeAllInputs() { } inputDesc->close(); } + mInputRoutes.clear(); mInputs.clear(); SoundTrigger::setCaptureState(false); nextAudioPortGeneration();