Add getters to UnderlyingNetworkInfo

Address API review feedback, add getters to UnderlyingNetworkInfo
instead of exposing fields.

Instead of wasting memory by converting this into an array, have
migrateTun take a List<String>. In turn, tunAdjustmentInit should
also take a List<String>.

(cherry picked from ag/14211075)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: Id59744097208d91298a25ef110ade91a9cf291a1
Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
This commit is contained in:
Aaron Huang
2021-04-16 23:20:23 +08:00
parent 212d6930cc
commit 433fb498b5
3 changed files with 58 additions and 37 deletions

View File

@@ -382,8 +382,8 @@ public class NetworkStatsFactory {
// Migrate data usage over a VPN to the TUN network.
for (UnderlyingNetworkInfo info : vpnArray) {
delta.migrateTun(info.ownerUid, info.iface,
info.underlyingIfaces.toArray(new String[0]));
delta.migrateTun(info.getOwnerUid(), info.getIface(),
info.getUnderlyingIfaces());
// Filter out debug entries as that may lead to over counting.
delta.filterDebugEntries();
}