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

Commit 3a68e181 authored by Guang Zhu's avatar Guang Zhu Committed by Android Git Automerger
Browse files

am 4ba4e03e: Merge "also add backtraces of CPUs before watchdog kills system...

am 4ba4e03e: Merge "also add backtraces of CPUs before watchdog kills system server" into lmp-mr1-dev

* commit '4ba4e03e':
  also add backtraces of CPUs before watchdog kills system server
parents 52e34e6a 4ba4e03e
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -415,15 +415,9 @@ public class Watchdog extends Thread {
                dumpKernelStackTraces();
            }

            // Trigger the kernel to dump all blocked threads to the kernel log
            try {
                FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
                sysrq_trigger.write("w");
                sysrq_trigger.close();
            } catch (IOException e) {
                Slog.e(TAG, "Failed to write to /proc/sysrq-trigger");
                Slog.e(TAG, e.getMessage());
            }
            // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the kernel log
            doSysRq('w');
            doSysRq('l');

            // Try to add the error to the dropbox, but assuming that the ActivityManager
            // itself may be deadlocked.  (which has happened, causing this statement to
@@ -488,6 +482,16 @@ public class Watchdog extends Thread {
        }
    }

    private void doSysRq(char c) {
        try {
            FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
            sysrq_trigger.write(c);
            sysrq_trigger.close();
        } catch (IOException e) {
            Slog.w(TAG, "Failed to write to /proc/sysrq-trigger", e);
        }
    }

    private File dumpKernelStackTraces() {
        String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
        if (tracesPath == null || tracesPath.length() == 0) {