summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-05-03 16:27:39 -0700
committerDianne Hackborn <hackbod@google.com>2013-05-06 11:16:34 -0700
commitcb8739c53fb99d849e29d0fce85066dad2eee6fe (patch)
treef2d9d3e10da1c6d1e2cd867f0386060140175512 /cmds
parent2cd4b68cab9802a6f542eae50154ab3a94f32f08 (diff)
downloadandroid_development-cb8739c53fb99d849e29d0fce85066dad2eee6fe.tar.gz
android_development-cb8739c53fb99d849e29d0fce85066dad2eee6fe.tar.bz2
android_development-cb8739c53fb99d849e29d0fce85066dad2eee6fe.zip
Debugging help for issue #8734824: WATCHDOG KILLING SYSTEM PROCESS
The monkey now gets told about system hangs, and does stuff about it! Most especially, it can collect a bug report. Monkey wins! Change-Id: Ic8350721e715ef21d1ec813c6aff9a83262d5faa
Diffstat (limited to 'cmds')
-rw-r--r--cmds/monkey/src/com/android/commands/monkey/Monkey.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
index 5e86a79c8..a2655e159 100644
--- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java
+++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
@@ -134,6 +134,18 @@ public class Monkey {
/**
* This is set by the ActivityController thread to request a
+ * bugreport after a system watchdog report
+ */
+ private boolean mRequestWatchdogBugreport = false;
+
+ /**
+ * Synchronization for the ActivityController callback to block
+ * until we are done handling the reporting of the watchdog error.
+ */
+ private boolean mWatchdogWaiting = false;
+
+ /**
+ * This is set by the ActivityController thread to request a
* bugreport after java application crash
*/
private boolean mRequestAppCrashBugreport = false;
@@ -355,6 +367,31 @@ public class Monkey {
}
return (mKillProcessAfterError) ? -1 : 1;
}
+
+ public int systemNotResponding(String message) {
+ StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites();
+ System.err.println("// WATCHDOG: " + message);
+ StrictMode.setThreadPolicy(savedPolicy);
+
+ synchronized (Monkey.this) {
+ if (!mIgnoreCrashes) {
+ mAbort = true;
+ }
+ if (mRequestBugreport) {
+ mRequestWatchdogBugreport = true;
+ }
+ mWatchdogWaiting = true;
+ }
+ synchronized (Monkey.this) {
+ while (mWatchdogWaiting) {
+ try {
+ Monkey.this.wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ return (mKillProcessAfterError) ? -1 : 1;
+ }
}
/**
@@ -635,6 +672,11 @@ public class Monkey {
getBugreport("anr_" + mReportProcessName + "_");
mRequestAnrBugreport = false;
}
+ if (mRequestWatchdogBugreport) {
+ System.out.println("Print the watchdog report");
+ getBugreport("anr_watchdog_");
+ mRequestWatchdogBugreport = false;
+ }
if (mRequestAppCrashBugreport){
getBugreport("app_crash" + mReportProcessName + "_");
mRequestAppCrashBugreport = false;
@@ -647,6 +689,10 @@ public class Monkey {
getBugreport("Bugreport_");
mRequestPeriodicBugreport = false;
}
+ if (mWatchdogWaiting) {
+ mWatchdogWaiting = false;
+ notifyAll();
+ }
}
if (mGenerateHprof) {
@@ -1027,6 +1073,11 @@ public class Monkey {
getBugreport("anr_" + mReportProcessName + "_");
mRequestAnrBugreport = false;
}
+ if (mRequestWatchdogBugreport) {
+ System.out.println("Print the watchdog report");
+ getBugreport("anr_watchdog_");
+ mRequestWatchdogBugreport = false;
+ }
if (mRequestAppCrashBugreport){
getBugreport("app_crash" + mReportProcessName + "_");
mRequestAppCrashBugreport = false;
@@ -1053,6 +1104,10 @@ public class Monkey {
if (mAbort) {
shouldAbort = true;
}
+ if (mWatchdogWaiting) {
+ mWatchdogWaiting = false;
+ notifyAll();
+ }
}
// Report ANR, dumpsys after releasing lock on this.