Rename vars of Ikev2VpnRunner

There is already a var which is named mNetworkCapabilities in Vpn
class. In order to simply distinguish Vpn#mNetworkCapabilities and
Ikev2VpnRunner#mNetworkCapabilities, rename the one in
Ikev2VpnRunner to mUnderlyingNetworkCapabilities, also change
Ikev2VpnRunner#mLinkProperties to mUnderlyingLinkProperties.

Bug: 191413541
Test: atest FrameworksNetTest#VpnTest
Change-Id: I49a5aee159baa1d1583abb94d73da9fbc03ffe07
This commit is contained in:
lucaslin
2022-05-13 04:24:11 +08:00
committed by Lucas Lin
parent 2c7275d641
commit c9bd64daf3

View File

@@ -2629,8 +2629,8 @@ public class Vpn {
@Nullable private IpSecTunnelInterface mTunnelIface; @Nullable private IpSecTunnelInterface mTunnelIface;
@Nullable private IkeSession mSession; @Nullable private IkeSession mSession;
@Nullable private Network mActiveNetwork; @Nullable private Network mActiveNetwork;
@Nullable private NetworkCapabilities mNetworkCapabilities; @Nullable private NetworkCapabilities mUnderlyingNetworkCapabilities;
@Nullable private LinkProperties mLinkProperties; @Nullable private LinkProperties mUnderlyingLinkProperties;
private final String mSessionKey; private final String mSessionKey;
IkeV2VpnRunner(@NonNull Ikev2VpnProfile profile) { IkeV2VpnRunner(@NonNull Ikev2VpnProfile profile) {
@@ -2862,12 +2862,12 @@ public class Vpn {
/** Called when the NetworkCapabilities of underlying network is changed */ /** Called when the NetworkCapabilities of underlying network is changed */
public void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc) { public void onDefaultNetworkCapabilitiesChanged(@NonNull NetworkCapabilities nc) {
mNetworkCapabilities = nc; mUnderlyingNetworkCapabilities = nc;
} }
/** Called when the LinkProperties of underlying network is changed */ /** Called when the LinkProperties of underlying network is changed */
public void onDefaultNetworkLinkPropertiesChanged(@NonNull LinkProperties lp) { public void onDefaultNetworkLinkPropertiesChanged(@NonNull LinkProperties lp) {
mLinkProperties = lp; mUnderlyingLinkProperties = lp;
} }
/** Marks the state as FAILED, and disconnects. */ /** Marks the state as FAILED, and disconnects. */
@@ -2921,9 +2921,9 @@ public class Vpn {
getPackage(), mSessionKey, makeVpnProfileStateLocked(), getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork, mActiveNetwork,
getRedactedNetworkCapabilitiesOfUnderlyingNetwork( getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
this.mNetworkCapabilities), mUnderlyingNetworkCapabilities),
getRedactedLinkPropertiesOfUnderlyingNetwork( getRedactedLinkPropertiesOfUnderlyingNetwork(
this.mLinkProperties)); mUnderlyingLinkProperties));
} }
markFailedAndDisconnect(exception); markFailedAndDisconnect(exception);
return; return;
@@ -2939,9 +2939,9 @@ public class Vpn {
getPackage(), mSessionKey, makeVpnProfileStateLocked(), getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork, mActiveNetwork,
getRedactedNetworkCapabilitiesOfUnderlyingNetwork( getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
this.mNetworkCapabilities), mUnderlyingNetworkCapabilities),
getRedactedLinkPropertiesOfUnderlyingNetwork( getRedactedLinkPropertiesOfUnderlyingNetwork(
this.mLinkProperties)); mUnderlyingLinkProperties));
} }
} }
} else if (exception instanceof IllegalArgumentException) { } else if (exception instanceof IllegalArgumentException) {
@@ -2958,9 +2958,9 @@ public class Vpn {
getPackage(), mSessionKey, makeVpnProfileStateLocked(), getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork, mActiveNetwork,
getRedactedNetworkCapabilitiesOfUnderlyingNetwork( getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
this.mNetworkCapabilities), mUnderlyingNetworkCapabilities),
getRedactedLinkPropertiesOfUnderlyingNetwork( getRedactedLinkPropertiesOfUnderlyingNetwork(
this.mLinkProperties)); mUnderlyingLinkProperties));
} }
} else if (exception instanceof IkeNonProtocolException) { } else if (exception instanceof IkeNonProtocolException) {
if (exception.getCause() instanceof UnknownHostException) { if (exception.getCause() instanceof UnknownHostException) {
@@ -2973,9 +2973,9 @@ public class Vpn {
getPackage(), mSessionKey, makeVpnProfileStateLocked(), getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork, mActiveNetwork,
getRedactedNetworkCapabilitiesOfUnderlyingNetwork( getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
this.mNetworkCapabilities), mUnderlyingNetworkCapabilities),
getRedactedLinkPropertiesOfUnderlyingNetwork( getRedactedLinkPropertiesOfUnderlyingNetwork(
this.mLinkProperties)); mUnderlyingLinkProperties));
} }
} else if (exception.getCause() instanceof IkeTimeoutException) { } else if (exception.getCause() instanceof IkeTimeoutException) {
// TODO(b/230548427): Remove SDK check once VPN related stuff are // TODO(b/230548427): Remove SDK check once VPN related stuff are
@@ -2987,9 +2987,9 @@ public class Vpn {
getPackage(), mSessionKey, makeVpnProfileStateLocked(), getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork, mActiveNetwork,
getRedactedNetworkCapabilitiesOfUnderlyingNetwork( getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
this.mNetworkCapabilities), mUnderlyingNetworkCapabilities),
getRedactedLinkPropertiesOfUnderlyingNetwork( getRedactedLinkPropertiesOfUnderlyingNetwork(
this.mLinkProperties)); mUnderlyingLinkProperties));
} }
} else if (exception.getCause() instanceof IOException) { } else if (exception.getCause() instanceof IOException) {
// TODO(b/230548427): Remove SDK check once VPN related stuff are // TODO(b/230548427): Remove SDK check once VPN related stuff are
@@ -3001,9 +3001,9 @@ public class Vpn {
getPackage(), mSessionKey, makeVpnProfileStateLocked(), getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork, mActiveNetwork,
getRedactedNetworkCapabilitiesOfUnderlyingNetwork( getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
this.mNetworkCapabilities), mUnderlyingNetworkCapabilities),
getRedactedLinkPropertiesOfUnderlyingNetwork( getRedactedLinkPropertiesOfUnderlyingNetwork(
this.mLinkProperties)); mUnderlyingLinkProperties));
} }
} }
} else if (exception != null) { } else if (exception != null) {
@@ -3012,8 +3012,8 @@ public class Vpn {
} }
mActiveNetwork = null; mActiveNetwork = null;
mNetworkCapabilities = null; mUnderlyingNetworkCapabilities = null;
mLinkProperties = null; mUnderlyingLinkProperties = null;
// Close all obsolete state, but keep VPN alive incase a usable network comes up. // Close all obsolete state, but keep VPN alive incase a usable network comes up.
// (Mirrors VpnService behavior) // (Mirrors VpnService behavior)
@@ -3078,8 +3078,8 @@ public class Vpn {
*/ */
private void disconnectVpnRunner() { private void disconnectVpnRunner() {
mActiveNetwork = null; mActiveNetwork = null;
mNetworkCapabilities = null; mUnderlyingNetworkCapabilities = null;
mLinkProperties = null; mUnderlyingLinkProperties = null;
mIsRunning = false; mIsRunning = false;
resetIkeState(); resetIkeState();