[Wi-Fi] Support transition mode in AccessPoint#matches

When enrolling Wi-Fi network with Settings Wi-Fi QR code scanner,
it will compare Wi-Fi network information between QR code and
all reachable Wi-Fi networks before connecting.

This change supports to enroll Wi-Fi networks from a Wi-Fi AP
of transition mode.

Bug: 134706055
Test: Scan a QR code of open network, verify connection
      Scan a QR code of OWE network, verify connection
      Scan a QR code of WPA3 network, verify connection
      Scan a QR code of WPA3 network, verify transition mode connection

Change-Id: Ifc470cbcde7f33ffd76c9f6a8606cabda78a88cd
This commit is contained in:
Arc Wang
2019-06-11 11:28:27 +08:00
parent da15cb030c
commit 04bb4b82c6

View File

@@ -712,11 +712,25 @@ public class AccessPoint implements Comparable<AccessPoint> {
public boolean matches(WifiConfiguration config) {
if (config.isPasspoint()) {
return (isPasspoint() && config.FQDN.equals(mConfig.FQDN));
} else {
// Normal non-Passpoint network
return ssid.equals(removeDoubleQuotes(config.SSID))
&& security == getSecurity(config)
&& (mConfig == null || mConfig.shared == config.shared);
}
if (!ssid.equals(removeDoubleQuotes(config.SSID))
|| (mConfig != null && mConfig.shared != config.shared)) {
return false;
}
final int configSecurity = getSecurity(config);
final WifiManager wifiManager = getWifiManager();
switch (security) {
case SECURITY_PSK_SAE_TRANSITION:
return configSecurity == SECURITY_PSK
|| (wifiManager.isWpa3SaeSupported() && configSecurity == SECURITY_SAE);
case SECURITY_OWE_TRANSITION:
return configSecurity == SECURITY_NONE
|| (wifiManager.isEnhancedOpenSupported()
&& configSecurity == SECURITY_OWE);
default:
return security == configSecurity;
}
}