audioflinger: clean previously opened input selectedDeviceId if retrying
selectedDeviceId is not cleaned when retrying open input.
and will add this selectedDeviceId into input routing.
Which will cause getDeviceForInputSource() not doing
mEngine->getDeviceForInputSource() but only return
route->mDeviceDescriptor->type() and failed to route to
the correct device.
Test: self-test routing is corrected.
Bug:79332409
Test: routing is corrected.
Change-Id: Ia85c773f3549befb929178469116dc2d4e4945ad
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 76b29c9..bdd39c6 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1690,6 +1690,7 @@
recordTrack.clear();
AudioSystem::releaseInput(portId);
output.inputId = AUDIO_IO_HANDLE_NONE;
+ output.selectedDeviceId = input.selectedDeviceId;
portId = AUDIO_PORT_HANDLE_NONE;
}
lStatus = AudioSystem::getInputForAttr(&input.attr, &output.inputId,