diff options
author | Paul Jensen <pauljensen@google.com> | 2014-12-03 09:44:31 -0500 |
---|---|---|
committer | Paul Jensen <pauljensen@google.com> | 2014-12-03 11:06:14 -0500 |
commit | 7bd8eaf5687e7edbc8c0fb05f371ffb2121d70f9 (patch) | |
tree | 7b4186313611148b9d768a6ec94ff08c8b512e71 /services/core/java/com/android/server/connectivity/NetworkMonitor.java | |
parent | c3056190ae1a6d29ce5943d45ab4711e1e49620c (diff) | |
download | frameworks_base-7bd8eaf5687e7edbc8c0fb05f371ffb2121d70f9.zip frameworks_base-7bd8eaf5687e7edbc8c0fb05f371ffb2121d70f9.tar.gz frameworks_base-7bd8eaf5687e7edbc8c0fb05f371ffb2121d70f9.tar.bz2 |
Retry failed network validation every 10 minutes.
This allows for better recovery from ISP outages.
bug:18489123
Change-Id: Iefffe870bd6b7c19827fdbc323024a600a6025f9
Diffstat (limited to 'services/core/java/com/android/server/connectivity/NetworkMonitor.java')
-rw-r--r-- | services/core/java/com/android/server/connectivity/NetworkMonitor.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java index 225097f..39718ea 100644 --- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java +++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java @@ -215,6 +215,8 @@ public class NetworkMonitor extends StateMachine { // Default to 5s reevaluation delay. private static final int DEFAULT_REEVALUATE_DELAY_MS = 5000; private static final int MAX_RETRIES = 10; + // Between groups of MAX_RETRIES evaluation attempts, pause 10 mins in hopes ISP outage passes. + private static final int REEVALUATE_PAUSE_MS = 10*60*1000; private final int mReevaluateDelayMs; private int mReevaluateToken = 0; private static final int INVALID_UID = -1; @@ -345,6 +347,7 @@ public class NetworkMonitor extends StateMachine { public void enter() { mConnectivityServiceHandler.sendMessage(obtainMessage(EVENT_NETWORK_TESTED, NETWORK_TEST_RESULT_INVALID, 0, mNetworkAgentInfo)); + if (!mUserDoesNotWant) sendMessageDelayed(CMD_FORCE_REEVALUATION, REEVALUATE_PAUSE_MS); } @Override @@ -360,6 +363,15 @@ public class NetworkMonitor extends StateMachine { return NOT_HANDLED; } } + + @Override + public void exit() { + // NOTE: This removes the delayed message posted by enter() but will inadvertently + // remove any other CMD_FORCE_REEVALUATION in the message queue. At the moment this + // is harmless. If in the future this becomes problematic a different message could + // be used. + removeMessages(CMD_FORCE_REEVALUATION); + } } // Being in the ValidatedState State indicates a Network is: |