Add half watchdogs to dropbox and make the watchdog timeout
configurable.
The content of the half watchdog is now more consistent with watchdogs
to make it more actionable (watchdog subject, memory psi, cpu data).
The half watchdog is also published to dropbox in a similar way to the
watchdog. We also use a thread to publish to dropbox to make sure that
we do not block the watchdog handler code.
For the half watchdog, we know wait for 5s to get the cpu data (similar to
the watchdog) which delays the next run. That's only 10% of the default
timeout though so that's not a big difference.
For the configurable watchdog timeout, we delay fetching the value to
be able to start the watchdog as early as possible when system server
starts to detect blocked threads that might happen early. As well, even
if fetching settings is broken, the watchdog will still be running with
the default timeout values.
Test: tested that the half watchdog is added to dropbox
~/master$ adb shell dumpsys dropbox | grep watchdog
2022-01-25 23:22:19 system_server_pre_watchdog (compressed text, 21612 bytes)
2022-01-25 23:22:56 system_server_watchdog (compressed text, 21386 bytes)
2022-01-25 23:29:09 system_server_pre_watchdog (compressed text, 21621 bytes)
The watchdogs and half wathdogs were generated by adding a message with
a long sleep on the ui thread
Runnable runnable = new Runnable() {
@Override
public void run() {
SystemClock.sleep(40_000); // 40s
}
};
Message msg = Message.obtain(UiThread.getHandler(), runnable);
msg.setAsynchronous(true);
UiThread.getHandler().sendMessage(msg);
Bug: 209932320
Change-Id: I1bca723d1d7bee98dc7e1aade73a2e4384d6f035
4 files changed