Allow to register RENDER AudioMix pointing to previously
registered LOOPBACK AudioMix.
Bug: 285091923
Test: atest audiopolicy_tests AudioHostTest
Change-Id: Ieba379e5414087edf7f6da80247e35eff925506f
diff --git a/services/audiopolicy/tests/audiopolicymanager_tests.cpp b/services/audiopolicy/tests/audiopolicymanager_tests.cpp
index 97a1e0d..34c3749 100644
--- a/services/audiopolicy/tests/audiopolicymanager_tests.cpp
+++ b/services/audiopolicy/tests/audiopolicymanager_tests.cpp
@@ -1337,13 +1337,14 @@
AUDIO_DEVICE_OUT_REMOTE_SUBMIX, "", audioConfig);
ASSERT_EQ(INVALID_OPERATION, ret);
- // The first time to register valid policy mixes should succeed.
+ // The first time to register valid loopback policy mix should succeed.
clearPolicyMix();
- ret = addPolicyMix(MIX_TYPE_PLAYERS, MIX_ROUTE_FLAG_RENDER,
- AUDIO_DEVICE_OUT_SPEAKER, "", audioConfig);
+ ret = addPolicyMix(MIX_TYPE_PLAYERS, MIX_ROUTE_FLAG_LOOP_BACK,
+ AUDIO_DEVICE_OUT_REMOTE_SUBMIX, "addr", audioConfig);
ASSERT_EQ(NO_ERROR, ret);
- // Registering the same policy mixes should fail.
- ret = mManager->registerPolicyMixes(mAudioMixes);
+ // Registering the render policy for the loopback address should succeed.
+ ret = addPolicyMix(MIX_TYPE_PLAYERS, MIX_ROUTE_FLAG_RENDER,
+ AUDIO_DEVICE_OUT_REMOTE_SUBMIX, "addr", audioConfig);
ASSERT_EQ(INVALID_OPERATION, ret);
}