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

Commit 0b186a3b authored by Ady Abraham's avatar Ady Abraham Committed by Automerger Merge Worker
Browse files

Merge "Fix dumpDebugInfo blocked and phone hanging" am: 7cde9f29 am: 95873b65

parents 458e3014 95873b65
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;
}