Introduce client-side rate limiting for TrafficStats APIs
This change introduces client-side rate limiting for TrafficStats
APIs to address a performance issue caused by excessive calls,
resulting in high CPU usage and binder contention. By caching
traffic statistics on the client side, we reduce the frequency
of calls to NetworkStatsService, improving overall system
performance and mitigating potential privacy concerns related
to traffic analysis fingerprints.
This client-side caching mechanism will be disabled and gradually
enabled through a feature flag rollout.
Test: atest CtsNetTestCases:android.net.cts.TrafficStatsTest \
CtsNetTestCases:android.net.cts.NetworkStatsBinderTest \
FrameworksNetIntegrationTests:com.android.server.net.integrationtests.NetworkStatsIntegrationTest \
ConnectivityCoverageTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
ConnectivityCoverageTests:android.net.connectivity.android.net.TrafficStatsTest \
CtsNetTestCases:android.net.cts.IpSecManagerTest#testIkeOverUdpEncapSocket \
CtsNetTestCasesUpdateStatsPermission:android.net.cts.networkpermission.updatestatspermission.UpdateStatsPermissionTest#testUpdateDeviceStatsPermission
Test: adb shell device_config put tethering trafficstats_client_rate_limit_cache_enabled_flag [-1|1]
Bug: 343260158
Change-Id: If8a252d8d01c1545b23fdc7a00010f249ca09dc2
2 files changed