diff options
author | Devin Moore <devinmoore@google.com> | 2024-04-25 00:07:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-25 00:07:11 +0000 |
commit | 7b7db076000b8a854478dd488b8acd9f2df98e25 (patch) | |
tree | 5b6abb5dd8c466a821d57f6d27b178809f2414ba | |
parent | 4af50ba7e258328288247e7493d6c4d81d576ab4 (diff) | |
parent | 17355cb1ac702c9f8a0870acaa39bb9c828df9d8 (diff) | |
download | libhidl-master.tar.gz |
-rw-r--r-- | transport/ServiceManagement.cpp | 34 |
1 files changed, 2 insertions, 32 deletions
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 = true; 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() { |