Merge "Trigger revalidation of VCN, underlying networks" am: bd14581e6b am: 4755021eb1 am: 3e2628d028
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2007972 Change-Id: Ic7d85b02a4df497e74f7a4d5273d7d9e2d820afa Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
986b9fcaf5
@ -544,6 +544,7 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
private final boolean mIsMobileDataEnabled;
|
||||
|
||||
@NonNull private final IpSecManager mIpSecManager;
|
||||
@NonNull private final ConnectivityManager mConnectivityManager;
|
||||
|
||||
@Nullable private IpSecTunnelInterface mTunnelIface = null;
|
||||
|
||||
@ -701,6 +702,7 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
mLastSnapshot,
|
||||
mUnderlyingNetworkControllerCallback);
|
||||
mIpSecManager = mVcnContext.getContext().getSystemService(IpSecManager.class);
|
||||
mConnectivityManager = mVcnContext.getContext().getSystemService(ConnectivityManager.class);
|
||||
|
||||
addState(mDisconnectedState);
|
||||
addState(mDisconnectingState);
|
||||
@ -1683,6 +1685,14 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
clearFailedAttemptCounterAndSafeModeAlarm();
|
||||
break;
|
||||
case NetworkAgent.VALIDATION_STATUS_NOT_VALID:
|
||||
// Trigger re-validation of underlying networks; if it
|
||||
// fails, the VCN will attempt to migrate away.
|
||||
if (mUnderlying != null) {
|
||||
mConnectivityManager.reportNetworkConnectivity(
|
||||
mUnderlying.network,
|
||||
false /* hasConnectivity */);
|
||||
}
|
||||
|
||||
// Will only set a new alarm if no safe mode alarm is
|
||||
// currently scheduled.
|
||||
setSafeModeAlarm();
|
||||
@ -1869,6 +1879,10 @@ public class VcnGatewayConnection extends StateMachine {
|
||||
IpSecManager.DIRECTION_OUT);
|
||||
|
||||
updateNetworkAgent(mTunnelIface, mNetworkAgent, mChildConfig);
|
||||
|
||||
// Trigger re-validation after migration events.
|
||||
mConnectivityManager.reportNetworkConnectivity(
|
||||
mNetworkAgent.getNetwork(), false /* hasConnectivity */);
|
||||
}
|
||||
|
||||
private void handleUnderlyingNetworkChanged(@NonNull Message msg) {
|
||||
|
@ -252,6 +252,9 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
|
||||
&& TEST_TCP_BUFFER_SIZES_2.equals(lp.getTcpBufferSizes())));
|
||||
verify(mNetworkAgent)
|
||||
.setUnderlyingNetworks(eq(singletonList(TEST_UNDERLYING_NETWORK_RECORD_2.network)));
|
||||
|
||||
// Verify revalidation is triggered on VCN network
|
||||
verify(mConnMgr).reportNetworkConnectivity(eq(mNetworkAgent.getNetwork()), eq(false));
|
||||
}
|
||||
|
||||
private void triggerChildOpened() {
|
||||
@ -425,6 +428,9 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
|
||||
triggerValidation(NetworkAgent.VALIDATION_STATUS_NOT_VALID);
|
||||
mTestLooper.dispatchAll();
|
||||
|
||||
verify(mConnMgr)
|
||||
.reportNetworkConnectivity(eq(TEST_UNDERLYING_NETWORK_RECORD_1.network), eq(false));
|
||||
|
||||
final ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(mDeps, times(2))
|
||||
.newWakeupMessage(
|
||||
|
Loading…
x
Reference in New Issue
Block a user