Add event bundling in NetworkTraceHandler

Bundling groups PacketTraces by their various attributes (e.g. uid, tag,
ports) and outputs a single Perfetto TracePacket per group. Rather than
repeat this information many times, it's only written once. In most
cases, this should reduce the trace size by 5x.

Bug: 246985031
Test: atest libnetworkstats_test
Change-Id: Ia9cb163fb4c673abdab8d442576cf4b12a98dbc6
3 files changed