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

Commit 049ebe93 authored by qinyige1's avatar qinyige1
Browse files

[AMS][Bugfix] Fix hang when dumping local cache info.

TransferPipe exploits pipe for IPC. However, it can't be used
for local dump. If data is large enough, writing will get stuck
when buffer is full since reading can't be executed. So directly
dump to target fd instead of using pipe for local dump.

Bug: 270277093
Test: Manual
Change-Id: Ic2f52672fbf9f1797dbafcd71d363be93b3b5f1e
parent 7370ba4f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -10763,6 +10763,13 @@ public class ActivityManagerService extends IActivityManager.Stub
                pw.println("\n\n** Cache info for pid " + pid + " [" + r.processName + "] **");
                pw.flush();
                try {
                    if (pid == Process.myPid()) {
                        // Directly dump to target fd for local dump to avoid hang.
                        try (ParcelFileDescriptor pfd = ParcelFileDescriptor.fromFd(fd.getInt$())) {
                            thread.dumpCacheInfo(pfd, args);
                        }
                        continue;
                    }
                    TransferPipe tp = new TransferPipe();
                    try {
                        thread.dumpCacheInfo(tp.getWriteFd(), args);