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

Commit c14a03bd authored by Uday Kiran jandhyala's avatar Uday Kiran jandhyala
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

Change-Id: Id62ab5c156793a91161770cd4ed388b3783a1960
parent e66be80c
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -460,6 +460,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) {
                // wait until the above blocked threads be dumped into kernel log
                SystemClock.sleep(3000);

                // now try to crash the target
                try {
                    FileWriter sysrq_trigger = new FileWriter("/proc/sysrq-trigger");
                    sysrq_trigger.write("c");
                    sysrq_trigger.close();
                } catch (IOException e) {
                    Slog.e(TAG, "Failed to write 'c' to /proc/sysrq-trigger");
                    Slog.e(TAG, e.getMessage());
                }
            }

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