diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index ac11510761c..ba26f02f49d 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -42,7 +42,6 @@ import android.text.Editable; 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 @@ public class WifiConfigController implements TextWatcher, } } + /** + * 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 @@ public class WifiConfigController implements TextWatcher, config.shared = mSharedCheckBox.isChecked(); + mAccessPointSecurity = convertSecurityTypeForMatching(mAccessPointSecurity); + switch (mAccessPointSecurity) { case AccessPoint.SECURITY_NONE: config.allowedKeyManagement.set(KeyMgmt.NONE);