summaryrefslogtreecommitdiff
path: root/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java')
-rw-r--r--services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java b/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java
index a25d67ab66af..f3d7dd19ecc2 100644
--- a/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java
+++ b/services/core/java/com/android/server/vcn/routeselection/IpSecPacketLossDetector.java
@@ -24,8 +24,10 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.net.ConnectivityManager;
import android.net.IpSecTransformState;
import android.net.Network;
+import android.net.vcn.Flags;
import android.net.vcn.VcnManager;
import android.os.Handler;
import android.os.HandlerExecutor;
@@ -71,6 +73,7 @@ public class IpSecPacketLossDetector extends NetworkMetricMonitor {
@NonNull private final Handler mHandler;
@NonNull private final PowerManager mPowerManager;
+ @NonNull private final ConnectivityManager mConnectivityManager;
@NonNull private final Object mCancellationToken = new Object();
@NonNull private final PacketLossCalculator mPacketLossCalculator;
@@ -98,6 +101,8 @@ public class IpSecPacketLossDetector extends NetworkMetricMonitor {
mHandler = new Handler(getVcnContext().getLooper());
mPowerManager = getVcnContext().getContext().getSystemService(PowerManager.class);
+ mConnectivityManager =
+ getVcnContext().getContext().getSystemService(ConnectivityManager.class);
mPacketLossCalculator = deps.getPacketLossCalculator();
@@ -313,6 +318,13 @@ public class IpSecPacketLossDetector extends NetworkMetricMonitor {
} else {
logInfo(logMsg);
onValidationResultReceivedInternal(true /* isFailed */);
+
+ if (Flags.validateNetworkOnIpsecLoss()) {
+ // Trigger re-validation of the underlying network; if it fails, the VCN will
+ // attempt to migrate away.
+ mConnectivityManager.reportNetworkConnectivity(
+ getNetwork(), false /* hasConnectivity */);
+ }
}
}