Add the default network to NetworkStats and NetworkStatsCollection.
This allows us to maintain NetworkStats entries that track whether the traffic was on the default network. At the moment, the stats collection code always passes in DEFAULT_NETWORK_NO. However, this value is a no-op, since it is not persisted to disk. Only the ident, the uid/set/tag, and the packet/byte/operation counters are persisted. A future change will add defaultNetwork to the ident and start persisting it. Bug: 35142602 Test: runtest frameworks-net Change-Id: Ifa291c62c0fa389b88e5561086a29dcd7cee2253
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.internal.net;
|
||||
|
||||
import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
|
||||
import static android.net.NetworkStats.METERED_NO;
|
||||
import static android.net.NetworkStats.ROAMING_NO;
|
||||
import static android.net.NetworkStats.SET_ALL;
|
||||
@@ -240,7 +241,8 @@ public class NetworkStatsFactoryTest {
|
||||
|
||||
private static void assertStatsEntry(NetworkStats stats, String iface, int uid, int set,
|
||||
int tag, long rxBytes, long txBytes) {
|
||||
final int i = stats.findIndex(iface, uid, set, tag, METERED_NO, ROAMING_NO);
|
||||
final int i = stats.findIndex(iface, uid, set, tag, METERED_NO, ROAMING_NO,
|
||||
DEFAULT_NETWORK_NO);
|
||||
if (i < 0) {
|
||||
fail(String.format("no NetworkStats for (iface: %s, uid: %d, set: %d, tag: %d)",
|
||||
iface, uid, set, tag));
|
||||
@@ -252,7 +254,8 @@ public class NetworkStatsFactoryTest {
|
||||
|
||||
private static void assertStatsEntry(NetworkStats stats, String iface, int uid, int set,
|
||||
int tag, long rxBytes, long rxPackets, long txBytes, long txPackets) {
|
||||
final int i = stats.findIndex(iface, uid, set, tag, METERED_NO, ROAMING_NO);
|
||||
final int i = stats.findIndex(iface, uid, set, tag, METERED_NO, ROAMING_NO,
|
||||
DEFAULT_NETWORK_NO);
|
||||
if (i < 0) {
|
||||
fail(String.format("no NetworkStats for (iface: %s, uid: %d, set: %d, tag: %d)",
|
||||
iface, uid, set, tag));
|
||||
|
||||
Reference in New Issue
Block a user