Move ishidlSupported logic to libhwbinder

libhidl still has the public API, but now libhwbinder can use the logic.

Test: launch_cvd
Bug: 324326491

Change-Id: Ied2dfd1deedae6b9dec06e2c079328f458cd1505
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index 54bb8dc..b5e02df 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -45,6 +45,7 @@
 #include <android-base/properties.h>
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
+#include <hwbinder/HidlSupport.h>
 #include <hwbinder/IPCThreadState.h>
 #include <hwbinder/Parcel.h>
 #if !defined(__ANDROID_RECOVERY__) && defined(__ANDROID__)
@@ -71,39 +72,8 @@
 static constexpr bool kIsRecovery = false;
 #endif
 
-static bool isHwServiceManagerInstalled() {
-    return access("/system_ext/bin/hwservicemanager", F_OK) == 0 ||
-           access("/system/system_ext/bin/hwservicemanager", F_OK) == 0 ||
-           access("/system/bin/hwservicemanager", F_OK) == 0;
-}
-
-static bool waitForHwServiceManager() {
-    if (!isHwServiceManagerInstalled()) {
-        return false;
-    }
-    // TODO(b/31559095): need bionic host so that we can use 'prop_info' returned
-    // from WaitForProperty
-#ifdef __ANDROID__
-    static const char* kHwServicemanagerReadyProperty = "hwservicemanager.ready";
-
-    using std::literals::chrono_literals::operator""s;
-
-    using android::base::WaitForProperty;
-    while (true) {
-        if (base::GetBoolProperty("hwservicemanager.disabled", false)) {
-            return false;
-        }
-        if (WaitForProperty(kHwServicemanagerReadyProperty, "true", 1s)) {
-            return true;
-        }
-        LOG(WARNING) << "Waited for hwservicemanager.ready for a second, waiting another...";
-    }
-#endif  // __ANDROID__
-    return true;
-}
-
 bool isHidlSupported() {
-    return waitForHwServiceManager();
+    return isHwbinderSupportedBlocking();
 }
 
 static std::string binaryName() {