AudioFlinger: do not cache audio device when 0.
AudioFlinger should not cache the audio device
passed to the audio HAL when it is AUDIO_DEVICE_NONE
but keep previous valid selection instead.
Bug: 9323399.
Change-Id: I6f9480e55a21be4115453e6a5eebc5cf2536c476
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 539bb4f..6422b23 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2992,9 +2992,11 @@
// forward device change to effects that have requested to be
// aware of attached audio device.
- mOutDevice = value;
- for (size_t i = 0; i < mEffectChains.size(); i++) {
- mEffectChains[i]->setDevice_l(mOutDevice);
+ if (value != AUDIO_DEVICE_NONE) {
+ mOutDevice = value;
+ for (size_t i = 0; i < mEffectChains.size(); i++) {
+ mEffectChains[i]->setDevice_l(mOutDevice);
+ }
}
}