Merge "Add getters to NetworkStateSnapshot" am: 1c9a1c1353 am: 18e5c6bd73

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1684649

Change-Id: Ia6047f77624d6be82dc2528f52f7c77bf5b29c17
This commit is contained in:
Treehugger Robot
2021-04-29 10:02:43 +00:00
committed by Automerger Merge Worker
2 changed files with 6 additions and 6 deletions

View File

@@ -2179,11 +2179,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
for (NetworkStateSnapshot snapshot : getAllNetworkStateSnapshots()) {
// NetworkStateSnapshot doesn't contain NetworkInfo, so need to fetch it from the
// NetworkAgentInfo.
final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(snapshot.network);
final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(snapshot.getNetwork());
if (nai != null && nai.networkInfo.isConnected()) {
result.add(new NetworkState(new NetworkInfo(nai.networkInfo),
snapshot.linkProperties, snapshot.networkCapabilities, snapshot.network,
snapshot.subscriberId));
snapshot.getLinkProperties(), snapshot.getNetworkCapabilities(),
snapshot.getNetwork(), snapshot.getSubscriberId()));
}
}
return result.toArray(new NetworkState[result.size()]);

View File

@@ -894,7 +894,7 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
final LinkProperties stackedProp = new LinkProperties();
stackedProp.setInterfaceName(stackedIface);
final NetworkStateSnapshot wifiState = buildWifiState();
wifiState.linkProperties.addStackedLink(stackedProp);
wifiState.getLinkProperties().addStackedLink(stackedProp);
NetworkStateSnapshot[] states = new NetworkStateSnapshot[] {wifiState};
expectNetworkStatsSummary(buildEmptyStats());
@@ -1585,10 +1585,10 @@ public class NetworkStatsServiceTest extends NetworkStatsBaseTest {
}
private String getActiveIface(NetworkStateSnapshot... states) throws Exception {
if (states == null || states.length == 0 || states[0].linkProperties == null) {
if (states == null || states.length == 0 || states[0].getLinkProperties() == null) {
return null;
}
return states[0].linkProperties.getInterfaceName();
return states[0].getLinkProperties().getInterfaceName();
}
private void expectNetworkStatsSummary(NetworkStats summary) throws Exception {