Loading src/com/android/server/connectivity/NetworkMonitor.java +4 −0 Original line number Diff line number Diff line Loading @@ -2253,6 +2253,10 @@ public class NetworkMonitor extends StateMachine { @VisibleForTesting protected boolean isDataStall() { if (!isValidationRequired()) { return false; } Boolean result = null; final StringJoiner msg = (DBG || VDBG_STALL) ? new StringJoiner(", ") : null; // Reevaluation will generate traffic. Thus, set a minimal reevaluation timer to limit the Loading tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -814,6 +814,19 @@ public class NetworkMonitorTest { assertTrue(wrappedMonitor.isDataStall()); } @Test public void testIsDataStall_SkipEvaluateOnValidationNotRequiredNetwork() { // Make DNS and TCP stall condition satisfied. setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_DNS | DATA_STALL_EVALUATION_TYPE_TCP); when(mTstDependencies.isTcpInfoParsingSupported()).thenReturn(true); when(mTst.getLatestReceivedCount()).thenReturn(0); when(mTst.isDataStallSuspected()).thenReturn(true); final WrappedNetworkMonitor nm = makeMonitor(NO_INTERNET_CAPABILITIES); nm.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(nm, DEFAULT_DNS_TIMEOUT_THRESHOLD); assertFalse(nm.isDataStall()); } @Test public void testIsDataStall_EvaluationDnsWithDnsTimeThreshold() { // Test dns events happened in valid dns time threshold. Loading Loading
src/com/android/server/connectivity/NetworkMonitor.java +4 −0 Original line number Diff line number Diff line Loading @@ -2253,6 +2253,10 @@ public class NetworkMonitor extends StateMachine { @VisibleForTesting protected boolean isDataStall() { if (!isValidationRequired()) { return false; } Boolean result = null; final StringJoiner msg = (DBG || VDBG_STALL) ? new StringJoiner(", ") : null; // Reevaluation will generate traffic. Thus, set a minimal reevaluation timer to limit the Loading
tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -814,6 +814,19 @@ public class NetworkMonitorTest { assertTrue(wrappedMonitor.isDataStall()); } @Test public void testIsDataStall_SkipEvaluateOnValidationNotRequiredNetwork() { // Make DNS and TCP stall condition satisfied. setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_DNS | DATA_STALL_EVALUATION_TYPE_TCP); when(mTstDependencies.isTcpInfoParsingSupported()).thenReturn(true); when(mTst.getLatestReceivedCount()).thenReturn(0); when(mTst.isDataStallSuspected()).thenReturn(true); final WrappedNetworkMonitor nm = makeMonitor(NO_INTERNET_CAPABILITIES); nm.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(nm, DEFAULT_DNS_TIMEOUT_THRESHOLD); assertFalse(nm.isDataStall()); } @Test public void testIsDataStall_EvaluationDnsWithDnsTimeThreshold() { // Test dns events happened in valid dns time threshold. Loading