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

Commit 3ee398ee authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Clean up for multiple validation result update"

parents b31723ad f1bf7e74
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -683,9 +683,9 @@ public class NetworkMonitor extends StateMachine {
        public void enter() {
        public void enter() {
            maybeLogEvaluationResult(
            maybeLogEvaluationResult(
                    networkEventType(validationStage(), EvaluationResult.VALIDATED));
                    networkEventType(validationStage(), EvaluationResult.VALIDATED));
            // If the user has accepted that and HTTPS probing is disabled, then mark the network
            // If the user has accepted partial connectivity and HTTPS probing is disabled, then
            // as validated and partial so that settings can keep informing the user that the
            // mark the network as validated and partial so that settings can keep informing the
            // connection is limited.
            // user that the connection is limited.
            int result = NETWORK_VALIDATION_RESULT_VALID;
            int result = NETWORK_VALIDATION_RESULT_VALID;
            if (!mUseHttps && mAcceptPartialConnectivity) {
            if (!mUseHttps && mAcceptPartialConnectivity) {
                result |= NETWORK_VALIDATION_RESULT_PARTIAL;
                result |= NETWORK_VALIDATION_RESULT_PARTIAL;
@@ -1054,6 +1054,11 @@ public class NetworkMonitor extends StateMachine {
            // TODO: Consider abandoning this state after a few attempts and
            // TODO: Consider abandoning this state after a few attempts and
            // transitioning back to EvaluatingState, to perhaps give ourselves
            // transitioning back to EvaluatingState, to perhaps give ourselves
            // the opportunity to (re)detect a captive portal or something.
            // the opportunity to (re)detect a captive portal or something.
            //
            // TODO: distinguish between CMD_EVALUATE_PRIVATE_DNS messages that are caused by server
            // lookup failures (which should continue to do exponential backoff) and
            // CMD_EVALUATE_PRIVATE_DNS messages that are caused by user reconfiguration (which
            // should be processed immediately.
            sendMessageDelayed(CMD_EVALUATE_PRIVATE_DNS, mPrivateDnsReevalDelayMs);
            sendMessageDelayed(CMD_EVALUATE_PRIVATE_DNS, mPrivateDnsReevalDelayMs);
            mPrivateDnsReevalDelayMs *= 2;
            mPrivateDnsReevalDelayMs *= 2;
            if (mPrivateDnsReevalDelayMs > MAX_REEVALUATE_DELAY_MS) {
            if (mPrivateDnsReevalDelayMs > MAX_REEVALUATE_DELAY_MS) {
+4 −0
Original line number Original line Diff line number Diff line
@@ -941,6 +941,10 @@ public class NetworkMonitorTest {
            .notifyNetworkTested(intCaptor.capture(), any());
            .notifyNetworkTested(intCaptor.capture(), any());
        List<Integer> intArgs = intCaptor.getAllValues();
        List<Integer> intArgs = intCaptor.getAllValues();


        // None of these exact values can be known in advance except for intArgs.get(0) because the
        // HTTP and HTTPS probes race and the order in which they complete is non-deterministic.
        // Thus, check only exact value for intArgs.get(0) and only check the validation result for
        // the rest ones.
        assertEquals(Integer.valueOf(NETWORK_VALIDATION_PROBE_DNS
        assertEquals(Integer.valueOf(NETWORK_VALIDATION_PROBE_DNS
                | NETWORK_VALIDATION_PROBE_FALLBACK | NETWORK_VALIDATION_RESULT_VALID),
                | NETWORK_VALIDATION_PROBE_FALLBACK | NETWORK_VALIDATION_RESULT_VALID),
                intArgs.get(0));
                intArgs.get(0));