summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
diff options
context:
space:
mode:
authorKevin F. Haggerty <haggertk@lineageos.org>2020-06-01 21:10:38 -0600
committerKevin F. Haggerty <haggertk@lineageos.org>2020-06-01 21:10:38 -0600
commitef8b1a63ba4a1a1d72d8d6354d8cdbf3e0e9540d (patch)
tree7dcde6f33951f4e22d91297f1ba6699dc4b2a8aa /service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
parenta28db699f2898e1f2ed695f6adccd47e1f654bf4 (diff)
parent522cdf0da0b7d09b7254a7cda53ff8b5efc7da27 (diff)
downloadandroid_frameworks_opt_net_wifi-lineage-17.1.tar.gz
android_frameworks_opt_net_wifi-lineage-17.1.tar.bz2
android_frameworks_opt_net_wifi-lineage-17.1.zip
Merge tag 'android-10.0.0_r37' into staging/lineage-17.1_merge-android-10.0.0_r37lineage-17.1
Android 10.0.0 Release 37 (QQ3A.200605.001) * tag 'android-10.0.0_r37': Enterprise suggestion's catificate share same lifecycle as suggestion [Passpoint] Fix Passpoint matching algorithm for Home networks [WifiConfigManager] Log the disable reason when re-enabling. Fix removing enterprise suggestion certificate Enterprise suggestion's catificate share same lifecycle as suggestion Add EAP methods in WifiMetrics fix soft reboot caused by KeyStore exception fix soft reboot caused by KeyStore exception Change-Id: Icd34f29b28ee6c2d329259b14d1c4ecbd8ae5824
Diffstat (limited to 'service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java')
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java38
1 files changed, 35 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
index 644eb6523..426dddb8e 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
@@ -108,6 +108,7 @@ public class WifiNetworkSuggestionsManager {
private final WifiMetrics mWifiMetrics;
private final WifiInjector mWifiInjector;
private final FrameworkFacade mFrameworkFacade;
+ private final WifiKeyStore mWifiKeyStore;
/**
* Per app meta data to store network suggestions, status, etc for each app providing network
@@ -166,6 +167,10 @@ public class WifiNetworkSuggestionsManager {
@NonNull PerAppInfo perAppInfo) {
this.wns = wns;
this.perAppInfo = perAppInfo;
+ this.wns.wifiConfiguration.fromWifiNetworkSuggestion = true;
+ this.wns.wifiConfiguration.ephemeral = true;
+ this.wns.wifiConfiguration.creatorName = perAppInfo.packageName;
+ this.wns.wifiConfiguration.creatorUid = wns.suggestorUid;
}
@Override
@@ -384,7 +389,8 @@ public class WifiNetworkSuggestionsManager {
WifiPermissionsUtil wifiPermissionsUtil,
WifiConfigManager wifiConfigManager,
WifiConfigStore wifiConfigStore,
- WifiMetrics wifiMetrics) {
+ WifiMetrics wifiMetrics,
+ WifiKeyStore keyStore) {
mContext = context;
mResources = context.getResources();
mHandler = handler;
@@ -397,6 +403,7 @@ public class WifiNetworkSuggestionsManager {
mWifiPermissionsUtil = wifiPermissionsUtil;
mWifiConfigManager = wifiConfigManager;
mWifiMetrics = wifiMetrics;
+ mWifiKeyStore = keyStore;
// register the data store for serializing/deserializing data.
wifiConfigStore.registerStoreData(
@@ -595,6 +602,19 @@ public class WifiNetworkSuggestionsManager {
// Start tracking app-op changes from the app if they have active suggestions.
startTrackingAppOpsChange(packageName, uid);
}
+ Iterator<ExtendedWifiNetworkSuggestion> iterator = extNetworkSuggestions.iterator();
+ // Install enterprise network suggestion catificate.
+ while (iterator.hasNext()) {
+ WifiConfiguration config = iterator.next().wns.wifiConfiguration;
+ if (!config.isEnterprise()) {
+ continue;
+ }
+ if (!mWifiKeyStore.updateNetworkKeys(config, null)) {
+ Log.e(TAG, "Enterprise network install failure for SSID: "
+ + config.SSID);
+ iterator.remove();
+ }
+ }
perAppInfo.extNetworkSuggestions.addAll(extNetworkSuggestions);
// Update the max size for this app.
perAppInfo.maxSize = Math.max(perAppInfo.extNetworkSuggestions.size(), perAppInfo.maxSize);
@@ -619,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()) {
@@ -634,8 +658,16 @@ public class WifiNetworkSuggestionsManager {
// Stop tracking app-op changes from the app if they don't have active suggestions.
stopTrackingAppOpsChange(packageName);
}
+ // Clean the enterprise certifiacte.
+ for (ExtendedWifiNetworkSuggestion ewns : removingSuggestions) {
+ WifiConfiguration config = ewns.wns.wifiConfiguration;
+ if (!config.isEnterprise()) {
+ continue;
+ }
+ mWifiKeyStore.removeKeys(config.enterpriseConfig);
+ }
// Clear the scan cache.
- removeFromScanResultMatchInfoMap(extNetworkSuggestions);
+ removeFromScanResultMatchInfoMap(removingSuggestions);
}
/**