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

Commit 7cde9f29 authored by Ady Abraham's avatar Ady Abraham Committed by Gerrit Code Review
Browse files

Merge "Fix dumpDebugInfo blocked and phone hanging"

parents 5f1d615f 58847c56
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -264,17 +264,21 @@ std::string AidlComposer::dumpDebugInfo() {
    }

    std::string str;
    // Use other thread to read pipe to prevent
    // pipe is full, making HWC be blocked in writing.
    std::thread t([&]() {
        base::ReadFdToString(pipefds[0], &str);
    });
    const auto status = mAidlComposer->dump(pipefds[1], /*args*/ nullptr, /*numArgs*/ 0);
    // Close the write-end of the pipe to make sure that when reading from the
    // read-end we will get eof instead of blocking forever
    close(pipefds[1]);

    if (status == STATUS_OK) {
        base::ReadFdToString(pipefds[0], &str);
    } else {
    if (status != STATUS_OK) {
        ALOGE("dumpDebugInfo: dump failed: %d", status);
    }

    t.join();
    close(pipefds[0]);
    return str;
}