Rearrange the way SignalCatcher writes logs.
This is an attempt to reduce the amount of time that threads are suspended
while dumping stack traces in response to a SIGQUIT. This is primarily
for ANRs and bugreport generation, where many different apps may be trying
to write their stacks out concurrently.
Instead of grabbing the file with flock() and then printing the traces
to the file, we render the traces to memory and write them with a single
write() call to an O_APPEND fd. Also, the file access now occurs after
the VM threads have been resumed to avoid stalling on I/O.
No change was made to the format of the output.
For bug 2504471.
Also: did some rearranging in the file.
Change-Id: If505ec014237289a6cc86aa09bc66b3a126b345c