OSDN Git Service

Merge "Do not evict scan results in cold start." into oc-dr1-dev
authorTreeHugger Robot <treehugger-gerrit@google.com>
Tue, 25 Jul 2017 22:41:39 +0000 (22:41 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 25 Jul 2017 22:41:39 +0000 (22:41 +0000)
1  2 
packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

@@@ -371,18 -372,15 +372,18 @@@ public class WifiTracker 
  
              mWorkHandler.removePendingMessages();
              mMainHandler.removePendingMessages();
+             sStaleScanResults = true;
          }
-         mStaleScanResults = true;
      }
  
 -    private void unregisterAndClearScoreCache() {
 +    private void unregisterScoreCache() {
          mNetworkScoreManager.unregisterNetworkScoreCache(NetworkKey.TYPE_WIFI, mScoreCache);
 -        mScoreCache.clearScores();
  
 -        // Synchronize on mLock to avoid concurrent modification during updateAccessPoints
 +        // We do not want to clear the existing scores in the cache, as this method is called during
 +        // stop tracking on activity pause. Hence, on resumption we want the ability to show the
 +        // last known, potentially stale, scores. However, by clearing requested scores, the scores
 +        // will be requested again upon resumption of tracking, and if any changes have occurred
 +        // the listeners (UI) will be updated accordingly.
          synchronized (mLock) {
              mRequestedScores.clear();
          }