diff options
author | Nate Jiang <qiangjiang@google.com> | 2020-04-03 05:12:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-03 05:12:32 +0000 |
commit | bb96a3d98cd5411a7d2d81acf409711e1984aa22 (patch) | |
tree | 411dee959535b0e5091108dfc9ac14f60448fbcd /service | |
parent | cd853d5b7780a7e93cdd5846bd80ea69f5a82328 (diff) | |
parent | 7347b91f448800656c79c0eb0cca39b83861e575 (diff) |
Merge "Duplicate ScanResult should return only one matched suggestion" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java index bf2a5aaa1..05e1e6391 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java +++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java @@ -1615,6 +1615,8 @@ public class WifiNetworkSuggestionsManager { */ public @NonNull List<WifiConfiguration> getWifiConfigForMatchedNetworkSuggestionsSharedWithUser( List<ScanResult> scanResults) { + // Create a HashSet to avoid return multiple result for duplicate ScanResult. + Set<String> networkKeys = new HashSet<>(); List<WifiConfiguration> sharedWifiConfigs = new ArrayList<>(); for (ScanResult scanResult : scanResults) { ScanResultMatchInfo scanResultMatchInfo = @@ -1648,7 +1650,9 @@ public class WifiNetworkSuggestionsManager { if (existingConfig == null || !existingConfig.fromWifiNetworkSuggestion) { continue; } - sharedWifiConfigs.add(existingConfig); + if (networkKeys.add(existingConfig.getKey())) { + sharedWifiConfigs.add(existingConfig); + } } return sharedWifiConfigs; } |