Simplify & update ANR logging; report ANR data into the dropbox.
Eliminate the per-process 200ms timeout during ANR thread-dumping.
Dump all the threads at once, then wait for the file to stabilize.
Seems to work great and is much, much, much faster.
Don't dump stack traces to traces.txt on app crashes (it isn't very
useful and mostly just clutters up the file).
Tweak the formatting of the dropbox dumpsys a bit, for readability,
and avoid running out of memory when dumping large log files.
Report build & kernel version with kernel log dropbox entries.
diff --git a/services/java/com/android/server/DropBoxManagerService.java b/services/java/com/android/server/DropBoxManagerService.java
index 7a708f9..090e9d3 100644
--- a/services/java/com/android/server/DropBoxManagerService.java
+++ b/services/java/com/android/server/DropBoxManagerService.java
@@ -305,6 +305,7 @@
if (!match) continue;
numFound++;
+ if (doPrint) out.append("========================================\n");
out.append(date).append(" ").append(entry.tag == null ? "(no tag)" : entry.tag);
if (entry.file == null) {
out.append(" (no file)\n");
@@ -339,6 +340,12 @@
if (n <= 0) break;
out.append(buf, 0, n);
newline = (buf[n - 1] == '\n');
+
+ // Flush periodically when printing to avoid out-of-memory.
+ if (out.length() > 65536) {
+ pw.write(out.toString());
+ out.setLength(0);
+ }
}
if (!newline) out.append("\n");
} else {