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

Commit fc1b0d75 authored by Shilpa Suresh's avatar Shilpa Suresh Committed by Linux Build Service Account
Browse files

Enable download mode on framework watchdog, based on property

Enabling download mode allows to get better insight of the
device state at the time of framework watchdog.

Also moving the SysRq triggers inside the conditional block
to avoid watchdog bark and to ensure traces are collected
before dumping blocked threads and CPU backtraces.

Change-Id: I444e550af0e23053f34b3d47db07c67c6f43133f
parent f7212726
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -438,10 +438,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());

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


            // 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) {
                // 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');

                // 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;