Set underlying networks into NetworkCapabilities directly
The constructor of NetworkAgentInfo will refer to the underlying networks of NetworkCapabilities and set declaredUnderlyingNetworks directly, so there is no need to call setUnderlyingNetworks() to update declaredUnderlyingNetworks. Bug: 191918368 Test: atest FrameworksNetTests:ConnectivityServiceTest Change-Id: Idb5f0232455603567d02591b0cdbab4764155ee9
This commit is contained in:
@@ -1268,6 +1268,9 @@ public class Vpn {
|
||||
capsBuilder.addCapability(NET_CAPABILITY_NOT_METERED);
|
||||
}
|
||||
|
||||
capsBuilder.setUnderlyingNetworks((mConfig.underlyingNetworks != null)
|
||||
? Arrays.asList(mConfig.underlyingNetworks) : null);
|
||||
|
||||
mNetworkCapabilities = capsBuilder.build();
|
||||
mNetworkAgent = new NetworkAgent(mContext, mLooper, NETWORKTYPE /* logtag */,
|
||||
mNetworkCapabilities, lp,
|
||||
@@ -1288,8 +1291,6 @@ public class Vpn {
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
mNetworkAgent.setUnderlyingNetworks((mConfig.underlyingNetworks != null)
|
||||
? Arrays.asList(mConfig.underlyingNetworks) : null);
|
||||
updateState(DetailedState.CONNECTED, "agentConnect");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user