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
This commit is contained in:
Ying Wang
2010-04-01 14:12:25 -07:00
parent a3916df8b9
commit 9731732fe6

View File

@@ -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;