Merge "[Monkey][Bugfix] Do not report crash in monkey proc." am: f2384e9621 am: 2a690dd230
Original change: https://android-review.googlesource.com/c/platform/development/+/2579611 Change-Id: I5d8a69a5e8492dcc06419cd686cf1c8d2976fa55 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -550,6 +550,16 @@ public class Monkey {
|
||||
commandLineReport(bugreportName + ".txt", "bugreport");
|
||||
}
|
||||
|
||||
// UncaughtExceptionHandler set by RuntimeInit will report crash to system_server, which
|
||||
// is not necessary for monkey and even causes deadlock. So we override it.
|
||||
private static class KillSelfHandler implements Thread.UncaughtExceptionHandler {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(10);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Command-line entry point.
|
||||
*
|
||||
@@ -559,6 +569,7 @@ public class Monkey {
|
||||
// Set the process name showing in "ps" or "top"
|
||||
Process.setArgV0("com.android.commands.monkey");
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new KillSelfHandler());
|
||||
Logger.err.println("args: " + Arrays.toString(args));
|
||||
int resultCode = (new Monkey()).run(args);
|
||||
System.exit(resultCode);
|
||||
|
||||
Reference in New Issue
Block a user