summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/SystemServer.java
diff options
context:
space:
mode:
authorOlivier Gaillard <gaillard@google.com>2022-01-20 21:48:12 +0000
committerOlivier Gaillard <gaillard@google.com>2022-02-03 11:55:05 +0000
commit6fe47695294b203a9c52c3485e58d01acb11b254 (patch)
treede907ee5d938096c38e2bc71012f083eeca793ed /services/java/com/android/server/SystemServer.java
parent8ae64dc02321e0c8f909bbcfe49415c3f23891f0 (diff)
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
Diffstat (limited to 'services/java/com/android/server/SystemServer.java')
-rw-r--r--services/java/com/android/server/SystemServer.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index c9aeabd17191..a07501a707c4 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -1503,6 +1503,10 @@ public final class SystemServer implements Dumpable {
SQLiteCompatibilityWalFlags.reset();
t.traceEnd();
+ t.traceBegin("UpdateWatchdogTimeout");
+ Watchdog.getInstance().registerSettingsObserver(context);
+ t.traceEnd();
+
// Records errors and logs, for example wtf()
// Currently this service indirectly depends on SettingsProvider so do this after
// InstallSystemProviders.