diff options
| author | 2023-08-31 10:44:03 +0000 | |
|---|---|---|
| committer | 2023-08-31 10:44:03 +0000 | |
| commit | a3148435ae4ab07686692d668440b0bc96071e4a (patch) | |
| tree | f11585b739ec4705c45a89a918c104108c53a356 | |
| parent | 99cae8ff04a57fee76e113c0ad5ffacb4c394958 (diff) | |
| parent | cb23eff1be803412d9298cf5bdfa78afbd57fc62 (diff) | |
Merge "Validate underlying network when VPN switches to unvalidated" into main am: 4b1ce0f37b am: cb23eff1be
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2727374
Change-Id: I7a7c3ed88d0cf33ecfd13eb7dfc7f10ba9b04cfa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/connectivity/Vpn.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java index ff35b192cccd..bfccd58b3f5d 100644 --- a/services/core/java/com/android/server/connectivity/Vpn.java +++ b/services/core/java/com/android/server/connectivity/Vpn.java @@ -3066,7 +3066,8 @@ public class Vpn { * <p>This variable controls the retry delay, and is reset when the VPN pass network * validation. */ - private int mValidationFailRetryCount = 0; + @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) + int mValidationFailRetryCount = 0; /** * The number of attempts since the last successful connection. @@ -3897,6 +3898,18 @@ public class Vpn { // Skip other invalid status if the scheduled recovery exists. if (mScheduledHandleDataStallFuture != null) return; + // Trigger network validation on the underlying network to possibly cause system + // switch default network or try recover if the current default network is broken. + // + // For the same underlying network, the first validation result should clarify if + // it's caused by broken underlying network. So only perform underlying network + // re-evaluation after first validation failure to prevent extra network resource + // costs on sending probes. + if (mValidationFailRetryCount == 0) { + mConnectivityManager.reportNetworkConnectivity( + mActiveNetwork, false /* hasConnectivity */); + } + if (mValidationFailRetryCount < MAX_MOBIKE_RECOVERY_ATTEMPT) { Log.d(TAG, "Validation failed"); |