From 9731732fe67499d3ef31747bdca140f8246ec625 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 1 Apr 2010 14:12:25 -0700 Subject: [PATCH] Move potentially blocking operation out of the activity controller. http://b/viewIssue?id=2497953 before this CL, call to reportProcRank() in the controller waited for the procrank process to finish, which potentially would block the activity manager and cause deadlock between the activity manager and the window manager. Change-Id: Ie5a6aae7c8dbe43ac725abdb04f2426f54dd6740 --- .../src/com/android/commands/monkey/Monkey.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java index ff2a5872d..af8ca95e7 100644 --- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java +++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java @@ -118,6 +118,11 @@ public class Monkey { */ private boolean mRequestDumpsysMemInfo = false; + /** + * This is set by the ActivityController thread to request a "procrank" + */ + private boolean mRequestProcRank = false; + /** Kill the process after a timeout or crash. */ private boolean mKillProcessAfterError; @@ -261,10 +266,10 @@ public class Monkey { public int appNotResponding(String processName, int pid, String processStats) { System.err.println("// NOT RESPONDING: " + processName + " (pid " + pid + ")"); System.err.println(processStats); - reportProcRank(); synchronized (Monkey.this) { mRequestAnrTraces = true; mRequestDumpsysMemInfo = true; + mRequestProcRank = true; } if (!mIgnoreTimeouts) { synchronized (Monkey.this) { @@ -852,6 +857,10 @@ public class Monkey { while (!systemCrashed && cycleCounter < mCount) { synchronized (this) { + if (mRequestProcRank) { + reportProcRank(); + mRequestProcRank = false; + } if (mRequestAnrTraces) { reportAnrTraces(); mRequestAnrTraces = false;