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

Commit 81918d30 authored by Mahantesh Sanakall's avatar Mahantesh Sanakall Committed by Gerrit - the friendly Code Review server
Browse files

Allow device to enter download mode on framework watchdog

This allows to get better insight of the device state at the
time of framework watchdog

Also, trigger sysRq after collecting traces

When system_server watchdog occurs, triggering sysRq can cause
watchdog bark and system_server traces is not generating. Trigger
sysRq after collecting traces

Change-Id: I504b66d2b63bf693d38eddb7d1f4122be307639a
parent b83a73a6
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -431,10 +431,6 @@ public class Watchdog extends Thread {
                dumpKernelStackTraces();
            }

            // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the kernel log
            doSysRq('w');
            doSysRq('l');

            String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
            String traceFileNameAmendment = "_SystemServer_WDT" + mTraceDateFormat.format(new Date());

@@ -467,6 +463,24 @@ public class Watchdog extends Thread {
                dropboxThread.join(2000);  // wait up to 2 seconds for it to return.
            } catch (InterruptedException ignored) {}

            // Trigger the kernel to dump all blocked threads, and backtraces on all CPUs to the kernel log
            Slog.e(TAG, "Triggering SysRq for system_server watchdog");
            doSysRq('w');
            doSysRq('l');

            // At times, when user space watchdog traces don't give an indication on
            // which component held a lock, because of which other threads are blocked,
            // (thereby causing Watchdog), crash the device to analyze RAM dumps
            boolean crashOnWatchdog = SystemProperties
                                        .getBoolean("persist.sys.crashOnWatchdog", false);
            if (crashOnWatchdog) {
                // wait until the above blocked threads be dumped into kernel log
                SystemClock.sleep(3000);

                // now try to crash the target
                doSysRq('c');
            }

            IActivityController controller;
            synchronized (this) {
                controller = mController;