diff options
Diffstat (limited to 'service')
3 files changed, 16 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 812a3031d..0cad31f87 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -2066,10 +2066,12 @@ public class WifiConfigManager { * * @param networkId network ID corresponding to the network. * @param ageInMillis only consider scan details whose timestamps are earlier than this value. + * @param homeChannelFreq frequency of the currently connected network. * @return Set containing the frequencies on which this network was found, null if the network * was not found or there are no associated scan details in the cache. */ - public Set<Integer> fetchChannelSetForNetworkForPartialScan(int networkId, long ageInMillis) { + public Set<Integer> fetchChannelSetForNetworkForPartialScan(int networkId, long ageInMillis, + int homeChannelFreq) { WifiConfiguration config = getInternalConfiguredNetwork(networkId); if (config == null) { return null; @@ -2096,16 +2098,25 @@ public class WifiConfigManager { Log.v(TAG, dbg.toString()); } Set<Integer> channelSet = new HashSet<>(); + + // First add the currently connected network channel. + if (homeChannelFreq > 0) { + channelSet.add(homeChannelFreq); + if (channelSet.size() >= mMaxNumActiveChannelsForPartialScans) { + return channelSet; + } + } + long nowInMillis = mClock.getWallClockMillis(); - // First get channels for the network. + // Then get channels for the network. if (!addToChannelSetForNetworkFromScanDetailCache( channelSet, scanDetailCache, nowInMillis, ageInMillis, mMaxNumActiveChannelsForPartialScans)) { return channelSet; } - // Now get channels for linked networks. + // Lastly get channels for linked networks. if (config.linkedConfigurations != null) { for (String configKey : config.linkedConfigurations.keySet()) { WifiConfiguration linkedConfig = getInternalConfiguredNetwork(configKey); diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index 1fce14051..357fa32ed 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -650,7 +650,7 @@ public class WifiConnectivityManager { Set<Integer> freqs = mConfigManager.fetchChannelSetForNetworkForPartialScan( - config.networkId, CHANNEL_LIST_AGE_MS); + config.networkId, CHANNEL_LIST_AGE_MS, mWifiInfo.getFrequency()); if (freqs != null && freqs.size() != 0) { int index = 0; diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 1de443f9f..d39956d25 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -5492,7 +5492,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } Set<Integer> freqs = mWifiConfigManager.fetchChannelSetForNetworkForPartialScan( - config.networkId, ONE_HOUR_MILLI); + config.networkId, ONE_HOUR_MILLI, mWifiInfo.getFrequency()); if (freqs != null && freqs.size() != 0) { //if (mVerboseLoggingEnabled) { logd("starting scan for " + config.configKey() + " with " + freqs); |