HIDL stuff on host.

The motivation of this is for quickly running unit tests of HAL
implementations on host. Before, you would have to abstract away
HIDL stuff, but now, you can just call a class that inherits from
HIDL stuff directly.

Currently, there is no binder or passthrough support on host though.
This is only for unit tests of C++ classes.

Bug: 124524556
Test: libhidl_test on host
Change-Id: I922060e48406ca196fbf864e549c05f5e1113d62
diff --git a/test_main.cpp b/test_main.cpp
index 083cee4..fc71231 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -33,6 +33,12 @@
 #include <fstream>
 #include <vector>
 
+#ifdef __ANDROID__
+static bool kAndroid = true;
+#else
+static bool kAndroid = false;
+#endif
+
 #define EXPECT_ARRAYEQ(__a1__, __a2__, __size__) EXPECT_TRUE(isArrayEqual(__a1__, __a2__, __size__))
 #define EXPECT_2DARRAYEQ(__a1__, __a2__, __size1__, __size2__) \
         EXPECT_TRUE(is2dArrayEqual(__a1__, __a2__, __size1__, __size2__))
@@ -563,6 +569,10 @@
 }
 
 TEST_F(LibHidlTest, PreloadTest) {
+    // HIDL doesn't have support to load passthrough implementations on host, but we
+    // could do this by loading implementations from the output directory
+    if (!kAndroid) GTEST_SKIP();
+
     using ::android::hardware::preloadPassthroughService;
     using ::android::hidl::memory::V1_0::IMemory;