Bug 870169 - Extract reusable telemetry code from ANRReporter.java v2

Addressed comments from pull #320 (minus perf concerns about holding onto buffers/strings/etc).

Added a few basic tests, do suggest more if needed.