summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yifan Hong <elsk@google.com> 2017-05-26 20:29:27 +0000
committer android-build-merger <android-build-merger@google.com> 2017-05-26 20:29:27 +0000
commit564a599e94acda7ec5e1924f9eaf8c2071ade60a (patch)
tree7cf1aaeb8d75b9f0a6c7433b1d979ae2b4d85db3
parent883d667c42c55e757e653d01fccd4160704657d5 (diff)
parent479f9d0c7b2d4777e31b6a481a98fe908befed2c (diff)
Merge "Add pids for processes that dlopens implementations" am: 2410cd179d am: 977066464e
am: 479f9d0c7b Change-Id: I896d198a1680ad1a5020a712f925db3c3dfc2084
-rw-r--r--cmds/lshal/ListCommand.cpp5
-rw-r--r--cmds/lshal/Timeout.h14
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