Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 479f9d0c authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "Add pids for processes that dlopens implementations" am: 2410cd17

am: 97706646

Change-Id: Ib2b23816c0032bc6303380f05ee1bb4b45de7f43
parents 6dc66446 97706646
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -467,7 +467,8 @@ Status ListCommand::fetchAllLibraries(const sp<IServiceManager> &manager) {
    using namespace ::android::hardware;
    using namespace ::android::hardware;
    using namespace ::android::hidl::manager::V1_0;
    using namespace ::android::hidl::manager::V1_0;
    using namespace ::android::hidl::base::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;
        std::map<std::string, TableEntry> entries;
        for (const auto &info : infos) {
        for (const auto &info : infos) {
            std::string interfaceName = std::string{info.interfaceName.c_str()} + "/" +
            std::string interfaceName = std::string{info.interfaceName.c_str()} + "/" +
@@ -477,7 +478,7 @@ Status ListCommand::fetchAllLibraries(const sp<IServiceManager> &manager) {
                .transport = "passthrough",
                .transport = "passthrough",
                .serverPid = NO_PID,
                .serverPid = NO_PID,
                .serverObjectAddress = NO_PTR,
                .serverObjectAddress = NO_PTR,
                .clientPids = {},
                .clientPids = info.clientPids,
                .arch = ARCH_UNKNOWN
                .arch = ARCH_UNKNOWN
            }).first->second.arch |= fromBaseArchitecture(info.arch);
            }).first->second.arch |= fromBaseArchitecture(info.arch);
        }
        }
+11 −3
Original line number Original line Diff line number Diff line
@@ -77,14 +77,15 @@ bool timeout(std::chrono::duration<R, P> delay, std::function<void(void)> &&func
    return success;
    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
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;
    using ::android::hardware::Status;
    typename std::result_of<Function(I *, Args...)>::type ret{Status::ok()};
    typename std::result_of<Function(I *, Args...)>::type ret{Status::ok()};
    auto boundFunc = std::bind(std::forward<Function>(func),
    auto boundFunc = std::bind(std::forward<Function>(func),
            interfaceObject.get(), std::forward<Args>(args)...);
            interfaceObject.get(), std::forward<Args>(args)...);
    bool success = timeout(IPC_CALL_WAIT, [&ret, &boundFunc] {
    bool success = timeout(wait, [&ret, &boundFunc] {
        ret = std::move(boundFunc());
        ret = std::move(boundFunc());
    });
    });
    if (!success) {
    if (!success) {
@@ -93,5 +94,12 @@ timeoutIPC(const sp<I> &interfaceObject, Function &&func, Args &&... args) {
    return ret;
    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 lshal
}  // namespace android
}  // namespace android