[Wi-Fi] Fix transition mode problems
Replace SECURITY_PSK_SAE_TRANSITION & SECURITY_OWE_TRANSITION with AccessPpoint#isPskSaeTransitionMode() & AccessPpoint#isPskOweTransitionMode() Bug: 144320676 Bug: 144320649 Bug: 144325162 Bug: 144321574 Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.wifi Change-Id: Ic3c7ac1238a51b6e215ed63761720d2bc371d012
This commit is contained in:
@@ -220,7 +220,7 @@ public class NetworkRequestDialogFragment extends NetworkRequestDialogBaseFragme
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (mFilterWifiTracker == null) {
|
if (mFilterWifiTracker == null) {
|
||||||
mFilterWifiTracker = new FilterWifiTracker(getActivity(), getSettingsLifecycle());
|
mFilterWifiTracker = new FilterWifiTracker(getContext(), getSettingsLifecycle());
|
||||||
}
|
}
|
||||||
mFilterWifiTracker.onResume();
|
mFilterWifiTracker.onResume();
|
||||||
}
|
}
|
||||||
@@ -331,11 +331,13 @@ public class NetworkRequestDialogFragment extends NetworkRequestDialogBaseFragme
|
|||||||
final class FilterWifiTracker {
|
final class FilterWifiTracker {
|
||||||
private final List<String> mAccessPointKeys;
|
private final List<String> mAccessPointKeys;
|
||||||
private final WifiTracker mWifiTracker;
|
private final WifiTracker mWifiTracker;
|
||||||
|
private final Context mContext;
|
||||||
|
|
||||||
public FilterWifiTracker(Context context, Lifecycle lifecycle) {
|
public FilterWifiTracker(Context context, Lifecycle lifecycle) {
|
||||||
mWifiTracker = WifiTrackerFactory.create(context, mWifiListener,
|
mWifiTracker = WifiTrackerFactory.create(context, mWifiListener,
|
||||||
lifecycle, /* includeSaved */ true, /* includeScans */ true);
|
lifecycle, /* includeSaved */ true, /* includeScans */ true);
|
||||||
mAccessPointKeys = new ArrayList<>();
|
mAccessPointKeys = new ArrayList<>();
|
||||||
|
mContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -344,7 +346,7 @@ public class NetworkRequestDialogFragment extends NetworkRequestDialogBaseFragme
|
|||||||
*/
|
*/
|
||||||
public void updateKeys(List<ScanResult> scanResults) {
|
public void updateKeys(List<ScanResult> scanResults) {
|
||||||
for (ScanResult scanResult : scanResults) {
|
for (ScanResult scanResult : scanResults) {
|
||||||
final String key = AccessPoint.getKey(scanResult);
|
final String key = AccessPoint.getKey(mContext, scanResult);
|
||||||
if (!mAccessPointKeys.contains(key)) {
|
if (!mAccessPointKeys.contains(key)) {
|
||||||
mAccessPointKeys.add(key);
|
mAccessPointKeys.add(key);
|
||||||
}
|
}
|
||||||
|
@@ -607,35 +607,6 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Special handling for WPA2/WPA3 and OWE in Transition mode: The key
|
|
||||||
* SECURITY_PSK_SAE_TRANSITION and SECURITY_OWE_TRANSITION are pseudo keys which result 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,
|
|
||||||
* or, OWE for supporting devices or Open 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (accessPointSecurity == AccessPoint.SECURITY_OWE_TRANSITION) {
|
|
||||||
if (mWifiManager.isEnhancedOpenSupported()) {
|
|
||||||
return AccessPoint.SECURITY_OWE;
|
|
||||||
} else {
|
|
||||||
return AccessPoint.SECURITY_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return accessPointSecurity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WifiConfiguration getConfig() {
|
public WifiConfiguration getConfig() {
|
||||||
if (mMode == WifiConfigUiBase.MODE_VIEW) {
|
if (mMode == WifiConfigUiBase.MODE_VIEW) {
|
||||||
return null;
|
return null;
|
||||||
@@ -658,8 +629,6 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
|
|
||||||
config.shared = mSharedCheckBox.isChecked();
|
config.shared = mSharedCheckBox.isChecked();
|
||||||
|
|
||||||
mAccessPointSecurity = convertSecurityTypeForMatching(mAccessPointSecurity);
|
|
||||||
|
|
||||||
switch (mAccessPointSecurity) {
|
switch (mAccessPointSecurity) {
|
||||||
case AccessPoint.SECURITY_NONE:
|
case AccessPoint.SECURITY_NONE:
|
||||||
config.allowedKeyManagement.set(KeyMgmt.NONE);
|
config.allowedKeyManagement.set(KeyMgmt.NONE);
|
||||||
@@ -1017,8 +986,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
|
|
||||||
private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) {
|
private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) {
|
||||||
if (mAccessPointSecurity == AccessPoint.SECURITY_NONE ||
|
if (mAccessPointSecurity == AccessPoint.SECURITY_NONE ||
|
||||||
mAccessPointSecurity == AccessPoint.SECURITY_OWE ||
|
mAccessPointSecurity == AccessPoint.SECURITY_OWE) {
|
||||||
mAccessPointSecurity == AccessPoint.SECURITY_OWE_TRANSITION) {
|
|
||||||
mView.findViewById(R.id.security_fields).setVisibility(View.GONE);
|
mView.findViewById(R.id.security_fields).setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -515,9 +515,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
if (isSavedNetwork) {
|
if (isSavedNetwork) {
|
||||||
connect(mSelectedAccessPoint.getConfig(), isSavedNetwork);
|
connect(mSelectedAccessPoint.getConfig(), isSavedNetwork);
|
||||||
} else if ((mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
|
} else if ((mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
|
||||||
(mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_OWE) ||
|
(mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) {
|
||||||
(mSelectedAccessPoint.getSecurity()
|
|
||||||
== AccessPoint.SECURITY_OWE_TRANSITION)) {
|
|
||||||
/** Bypass dialog for unsecured networks */
|
/** Bypass dialog for unsecured networks */
|
||||||
mSelectedAccessPoint.generateOpenNetworkConfig();
|
mSelectedAccessPoint.generateOpenNetworkConfig();
|
||||||
connect(mSelectedAccessPoint.getConfig(), isSavedNetwork);
|
connect(mSelectedAccessPoint.getConfig(), isSavedNetwork);
|
||||||
@@ -774,8 +772,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
preference.setOrder(index);
|
preference.setOrder(index);
|
||||||
if (mOpenSsid != null && mOpenSsid.equals(accessPoint.getSsidStr())
|
if (mOpenSsid != null && mOpenSsid.equals(accessPoint.getSsidStr())
|
||||||
&& (accessPoint.getSecurity() != AccessPoint.SECURITY_NONE &&
|
&& (accessPoint.getSecurity() != AccessPoint.SECURITY_NONE &&
|
||||||
accessPoint.getSecurity() != AccessPoint.SECURITY_OWE &&
|
accessPoint.getSecurity() != AccessPoint.SECURITY_OWE)) {
|
||||||
accessPoint.getSecurity() != AccessPoint.SECURITY_OWE_TRANSITION)) {
|
|
||||||
if (!accessPoint.isSaved() || isDisabledByWrongPassword(accessPoint)) {
|
if (!accessPoint.isSaved() || isDisabledByWrongPassword(accessPoint)) {
|
||||||
onPreferenceTreeClick(preference);
|
onPreferenceTreeClick(preference);
|
||||||
mOpenSsid = null;
|
mOpenSsid = null;
|
||||||
|
@@ -268,8 +268,7 @@ public class WifiUtils {
|
|||||||
if (accessPoint.isOsuProvider()) {
|
if (accessPoint.isOsuProvider()) {
|
||||||
return CONNECT_TYPE_OSU_PROVISION;
|
return CONNECT_TYPE_OSU_PROVISION;
|
||||||
} else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
|
} else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) ||
|
||||||
(accessPoint.getSecurity() == AccessPoint.SECURITY_OWE) ||
|
(accessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) {
|
||||||
(accessPoint.getSecurity() == AccessPoint.SECURITY_OWE_TRANSITION)) {
|
|
||||||
return CONNECT_TYPE_OPEN_NETWORK;
|
return CONNECT_TYPE_OPEN_NETWORK;
|
||||||
} else if (accessPoint.isSaved() && config != null
|
} else if (accessPoint.isSaved() && config != null
|
||||||
&& config.getNetworkSelectionStatus() != null
|
&& config.getNetworkSelectionStatus() != null
|
||||||
|
@@ -204,7 +204,7 @@ public class WifiDppUtils {
|
|||||||
setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration);
|
setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration);
|
||||||
|
|
||||||
// For a transition mode Wi-Fi AP, creates a QR code that's compatible with more devices
|
// For a transition mode Wi-Fi AP, creates a QR code that's compatible with more devices
|
||||||
if (accessPoint.getSecurity() == AccessPoint.SECURITY_PSK_SAE_TRANSITION) {
|
if (accessPoint.isPskSaeTransitionMode()) {
|
||||||
intent.putExtra(EXTRA_WIFI_SECURITY, WifiQrCode.SECURITY_WPA_PSK);
|
intent.putExtra(EXTRA_WIFI_SECURITY, WifiQrCode.SECURITY_WPA_PSK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +427,6 @@ public class WifiDppUtils {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AccessPoint.SECURITY_PSK:
|
case AccessPoint.SECURITY_PSK:
|
||||||
case AccessPoint.SECURITY_PSK_SAE_TRANSITION:
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
@@ -440,8 +439,6 @@ public class WifiDppUtils {
|
|||||||
case AccessPoint.SECURITY_PSK:
|
case AccessPoint.SECURITY_PSK:
|
||||||
case AccessPoint.SECURITY_WEP:
|
case AccessPoint.SECURITY_WEP:
|
||||||
case AccessPoint.SECURITY_NONE:
|
case AccessPoint.SECURITY_NONE:
|
||||||
case AccessPoint.SECURITY_PSK_SAE_TRANSITION:
|
|
||||||
case AccessPoint.SECURITY_OWE_TRANSITION:
|
|
||||||
return true;
|
return true;
|
||||||
case AccessPoint.SECURITY_SAE:
|
case AccessPoint.SECURITY_SAE:
|
||||||
if (wifiManager.isWpa3SaeSupported()) {
|
if (wifiManager.isWpa3SaeSupported()) {
|
||||||
|
Reference in New Issue
Block a user