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

Commit e0ef527d authored by Chiachang Wang's avatar Chiachang Wang Committed by Gerrit Code Review
Browse files

Merge "Update description based on API feedback"

parents bc987a3e 0e87479d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import static android.net.metrics.ValidationProbeEvent.DNS_SUCCESS;
import static android.net.metrics.ValidationProbeEvent.PROBE_FALLBACK;
import static android.net.metrics.ValidationProbeEvent.PROBE_PRIVDNS;
import static android.net.util.NetworkStackUtils.isEmpty;
import static android.provider.Settings.Global.DATA_STALL_EVALUATION_TYPE_DNS;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -128,9 +129,8 @@ public class NetworkMonitor extends StateMachine {
    private static final int DEFAULT_DATA_STALL_MIN_EVALUATE_TIME_MS = 60 * 1000;
    private static final int DEFAULT_DATA_STALL_VALID_DNS_TIME_THRESHOLD_MS = 30 * 60 * 1000;

    private static final int DATA_STALL_EVALUATION_TYPE_DNS = 1;
    private static final int DEFAULT_DATA_STALL_EVALUATION_TYPES =
            (1 << DATA_STALL_EVALUATION_TYPE_DNS);
            DATA_STALL_EVALUATION_TYPE_DNS;
    // Reevaluate it as intending to increase the number. Larger log size may cause statsd
    // log buffer bust and have stats log lost.
    private static final int DEFAULT_DNS_LOG_SIZE = 20;
@@ -1772,7 +1772,7 @@ public class NetworkMonitor extends StateMachine {
    }

    private boolean dataStallEvaluateTypeEnabled(int type) {
        return (mDataStallEvaluationType & (1 << type)) != 0;
        return (mDataStallEvaluationType & type) != 0;
    }

    @VisibleForTesting
@@ -1792,7 +1792,7 @@ public class NetworkMonitor extends StateMachine {
        }

        // Check dns signal. Suspect it may be a data stall if both :
        // 1. The number of consecutive DNS query timeouts > mConsecutiveDnsTimeoutThreshold.
        // 1. The number of consecutive DNS query timeouts >= mConsecutiveDnsTimeoutThreshold.
        // 2. Those consecutive DNS queries happened in the last mValidDataStallDnsTimeThreshold ms.
        if (dataStallEvaluateTypeEnabled(DATA_STALL_EVALUATION_TYPE_DNS)) {
            if (mDnsStallDetector.isDataStallSuspected(mConsecutiveDnsTimeoutThreshold,
+2 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.net.CaptivePortal.APP_RETURN_DISMISSED;
import static android.net.INetworkMonitor.NETWORK_TEST_RESULT_INVALID;
import static android.net.INetworkMonitor.NETWORK_TEST_RESULT_VALID;
import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
import static android.provider.Settings.Global.DATA_STALL_EVALUATION_TYPE_DNS;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -114,7 +115,6 @@ public class NetworkMonitorTest {
    private static final String TEST_OTHER_FALLBACK_URL = "http://otherfallback.google.com/gen_204";
    private static final String TEST_MCCMNC = "123456";

    private static final int DATA_STALL_EVALUATION_TYPE_DNS = 1;
    private static final int RETURN_CODE_DNS_SUCCESS = 0;
    private static final int RETURN_CODE_DNS_TIMEOUT = 255;
    private static final int DEFAULT_DNS_TIMEOUT_THRESHOLD = 5;
@@ -186,7 +186,7 @@ public class NetworkMonitorTest {
        when(mCm.getNetworkCapabilities(any())).thenReturn(METERED_CAPABILITIES);

        setMinDataStallEvaluateInterval(500);
        setDataStallEvaluationType(1 << DATA_STALL_EVALUATION_TYPE_DNS);
        setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_DNS);
        setValidDataStallDnsTimeThreshold(500);
        setConsecutiveDnsTimeoutThreshold(5);
    }