VtsHalAudioEffectTargetTest: Fix crash issue
Ensure all pending binder transactions are completed before proceeding. Add a delay to allow the binder destruction to propagate and ensure the remote objects are properly cleaned up.
Bug: 272442019
Test: atest VtsHalAudioEffectV7_0TargetTest
Change-Id: I6dc054b8f7895334c31c5579afb86eacba28d832
diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
index ff84f9d..d093ffe 100644
--- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
@@ -39,6 +39,7 @@
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
+#include <hwbinder/IPCThreadState.h>
using ::android::sp;
using ::android::hardware::hidl_handle;
@@ -205,6 +206,11 @@
void TearDown() override {
effect.clear();
effectsFactory.clear();
+ // Ensure all pending binder transactions are completed before proceeding.
+ android::hardware::IPCThreadState::self()->flushCommands();
+ // Add a delay to allow the binder destruction to propagate and ensure
+ // the remote objects are properly cleaned up.
+ usleep(100 * 1000);
}
protected: