diff options
author | Nate(Qiang) Jiang <qiangjiang@google.com> | 2020-03-06 16:05:17 -0800 |
---|---|---|
committer | Nate Jiang <qiangjiang@google.com> | 2020-03-09 21:00:08 +0000 |
commit | 924050178386e73cc459ec19e47afd7c304c4068 (patch) | |
tree | f18bc46e01d317c619afeca9b33e0a9b7e0e47de /service | |
parent | e6813a5870911b10561db2c259c072123c1c513a (diff) |
Fix removing enterprise suggestion certificate
Make when remove a enterprise suggestion, use the internal config object
to remove ketStore. Which has certificate alias.
Bug: 150500247
Test: atest com.android.server.wifi
Merged-In: Id020e16fb6c26f38eb217248f7296b9ae4b0e781
Change-Id: I8015d87599d843e022805ce69fd5a4eae4d7b066
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java index 19603d8c6..426dddb8e 100644 --- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java +++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java @@ -639,11 +639,15 @@ public class WifiNetworkSuggestionsManager { @NonNull Collection<ExtendedWifiNetworkSuggestion> extNetworkSuggestions, @NonNull String packageName, @NonNull PerAppInfo perAppInfo) { + // Get internal suggestions + Set<ExtendedWifiNetworkSuggestion> removingSuggestions = + new HashSet<>(perAppInfo.extNetworkSuggestions); if (!extNetworkSuggestions.isEmpty()) { + // Keep the internal suggestions need to remove. + removingSuggestions.retainAll(extNetworkSuggestions); perAppInfo.extNetworkSuggestions.removeAll(extNetworkSuggestions); } else { // empty list is used to clear everything for the app. Store a copy for use below. - extNetworkSuggestions = new HashSet<>(perAppInfo.extNetworkSuggestions); perAppInfo.extNetworkSuggestions.clear(); } if (perAppInfo.extNetworkSuggestions.isEmpty()) { @@ -655,7 +659,7 @@ public class WifiNetworkSuggestionsManager { stopTrackingAppOpsChange(packageName); } // Clean the enterprise certifiacte. - for (ExtendedWifiNetworkSuggestion ewns : extNetworkSuggestions) { + for (ExtendedWifiNetworkSuggestion ewns : removingSuggestions) { WifiConfiguration config = ewns.wns.wifiConfiguration; if (!config.isEnterprise()) { continue; @@ -663,7 +667,7 @@ public class WifiNetworkSuggestionsManager { mWifiKeyStore.removeKeys(config.enterpriseConfig); } // Clear the scan cache. - removeFromScanResultMatchInfoMap(extNetworkSuggestions); + removeFromScanResultMatchInfoMap(removingSuggestions); } /** |