Merge changes I3ba50cbd,I970ee365 am: 260b398281 am: c3fde912c6 am: ae76c2c199
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620859 Change-Id: I9ce9369b30bc568a63321de8764bd49c263b9ea6
This commit is contained in:
@@ -8576,11 +8576,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
final UnderlyingNetworkInfo[] underlyingNetworkInfos = getAllVpnInfo();
|
||||
try {
|
||||
final ArrayList<NetworkStateSnapshot> snapshots = new ArrayList<>();
|
||||
// TODO: Directly use NetworkStateSnapshot when feasible.
|
||||
for (final NetworkState state : getAllNetworkState()) {
|
||||
final NetworkStateSnapshot snapshot = new NetworkStateSnapshot(state.network,
|
||||
state.networkCapabilities, state.linkProperties, state.subscriberId,
|
||||
state.legacyNetworkType);
|
||||
for (final NetworkStateSnapshot snapshot : getAllNetworkStateSnapshots()) {
|
||||
snapshots.add(snapshot);
|
||||
}
|
||||
mStatsManager.notifyNetworkStatus(getDefaultNetworks(),
|
||||
|
||||
@@ -305,7 +305,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// verify service has empty history for wifi
|
||||
@@ -348,7 +348,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// verify service has empty history for wifi
|
||||
@@ -422,7 +422,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// modify some number on wifi, and trigger poll event
|
||||
@@ -463,7 +463,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// create some traffic on first network
|
||||
@@ -498,7 +498,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
.insertEntry(TEST_IFACE, UID_RED, SET_DEFAULT, 0xF00D, 512L, 4L, 512L, 4L, 0L)
|
||||
.insertEntry(TEST_IFACE, UID_BLUE, SET_DEFAULT, TAG_NONE, 512L, 4L, 0L, 0L, 0L));
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
forcePollAndWaitForIdle();
|
||||
|
||||
@@ -538,7 +538,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// create some traffic
|
||||
@@ -606,7 +606,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
setMobileRatTypeAndWaitForIdle(TelephonyManager.NETWORK_TYPE_UMTS);
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic.
|
||||
@@ -698,7 +698,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
new int[]{NetworkCapabilities.NET_CAPABILITY_OEM_PAID})};
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic.
|
||||
@@ -713,7 +713,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
new int[]{NetworkCapabilities.NET_CAPABILITY_OEM_PRIVATE})};
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic.
|
||||
@@ -729,7 +729,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
NetworkCapabilities.NET_CAPABILITY_OEM_PAID})};
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic.
|
||||
@@ -743,7 +743,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
states = new NetworkStateSnapshot[]{buildOemManagedMobileState(IMSI_1, false, new int[]{})};
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic.
|
||||
@@ -796,7 +796,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// create some traffic for two apps
|
||||
@@ -855,7 +855,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
NetworkStats.Entry entry1 = new NetworkStats.Entry(
|
||||
@@ -899,7 +899,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
NetworkStats.Entry uidStats = new NetworkStats.Entry(
|
||||
@@ -930,7 +930,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
|
||||
// mStatsFactory#readNetworkStatsDetail() has the following invocations:
|
||||
// 1) NetworkStatsService#systemReady from #setUp.
|
||||
// 2) mService#forceUpdateIfaces in the test above.
|
||||
// 2) mService#notifyNetworkStatus in the test above.
|
||||
//
|
||||
// Additionally, we should have one call from the above call to mService#getDetailedUidStats
|
||||
// with the augmented ifaceFilter.
|
||||
@@ -954,7 +954,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// create some initial traffic
|
||||
@@ -1012,7 +1012,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// create some initial traffic
|
||||
@@ -1052,7 +1052,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic
|
||||
@@ -1091,7 +1091,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// create some tethering traffic
|
||||
@@ -1148,7 +1148,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectNetworkStatsSummary(buildEmptyStats());
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// verify service has empty history for wifi
|
||||
@@ -1254,7 +1254,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
mService.registerNetworkStatsProvider("TEST", provider);
|
||||
assertNotNull(cb);
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Verifies that one requestStatsUpdate will be called during iface update.
|
||||
@@ -1319,7 +1319,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
mService.registerNetworkStatsProvider("TEST", provider);
|
||||
assertNotNull(cb);
|
||||
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Verifies that one requestStatsUpdate will be called during iface update.
|
||||
@@ -1377,7 +1377,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
expectDefaultSettings();
|
||||
NetworkStateSnapshot[] states =
|
||||
new NetworkStateSnapshot[]{buildWifiState(true /* isMetered */, TEST_IFACE)};
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Register custom provider and retrieve callback.
|
||||
@@ -1427,7 +1427,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
|
||||
// 3G network comes online.
|
||||
setMobileRatTypeAndWaitForIdle(TelephonyManager.NETWORK_TYPE_UMTS);
|
||||
mService.forceUpdateIfaces(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_MOBILE, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic.
|
||||
@@ -1449,7 +1449,8 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
setCombineSubtypeEnabled(true);
|
||||
|
||||
// Call handleOnCollapsedRatTypeChanged manually to simulate the callback fired
|
||||
// when stopping monitor, this is needed by NetworkStatsService to trigger updateIfaces.
|
||||
// when stopping monitor, this is needed by NetworkStatsService to trigger
|
||||
// handleNotifyNetworkStatus.
|
||||
mService.handleOnCollapsedRatTypeChanged();
|
||||
HandlerUtils.waitForIdle(mHandlerThread, WAIT_TIMEOUT);
|
||||
// Create some traffic.
|
||||
@@ -1498,7 +1499,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
|
||||
NetworkStateSnapshot[] states = new NetworkStateSnapshot[]{
|
||||
buildWifiState(true /*isMetered*/, TEST_IFACE2), buildMobile3gState(IMSI_1)};
|
||||
expectNetworkStatsUidDetail(buildEmptyStats());
|
||||
mService.forceUpdateIfaces(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
mService.notifyNetworkStatus(NETWORKS_WIFI, states, getActiveIface(states),
|
||||
new UnderlyingNetworkInfo[0]);
|
||||
|
||||
// Create some traffic on mobile network.
|
||||
|
||||
Reference in New Issue
Block a user