diff options
-rw-r--r-- | cmds/lshal/ListCommand.cpp | 5 | ||||
-rw-r--r-- | cmds/lshal/Timeout.h | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp index 2eb58ae0a5..87b9104196 100644 --- a/cmds/lshal/ListCommand.cpp +++ b/cmds/lshal/ListCommand.cpp @@ -467,7 +467,8 @@ Status ListCommand::fetchAllLibraries(const sp<IServiceManager> &manager) { using namespace ::android::hardware; using namespace ::android::hidl::manager::V1_0; using namespace ::android::hidl::base::V1_0; - auto ret = timeoutIPC(manager, &IServiceManager::debugDump, [&] (const auto &infos) { + using std::literals::chrono_literals::operator""s; + auto ret = timeoutIPC(2s, manager, &IServiceManager::debugDump, [&] (const auto &infos) { std::map<std::string, TableEntry> entries; for (const auto &info : infos) { std::string interfaceName = std::string{info.interfaceName.c_str()} + "/" + @@ -477,7 +478,7 @@ Status ListCommand::fetchAllLibraries(const sp<IServiceManager> &manager) { .transport = "passthrough", .serverPid = NO_PID, .serverObjectAddress = NO_PTR, - .clientPids = {}, + .clientPids = info.clientPids, .arch = ARCH_UNKNOWN }).first->second.arch |= fromBaseArchitecture(info.arch); } diff --git a/cmds/lshal/Timeout.h b/cmds/lshal/Timeout.h index ca477bf615..c940404200 100644 --- a/cmds/lshal/Timeout.h +++ b/cmds/lshal/Timeout.h @@ -77,14 +77,15 @@ bool timeout(std::chrono::duration<R, P> delay, std::function<void(void)> &&func return success; } -template<class Function, class I, class... Args> +template<class R, class P, class Function, class I, class... Args> typename std::result_of<Function(I *, Args...)>::type -timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) { +timeoutIPC(std::chrono::duration<R, P> wait, const sp<I> &interfaceObject, Function &&func, + Args &&... args) { using ::android::hardware::Status; typename std::result_of<Function(I *, Args...)>::type ret{Status::ok()}; auto boundFunc = std::bind(std::forward<Function>(func), interfaceObject.get(), std::forward<Args>(args)...); - bool success = timeout(IPC_CALL_WAIT, [&ret, &boundFunc] { + bool success = timeout(wait, [&ret, &boundFunc] { ret = std::move(boundFunc()); }); if (!success) { @@ -93,5 +94,12 @@ timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) { return ret; } +template<class Function, class I, class... Args> +typename std::result_of<Function(I *, Args...)>::type +timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) { + return timeoutIPC(IPC_CALL_WAIT, interfaceObject, func, args...); +} + + } // namespace lshal } // namespace android |