Add metrics for requests satisfied by local networks
This change introduces `SatisfiedByLocalNetworkMetrics` to count the
number of `NetworkRequest`s per UID that can be satisfied by a
local-only network.
The purpose is to gather data on how many applications register callbacks
that would match non-thread local network connectivity.
This data helps in understanding app behavior and can inform
future development of local-only network features particularly
for the backward compatibility of existing NetworkRequests.
- A new class `SatisfiedByLocalNetworkMetrics` handles the counting and
logging logic.
- `ConnectivityService` calls into this class upon `NetworkRequest`
registration.
- Counts are logged to statsd.
Sample dumpsys output:
SatisfiedByLocalNetworkMetrics: {LISTEN={10217=2}}
Bug: 406172997
Flag: EXEMPT controlled by the `satisfied_by_local_network_metrics`
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSSatisfiedByLocalNetworkMetricsTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.metrics.SatisfiedByLocalNetworkMetricsTest \
--update-device
Test: m statsd_testdrive && statsd_testdrive -e 10247
Test: Manual: atest dumpsys connectivity
Change-Id: I62f6299a1c726537b373e3e80d41a494323f3cf2
7 files changed