Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01147501 authored by Chiachang Wang's avatar Chiachang Wang Committed by Automerger Merge Worker
Browse files

Merge "Validate underlying network when VPN switches to unvalidated" into main...

Merge "Validate underlying network when VPN switches to unvalidated" into main am: 4b1ce0f3 am: cb23eff1 am: a3148435 am: 45a1ae09 am: fc79f0d6

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2727374



Change-Id: Ic8fb97922a08f9dcbf08615cd36782cbb8bfa036
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f05569fc fc79f0d6
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -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");