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

Commit babdbbde authored by Vairavan Srinivasan's avatar Vairavan Srinivasan Committed by Steve Kondik
Browse files

frameworks/base: Watchdog to generate trace of Monkey

We need stacktrace of Monkey process to debug issues wherein
system_server gets stuck doing a binder call with monkey

Change-Id: Ie0be15662c68219fe5e95592c672b86ab0987e37
(cherry picked from commit c509d1147e321118f1c908502b0b9eb5ee2a5926)

Conflicts:
	services/java/com/android/server/Watchdog.java
parent d8da01a0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ public class Watchdog extends Thread {
    int mPhonePid;
    IActivityController mController;
    boolean mAllowRestart = true;
    int mActivityControllerPid;

    final Calendar mCalendar = Calendar.getInstance();
    int mMinScreenOff = MEMCHECK_DEFAULT_MIN_SCREEN_OFF;
@@ -225,6 +226,9 @@ public class Watchdog extends Thread {
            if ("com.android.phone".equals(name)) {
                mPhonePid = pid;
            }
            else if ("ActivityController".equals(name)) {
                     mActivityControllerPid = pid;
            }
        }
    }

@@ -456,6 +460,7 @@ public class Watchdog extends Thread {
            ArrayList<Integer> pids = new ArrayList<Integer>();
            pids.add(Process.myPid());
            if (mPhonePid > 0) pids.add(mPhonePid);
            if (mActivityControllerPid > 0) pids.add(mActivityControllerPid);
            // Pass !waitedHalf so that just in case we somehow wind up here without having
            // dumped the halfway stacks, we properly re-initialize the trace file.
            final File stack = ActivityManagerService.dumpStackTraces(
+4 −0
Original line number Diff line number Diff line
@@ -7530,6 +7530,10 @@ public final class ActivityManagerService extends ActivityManagerNative
    public void setActivityController(IActivityController controller) {
        enforceCallingPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER,
                "setActivityController()");
        int pid = controller == null ? 0 : Binder.getCallingPid();
        Watchdog.getInstance().processStarted("ActivityController", pid);
        synchronized (this) {
            mController = controller;
            Watchdog.getInstance().setActivityController(controller);