diff options
| author | 2019-05-15 17:32:27 -0700 | |
|---|---|---|
| committer | 2019-05-15 17:32:27 -0700 | |
| commit | fa7c3689e36d73dd885c976b0ae3f0dc976f4e23 (patch) | |
| tree | d640df4ec74fec3a9221e72e918702c8fef7ae06 | |
| parent | d166d21f07ee74fae6f04664b422a7719badc35b (diff) | |
Null check for early watchdog-caught thread hangs
In case a watched thread hangs before we even get to
initialize the Watchdog, skip logging the dropbox
entry.
Bug: 132005148
Test: Boots
Change-Id: I272adb34ea44f61e266b8fb6d8d5b8f3e86477ae
| -rw-r--r-- | services/core/java/com/android/server/Watchdog.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java index f9aaf11c75f0..aa77f6f485d9 100644 --- a/services/core/java/com/android/server/Watchdog.java +++ b/services/core/java/com/android/server/Watchdog.java @@ -548,9 +548,13 @@ public class Watchdog extends Thread { // deadlock and the watchdog as a whole to be ineffective) Thread dropboxThread = new Thread("watchdogWriteToDropbox") { public void run() { - mActivity.addErrorToDropBox( - "watchdog", null, "system_server", null, null, null, - subject, null, stack, null); + // If a watched thread hangs before init() is called, we don't have a + // valid mActivity. So we can't log the error to dropbox. + if (mActivity != null) { + mActivity.addErrorToDropBox( + "watchdog", null, "system_server", null, null, null, + subject, null, stack, null); + } StatsLog.write(StatsLog.SYSTEM_SERVER_WATCHDOG_OCCURRED, subject); } }; |