AudioPolicy: Improve logging on Remote submix errors
Bug: 131064451
Test: atest AudioPlaybackCaptureTest
Change-Id: I13e662514de11e66f7ca145b320f351640a55ddb
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 6dc5eb8..d7dc51a 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -1999,7 +1999,7 @@
String8(attr->tags + strlen("addr=")),
AUDIO_FORMAT_DEFAULT);
if (device == nullptr) {
- ALOGW("%s could not find device for source %d, tags %s",
+ ALOGW("%s could not find in Remote Submix device for source %d, tags %s",
__func__, attributes.source, attributes.tags);
status = BAD_VALUE;
goto error;
@@ -2957,17 +2957,17 @@
continue;
}
- if (getDeviceConnectionState(AUDIO_DEVICE_IN_REMOTE_SUBMIX, address.string()) ==
- AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
- setDeviceConnectionStateInt(AUDIO_DEVICE_IN_REMOTE_SUBMIX,
- AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
- address.string(), "remote-submix", AUDIO_FORMAT_DEFAULT);
- }
- if (getDeviceConnectionState(AUDIO_DEVICE_OUT_REMOTE_SUBMIX, address.string()) ==
- AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
- setDeviceConnectionStateInt(AUDIO_DEVICE_OUT_REMOTE_SUBMIX,
- AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
- address.string(), "remote-submix", AUDIO_FORMAT_DEFAULT);
+ for (auto device : {AUDIO_DEVICE_IN_REMOTE_SUBMIX, AUDIO_DEVICE_OUT_REMOTE_SUBMIX}) {
+ if (getDeviceConnectionState(device, address.string()) ==
+ AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
+ res = setDeviceConnectionStateInt(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+ address.string(), "remote-submix",
+ AUDIO_FORMAT_DEFAULT);
+ if (res != OK) {
+ ALOGE("Error making RemoteSubmix device unavailable for mix "
+ "with type %d, address %s", device, address.string());
+ }
+ }
}
rSubmixModule->removeOutputProfile(address);
rSubmixModule->removeInputProfile(address);