Remove redundant network verification for as-is network
If the network is unvalidated and the user selects "use as is",
the device will go to EvaluatingPrivateDnsState and then go to
ValidatedState eventually if everything is OK.
Then when the CMD_FORCE_REEVALUATION comes, the device will go
to EvaluatingState and handles CMD_REEVALUATE. Before, the
device will go to ProbingState to probe, the probe is redundant
because the user has selected "use as is" and the result is
always valid. Instead, the device should go to
EvaluatingPrivateDnsState straightly and then go to ValidatedState
eventually, like what the device do when the user selects
"use as is".
Also update the test accordingly. The NetworkMonitor state
should transit to ValidatedState eventually without a
redirected URL.
Bug: 216428888
Signed-off-by: zhujiatai <zhujiatai@xiaomi.com>
Change-Id: I14a403ae670392d1b8763756d69594353821d3d0
diff --git a/src/com/android/server/connectivity/NetworkMonitor.java b/src/com/android/server/connectivity/NetworkMonitor.java
index 301462f..64fc67d 100755
--- a/src/com/android/server/connectivity/NetworkMonitor.java
+++ b/src/com/android/server/connectivity/NetworkMonitor.java
@@ -1384,6 +1384,7 @@
// validation and private DNS validation.
validationLog("Captive portal is used as is, resolving private DNS");
transitionTo(mEvaluatingPrivateDnsState);
+ return HANDLED;
} else if (!isValidationRequired()) {
if (isPrivateDnsValidationRequired()) {
validationLog("Network would not satisfy default request, "
diff --git a/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java b/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java
index 01daf67..c481315 100644
--- a/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java
+++ b/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java
@@ -2024,8 +2024,7 @@
// The network should still be valid.
verify(mCallbacks, timeout(HANDLER_TIMEOUT_MS).atLeastOnce())
.notifyNetworkTestedWithExtras(matchNetworkTestResultParcelable(
- NETWORK_VALIDATION_RESULT_VALID, 0 /* probesSucceeded */,
- TEST_LOGIN_URL));
+ NETWORK_VALIDATION_RESULT_VALID, 0 /* probesSucceeded */));
}
@Test