[WPA3] Fix connectivity issues with PSK-SAE Transtion mode
Fix two reported issues regarding PSK-SAE transition mode:
1. When phone supports SAE, creating a manual saved network with PSK
and manually connecting would cause the phone to connect but Settings
does not display any connected AP. Phone would not autoconnect.
2. When phone doesn't support SAE, phone cannot connect to an AP in
PSK-SAE Transition mode because the framework always targets the highest
security.
Bug: 132278271
Test: Connect to WPA2 network
Test: Connect to WPA3 network (w/capable phone)
Test: Connect to WPA2/3 Transition w/SAE capable phone
Test: Connect to WPA2/3 Transition w/SAE not-capable phone
Change-Id: I371bcb4b2cccfc8684ecb5db3a768524f7354598
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index ac11510..ba26f02 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -42,7 +42,6 @@
import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
-import android.util.FeatureFlagUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@@ -582,6 +581,25 @@
}
}
+ /**
+ * Special handling for WPA2/WPA3 in Transition mode: The key SECURITY_PSK_SAE_TRANSITION is
+ * a pseudo key which results by the scan results, but never appears in the saved networks.
+ * A saved network is either WPA3 for supporting devices or WPA2 for non-supporting devices.
+ *
+ * @param accessPointSecurity Access point current security type
+ * @return Converted security type (if required)
+ */
+ private int convertSecurityTypeForMatching(int accessPointSecurity) {
+ if (accessPointSecurity == AccessPoint.SECURITY_PSK_SAE_TRANSITION) {
+ if (mWifiManager.isWpa3SaeSupported()) {
+ return AccessPoint.SECURITY_SAE;
+ } else {
+ return AccessPoint.SECURITY_PSK;
+ }
+ }
+ return accessPointSecurity;
+ }
+
public WifiConfiguration getConfig() {
if (mMode == WifiConfigUiBase.MODE_VIEW) {
return null;
@@ -604,6 +622,8 @@
config.shared = mSharedCheckBox.isChecked();
+ mAccessPointSecurity = convertSecurityTypeForMatching(mAccessPointSecurity);
+
switch (mAccessPointSecurity) {
case AccessPoint.SECURITY_NONE:
config.allowedKeyManagement.set(KeyMgmt.NONE);