Add period reporting to the metrics infra

The metric reporting can now be condifured to report at
different periods, according to a predefined spec.

The period spec is given as a string (e.g. "S,1,2,4,8,*")
and can specify:
  - startup reporting
  - fixed period reporting
  - continuous reporting

For example "S,1,2,4,*" means that we will report at
startup, then after 1 seconds, then after 2 and 4,
and finally, that we will continue to report every other 4s.

The specs for system server and the apps are given by different
flags, so that we can have different reporting configurations
for each.

Also, this CL adds much more robust testing to the metrics
reporter, something that was missing before.

Test: gtest
Bug: 170149255

Change-Id: Ifbe32b3877d2e1cdf43d30b67672f6ebfb42dadf
6 files changed