If hwservicemanager isn't installed, isHidlSupported == false am: adb1320e43

Original change: https://android-review.googlesource.com/c/platform/system/libhidl/+/2855496

Change-Id: I1cc9e3313bc65021f691bd3de7109795d1d464e7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index c3d3fa4..8867f53 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -211,7 +211,16 @@
            fqName == IServiceManager1_2::descriptor;
 }
 
+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;
+}
+
 bool isHidlSupported() {
+    if (!isHwServiceManagerInstalled()) {
+        return false;
+    }
 #ifdef __ANDROID__
     // TODO(b/218588089) remove this temporary support variable once Cuttlefish
     // (the only current Android V launching device) no longer requires HIDL.