diff options
author | Paul Jensen <pauljensen@google.com> | 2015-05-19 14:51:47 -0400 |
---|---|---|
committer | Paul Jensen <pauljensen@google.com> | 2015-05-19 14:53:01 -0400 |
commit | d9be23fa4cafc41dcb8b5e2f090e3f2d91197bfb (patch) | |
tree | c627ce2dd23ca2902caea8dfbed764aa3f8d6734 /services/core/java/com/android/server/connectivity/NetworkMonitor.java | |
parent | c1a9436d27e41347e6063b1cfb77eaef7e191ca4 (diff) | |
download | frameworks_base-d9be23fa4cafc41dcb8b5e2f090e3f2d91197bfb.zip frameworks_base-d9be23fa4cafc41dcb8b5e2f090e3f2d91197bfb.tar.gz frameworks_base-d9be23fa4cafc41dcb8b5e2f090e3f2d91197bfb.tar.bz2 |
Report invalid network after one failed attempt.
Also, blame UID requesting re-evaluation for first 5 attempts.
Bug:19648073
Change-Id: Ia04eeb1aeb59fcb21de098193dfad832d5fbe3a2
Diffstat (limited to 'services/core/java/com/android/server/connectivity/NetworkMonitor.java')
-rw-r--r-- | services/core/java/com/android/server/connectivity/NetworkMonitor.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java index fba9258..bf896a5 100644 --- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java +++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java @@ -190,10 +190,8 @@ public class NetworkMonitor extends StateMachine { private int mReevaluateToken = 0; private static final int INVALID_UID = -1; private int mUidResponsibleForReeval = INVALID_UID; - // When network has been evaluated this many times: - // 1. report NETWORK_TEST_RESULT_INVALID - // 2. stop blaming UID that requested re-evaluation for further attempts - private static final int INITIAL_EVALUATION_ATTEMPTS = 3; + // Stop blaming UID that requested re-evaluation after this many attempts. + private static final int BLAME_FOR_EVALUATION_ATTEMPTS = 5; private final Context mContext; private final Handler mConnectivityServiceHandler; @@ -438,12 +436,12 @@ public class NetworkMonitor extends StateMachine { } else if (httpResponseCode >= 200 && httpResponseCode <= 399) { transitionTo(mCaptivePortalState); } else { - Message msg = obtainMessage(CMD_REEVALUATE, ++mReevaluateToken, 0); + final Message msg = obtainMessage(CMD_REEVALUATE, ++mReevaluateToken, 0); sendMessageDelayed(msg, mReevaluateDelayMs); - if (mAttempts >= INITIAL_EVALUATION_ATTEMPTS) { - mConnectivityServiceHandler.sendMessage(obtainMessage( - EVENT_NETWORK_TESTED, NETWORK_TEST_RESULT_INVALID, 0, - mNetworkAgentInfo)); + mConnectivityServiceHandler.sendMessage(obtainMessage( + EVENT_NETWORK_TESTED, NETWORK_TEST_RESULT_INVALID, 0, + mNetworkAgentInfo)); + if (mAttempts >= BLAME_FOR_EVALUATION_ATTEMPTS) { // Don't continue to blame UID forever. TrafficStats.clearThreadStatsUid(); } |