Add more data (fg services, associations) to procstats.

- Keep track of foreground services.
- Keep track of associations between processes.

The big part of this is the second, tracking associations.
We have have procstats keeping continual track of associations
between processes, much like the "am track-associations"
command.  Currently the data kept on them is very minimal
(just the count and total duration, not separated by other
states) due to the potential number of them that there can be,
but we can look in to trying to maintain more data going
forward if it is feasible.

The way this is incorporated into the activity manager makes
it a little different than "am track-associations," with
potentially some new interesting data available.  These
associations are tied with the connection objects in the
activity manager, so they only count while the target
process is actually running (so their duration should match
with the lifecycle of the target).  They are tied to the
target package, since that is what we know all of the
information we need for rooting data in procstats (package
name, uid, and version code of that package); only the process
name and uid are available for the source of the association

Since these are tied to the connection components, it is
possible that we could even maintain data on the duration per
proc state that is flowing from that association in to the
target process.  That would be very useful, but would add
a fair amount more overhead in data being tracked.

English output of the new association data looks like:

  * com.android.providers.downloads / u0a17 / v28:
      * Prc android.process.media / u0a17 / v28:
               TOTAL: 0.45%
              Imp Bg: 0.26%
             Service: 0.18%
            Receiver: 0.01%
          (Last Act): 0.78%
            (Cached): 37% (5.2MB-5.8MB-8.2MB/3.9MB-4.4MB-6.0MB/3.9MB-7.0MB-50MB over 18)
      * Svc com.android.providers.downloads.DownloadIdleService:
        Process: android.process.media
            Running count 3 / time 0.01%
            Bound count 3 / time 0.01%
            Executing count 6 / time 0.00%
      * Svc com.android.providers.downloads.DownloadJobService:
        Process: android.process.media
            Running count 6 / time 0.21%
            Bound count 6 / time 0.21%
            Executing count 12 / time 0.00%
      * Asc com.android.providers.downloads.DownloadIdleService:
        Process: android.process.media
          <- system / 1000:
             Count 3 / time 0.01%
      * Asc com.android.providers.downloads.DownloadStorageProvider:
        Process: android.process.media
          <- com.android.documentsui / u0a10:
             Count 1 / time 0.00%
      * Asc com.android.providers.downloads.DownloadProvider:
        Process: android.process.media
          <- com.android.vending / u0a11:
             Count 39 / time 2.6%
          <- system / 1000:
             Count 3 / time 0.00%
          <- com.google.android.gms / u0a36:
             Count 8 / time 0.01%
      * Asc com.android.providers.downloads.DownloadJobService:
        Process: android.process.media
          <- system / 1000:
             Count 6 / time 0.21%

And the corresponding checkin:

pkgproc,com.android.providers.downloads,10017,28,android.process.media,0nf:717,0nb:71332,0ns:48335,0nr:3652,0nl:218034,0ne:10103500,0mf:21,0ms:614,0me:185,1ne:100236
pkgpss,com.android.providers.downloads,10017,28,android.process.media,0ne:18:5310:5950:8434:4036:4522:6140:4036:7127:51056
pkgsvc-run,com.android.providers.downloads,10017,28,.DownloadIdleService,3,0n:1849
pkgsvc-bound,com.android.providers.downloads,10017,28,.DownloadIdleService,3,0n:1794
pkgsvc-exec,com.android.providers.downloads,10017,28,.DownloadIdleService,6,0n:89
pkgsvc-run,com.android.providers.downloads,10017,28,.DownloadJobService,6,0n:58224
pkgsvc-bound,com.android.providers.downloads,10017,28,.DownloadJobService,6,0n:58154
pkgsvc-exec,com.android.providers.downloads,10017,28,.DownloadJobService,12,0n:187
pkgasc,com.android.providers.downloads,10017,28,.DownloadIdleService,system,1000,3,1790
pkgasc,com.android.providers.downloads,10017,28,.DownloadStorageProvider,com.android.documentsui,10010,1,80
pkgasc,com.android.providers.downloads,10017,28,.DownloadProvider,com.android.vending,10011,39,1067022
pkgasc,com.android.providers.downloads,10017,28,.DownloadProvider,system,1000,3,96
pkgasc,com.android.providers.downloads,10017,28,.DownloadProvider,com.google.android.gms,10036,8,1951
pkgasc,com.android.providers.downloads,10017,28,.DownloadJobService,system,1000,6,58149

Bug: 110957691
Test: manual
Change-Id: Id466b085303527e7bf7354f7f33a0fbaa768fb7b
14 files changed