[FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots

Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: I3ba50cbd8a7f60779c69ba85e10dc3cc8a52f8b1
This commit is contained in:
junyulai
2021-03-05 14:46:25 +08:00
parent 1df306006e
commit 69114dacb2

View File

@@ -8588,11 +8588,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(),