Merge "Fix fmq_test when HIDL is not supported" into main am: aeab14d52c

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3020084

Change-Id: Ica0dd349324e2b2415001a1b7cc65d7ced2d79f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/tests/msgq/1.0/default/mq_test_service.cpp b/tests/msgq/1.0/default/mq_test_service.cpp
index 72ffe41..66ad12f 100644
--- a/tests/msgq/1.0/default/mq_test_service.cpp
+++ b/tests/msgq/1.0/default/mq_test_service.cpp
@@ -21,13 +21,15 @@
 #include <android/binder_manager.h>
 #include <android/binder_process.h>
 #include <android/hardware/tests/msgq/1.0/ITestMsgQ.h>
+#include <hidl/ServiceManagement.h>
 
 using aidl::android::fmq::test::TestAidlMsgQ;
 
 #include <hidl/LegacySupport.h>
 
-using android::hardware::tests::msgq::V1_0::ITestMsgQ;
 using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::isHidlSupported;
+using android::hardware::tests::msgq::V1_0::ITestMsgQ;
 
 int main() {
     android::hardware::details::setTrebleTestingOverride(true);
@@ -39,8 +41,10 @@
     LOG(INFO) << "instance: " << instance;
     CHECK(AServiceManager_addService(store->asBinder().get(), instance.c_str()) == STATUS_OK);
 
-    // Register HIDL service
-    CHECK(defaultPassthroughServiceImplementation<ITestMsgQ>() == android::OK);
+    if (isHidlSupported()) {
+        // Register HIDL service
+        CHECK(defaultPassthroughServiceImplementation<ITestMsgQ>() == android::OK);
+    }
     ABinderProcess_joinThreadPool();
 
     return EXIT_FAILURE;  // should not reach