Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2fcb782 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[WPA3] Fix connectivity issues with PSK-SAE Transtion mode" into qt-dev

parents 7ac16f15 3fc9dc3a
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -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);