diff options
| author | 2022-10-11 00:42:35 +0000 | |
|---|---|---|
| committer | 2022-10-11 00:42:35 +0000 | |
| commit | 6cd4a64d1ac58c0ed28dbb598db6a2b0cb6a79c4 (patch) | |
| tree | 8dbd474bf4774371648bc100d2d9384962b0ce63 | |
| parent | 666a7bf602218e8c33b72ab7c318350c43515c2f (diff) | |
| parent | 0b186a3b4368f199b10062e6984f1281b05c80d3 (diff) | |
Merge "Fix dumpDebugInfo blocked and phone hanging" am: 7cde9f29b4 am: 95873b656c am: 0b186a3b43
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2229637
Change-Id: I185a2c187b44bb6cd5629320ec10a995ec0d11b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp index 79dcd159d3..36512311d1 100644 --- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp @@ -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; } |