dumpstate: save background traces when a BR is captured.

Adds a call to perfetto --save-for-bugreport to bugreport.
If a background trace labeled with bugreport_score > 0 is
being recorded when dumpstate is invoked, the tracing daemon
will stop the trace and serialize it into a fixed location
(/data/misc/perfetto-traces/bugreport/systrace.pftrace).
If no background tracing is happening, the command is a no-op.
The trace saving happens in two stages:
1. In the very early stage of dumpstate, the trace is
   snapshoted (if in progress). This prevents that further
   dumpstate activity pushes out interesting contents from
   the trace buffer.
2. In the later stages of dumpstate, the trace is attached
   to the bugreport.zip file and cleaned up.

Bug: 170334305
Change-Id: I4278459697a5ed20b20ee99032884874a82a66be
4 files changed