summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2019-11-21 19:23:30 +0000
committerHai Shalom <haishalom@google.com>2019-11-21 23:09:01 +0000
commitff23d602c7a925a7aef87f1f7c3d08e67ad31a5e (patch)
tree8bb3ec31fbb2e671d51aef48afdc9a1ed6b3fe8a /service
parent9328b5ed7bcda1cf5d73cdaa9c70284b58462547 (diff)
Revert submission
Reason for revert: Incomplete fix that causes additional issues which were not anticipated earlier. Change-Id: Ie75fe87dd671ebe00add8c858da47dff793077a4 Merged-In: I526410612fe2f733ae41efe7ed1a20ab6d620458
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ConfigurationMap.java24
-rw-r--r--service/java/com/android/server/wifi/ScanResultMatchInfo.java22
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java75
3 files changed, 20 insertions, 101 deletions
diff --git a/service/java/com/android/server/wifi/ConfigurationMap.java b/service/java/com/android/server/wifi/ConfigurationMap.java
index 443eef879..a5cd18f2a 100644
--- a/service/java/com/android/server/wifi/ConfigurationMap.java
+++ b/service/java/com/android/server/wifi/ConfigurationMap.java
@@ -126,30 +126,6 @@ public class ConfigurationMap {
ScanResultMatchInfo.fromScanResult(scanResult));
}
- /**
- * Retrieves a |WifiConfiguration| object with PSK key management, that is matching the provided
- * |scanResult| SSID from the internal map.
- * Used for upgrading WPA2-Personal networks to WPA3-Personal, when AP is in transition mode.
- */
- public WifiConfiguration getPskNetworkByScanResultForCurrentUser(ScanResult scanResult) {
- // Check if WPA2-Personal saved network is available
- ScanResultMatchInfo matchInfo = ScanResultMatchInfo.fromScanResult(scanResult);
- matchInfo.networkType = WifiConfiguration.SECURITY_TYPE_PSK;
- return mScanResultMatchInfoMapForCurrentUser.get(matchInfo);
- }
-
- /**
- * Retrieves a |WifiConfiguration| object with no security, that is matching the provided
- * |scanResult| SSID from the internal map.
- * Used for upgrading Open networks to OWE, when AP is in transition mode.
- */
- public WifiConfiguration getOpenNetworkByScanResultForCurrentUser(ScanResult scanResult) {
- // Check if Open saved network is available
- ScanResultMatchInfo matchInfo = ScanResultMatchInfo.fromScanResult(scanResult);
- matchInfo.networkType = WifiConfiguration.SECURITY_TYPE_OPEN;
- return mScanResultMatchInfoMapForCurrentUser.get(matchInfo);
- }
-
public Collection<WifiConfiguration> valuesForAllUsers() {
return mPerID.values();
}
diff --git a/service/java/com/android/server/wifi/ScanResultMatchInfo.java b/service/java/com/android/server/wifi/ScanResultMatchInfo.java
index 1e15a3ecc..b3d10cc38 100644
--- a/service/java/com/android/server/wifi/ScanResultMatchInfo.java
+++ b/service/java/com/android/server/wifi/ScanResultMatchInfo.java
@@ -131,8 +131,26 @@ public class ScanResultMatchInfo {
return false;
}
ScanResultMatchInfo other = (ScanResultMatchInfo) otherObj;
- return Objects.equals(networkSsid, other.networkSsid)
- && networkType == other.networkType;
+ if (!Objects.equals(networkSsid, other.networkSsid)) {
+ return false;
+ }
+ boolean networkTypeEquals;
+
+ // Detect <SSID, PSK+SAE> scan result and say it is equal to <SSID, PSK> configuration
+ if (other.pskSaeInTransitionMode && networkType == WifiConfiguration.SECURITY_TYPE_PSK
+ || (pskSaeInTransitionMode
+ && other.networkType == WifiConfiguration.SECURITY_TYPE_PSK)) {
+ networkTypeEquals = true;
+ } else if ((networkType == WifiConfiguration.SECURITY_TYPE_OPEN
+ && other.oweInTransitionMode) || (oweInTransitionMode
+ && other.networkType == WifiConfiguration.SECURITY_TYPE_OPEN)) {
+ // Special case we treat Enhanced Open and Open as equals. This is done to support the
+ // case where a saved network is Open but we found an OWE in transition network.
+ networkTypeEquals = true;
+ } else {
+ networkTypeEquals = networkType == other.networkType;
+ }
+ return networkTypeEquals;
}
@Override
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index c027675ce..533155d0c 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -1117,7 +1117,6 @@ public class WifiConfigManager {
if (randomizedMac != null) {
newInternalConfig.setRandomizedMacAddress(randomizedMac);
}
- newInternalConfig.clonedNetworkConfigKey = externalConfig.clonedNetworkConfigKey;
return newInternalConfig;
}
@@ -1402,27 +1401,6 @@ public class WifiConfigManager {
Log.e(TAG, "Failed to remove network " + config.getPrintableSsid());
return false;
}
-
- // Remove any cloned networks
- if (config.clonedNetworkConfigKey != null) {
- WifiConfiguration clonedConfig = getConfiguredNetwork(config.clonedNetworkConfigKey);
-
- if (clonedConfig != null) {
- Log.d(TAG, "Removing cloned network " + clonedConfig.getPrintableSsid());
- if (!removeNetworkInternal(clonedConfig, uid)) {
- Log.e(TAG, "Failed to remove network " + clonedConfig.getPrintableSsid());
- return false;
- }
-
- if (clonedConfig.networkId == mLastSelectedNetworkId) {
- clearLastSelectedNetwork();
- }
- } else {
- Log.w(TAG, "Could not find a cloned network with key "
- + config.clonedNetworkConfigKey);
- }
- }
-
if (networkId == mLastSelectedNetworkId) {
clearLastSelectedNetwork();
}
@@ -2287,24 +2265,6 @@ public class WifiConfigManager {
} catch (IllegalArgumentException e) {
Log.e(TAG, "Failed to lookup network from config map", e);
}
- if (config == null) {
- /**
- * Special case for WPA3-Personal and OWE in transition mode.
- * These networks will be treated as WPA3/OWE with a special flag that indicates
- * transition mode enabled. If we have a matching WPA2/Open saved network, create a new
- * upgraded WPA3/OWE network and use it to connect.
- */
- ScanResultMatchInfo matchInfo = ScanResultMatchInfo.fromScanResult(scanResult);
- if (matchInfo.pskSaeInTransitionMode || matchInfo.oweInTransitionMode) {
- if (handleTransitionNetwork(scanResult, matchInfo.pskSaeInTransitionMode)) {
- try {
- config = mConfiguredNetworks.getByScanResultForCurrentUser(scanResult);
- } catch (IllegalArgumentException e) {
- Log.e(TAG, "Failed to lookup network from config map", e);
- }
- }
- }
- }
if (config != null) {
if (mVerboseLoggingEnabled) {
Log.v(TAG, "getSavedNetworkFromScanDetail Found " + config.configKey()
@@ -2314,41 +2274,6 @@ public class WifiConfigManager {
return config;
}
- private boolean handleTransitionNetwork(ScanResult scanResult, boolean isPskSae) {
- WifiConfiguration config;
-
- if (isPskSae) {
- config = mConfiguredNetworks.getPskNetworkByScanResultForCurrentUser(scanResult);
- } else {
- config = mConfiguredNetworks.getOpenNetworkByScanResultForCurrentUser(scanResult);
- }
-
- if (config != null) {
- // Create a new WPA3-Personal or OWE connection
- WifiConfiguration newConfig = new WifiConfiguration(config);
- newConfig.networkId = WifiConfiguration.INVALID_NETWORK_ID;
- newConfig.clonedNetworkConfigKey = config.configKey();
- if (isPskSae) {
- newConfig.setSecurityParams(WifiConfiguration.SECURITY_TYPE_SAE);
- } else {
- newConfig.setSecurityParams(WifiConfiguration.SECURITY_TYPE_OWE);
- }
- NetworkUpdateResult res = addOrUpdateNetwork(newConfig, config.creatorUid,
- config.creatorName);
-
- if (!res.isSuccess()) {
- Log.e(TAG, "Failed to add new configuration for " + newConfig.SSID);
- return false;
- }
- config.clonedNetworkConfigKey = newConfig.configKey();
- addOrUpdateNetwork(config, config.creatorUid);
- enableNetwork(res.netId, false, config.creatorUid);
- return true;
- }
-
- return false;
- }
-
/**
* Retrieves a configured network corresponding to the provided scan detail if one exists and
* caches the provided |scanDetail| into the corresponding scan detail cache entry