If hwservicemanager isn't installed, isHidlSupported == false
If hwservicemanager isn't on the device, then HIDL isn't supported.
Test: m
Bug: 218588089
Bug: 314116033
Change-Id: Ife5e7761f58edb6edfa6dcd5a874ad3937407638
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.