Fix fmq_test when HIDL is not supported

If HIDL is not supported on the device, don't expect to be able to
register the HIDL service.

Test: atest fmq_test
Bug: 218588089
Change-Id: I1764b26f06ef8f280f719d8ab44db2ebfe562944
This commit is contained in:
Devin Moore 2024-03-28 20:06:48 +00:00 committed by Steven Moreland
parent efb45bc792
commit 2089deb22a

View file

@ -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 @@ int main() {
LOG(INFO) << "instance: " << instance;
CHECK(AServiceManager_addService(store->asBinder().get(), instance.c_str()) == STATUS_OK);
if (isHidlSupported()) {
// Register HIDL service
CHECK(defaultPassthroughServiceImplementation<ITestMsgQ>() == android::OK);
}
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach