Use addEntries when creating NetworkStats
In the current design, NetworkStats.addEntry is used within a
loop to create a NetworkStats instance from entries. This results
in a large memory footprint because the addEntry() method clones
the original NetworkStats instance each time it is called.
This change utilizes the newly created API to add a list of
entries at once. This approach only clones the instance once,
thereby reducing the required memory footprint.
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.NetworkStatsUtilsTest#testPublicStatsToAndroidNetStats
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.NetworkStatsUtilsTest
(on S device)
Test: atest ConnectivityCoverageTests:com.android.testutils.NetworkStatsUtilsTest
(on S device)
Bug: 335680025
Change-Id: I5c635613ed3ba34d840ee71b6bef21d10105df0d
4 files changed