Set legacy type for VPN

VPN legacy type was lost when NetworkInfo was replaced by
NetworkAgentConfig.
Set legacy type when creating NetworkAgentConfig to fix it.

Original NetworkInfo log:
NI = [type: [], state: CONNECTED/CONNECTED, reason: (unspecified), extra: , failover: false, available: true, roaming: false], Type = -1
Current NetworkInfo log:
NI = [type: VPN[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: , failover: false, available: true, roaming: false], Type = 17

Bug: 184261389
Test: atest CtsHostsideNetworkTests:HostsideVpnTests#testDefault
Change-Id: I237f7ff4d6899530c4ad057a84d3b8b34513be79
This commit is contained in:
lucaslin
2021-06-11 03:08:01 +08:00
committed by Lucas Lin
parent 1c0577193b
commit d1de5bd3d9

View File

@@ -1248,6 +1248,8 @@ public class Vpn {
updateState(DetailedState.CONNECTING, "agentConnect");
final NetworkAgentConfig networkAgentConfig = new NetworkAgentConfig.Builder()
.setLegacyType(ConnectivityManager.TYPE_VPN)
.setLegacyTypeName("VPN")
.setBypassableVpn(mConfig.allowBypass && !mLockdown)
.build();