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

Commit d6da080c authored by Biswajit Paul's avatar Biswajit Paul Committed by Linux Build Service Account
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)
(cherry picked from commit 27638c88997499490e681d8237d7435effe8d4a5)
(cherry picked from commit d29598744ce156917380141944404eb5567bf1d7)
parent 90827a35
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class Watchdog extends Thread {
    int mPhonePid;
    IActivityController mController;
    boolean mAllowRestart = true;
    int mActivityControllerPid;

    /**
     * Used for checking status of handle threads and scheduling monitor callbacks.
@@ -217,6 +218,9 @@ public class Watchdog extends Thread {
            if ("com.android.phone".equals(name)) {
                mPhonePid = pid;
            }
            else if ("ActivityController".equals(name)) {
                     mActivityControllerPid = pid;
            }
        }
    }

@@ -353,6 +357,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
@@ -8361,6 +8361,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);