From: Arc Wang Date: Mon, 9 Dec 2019 11:19:46 +0000 (+0800) Subject: [Wi-Fi] Fix transition mode problems X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fpackages-apps-Settings.git;a=commitdiff_plain;h=be02f16b3a1830bad0e517d25a9da7215aeb1622 [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: I6596c48ea54adcaf579682634965c379c7938895 Merged-In: Ic3c7ac1238a51b6e215ed63761720d2bc371d012 --- diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java index 4762403f4d..ceda8a70a0 100644 --- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java +++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java @@ -310,7 +310,7 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp mHandler.sendEmptyMessageDelayed(MESSAGE_STOP_SCAN_WIFI_LIST, DELAY_TIME_STOP_SCAN_MS); if (mFilterWifiTracker == null) { - mFilterWifiTracker = new FilterWifiTracker(getActivity(), getSettingsLifecycle()); + mFilterWifiTracker = new FilterWifiTracker(getContext(), getSettingsLifecycle()); } mFilterWifiTracker.onResume(); } @@ -476,11 +476,13 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp private final class FilterWifiTracker { private final List mAccessPointKeys; private final WifiTracker mWifiTracker; + private final Context mContext; public FilterWifiTracker(Context context, Lifecycle lifecycle) { mWifiTracker = WifiTrackerFactory.create(context, mWifiListener, lifecycle, /* includeSaved */ true, /* includeScans */ true); mAccessPointKeys = new ArrayList<>(); + mContext = context; } /** @@ -489,7 +491,7 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp */ public void updateKeys(List scanResults) { for (ScanResult scanResult : scanResults) { - final String key = AccessPoint.getKey(scanResult); + final String key = AccessPoint.getKey(mContext, scanResult); if (!mAccessPointKeys.contains(key)) { mAccessPointKeys.add(key); } diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 12d5a9082a..48c9e54155 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -583,35 +583,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() { if (mMode == WifiConfigUiBase.MODE_VIEW) { return null; @@ -634,8 +605,6 @@ public class WifiConfigController implements TextWatcher, config.shared = mSharedCheckBox.isChecked(); - mAccessPointSecurity = convertSecurityTypeForMatching(mAccessPointSecurity); - switch (mAccessPointSecurity) { case AccessPoint.SECURITY_NONE: config.allowedKeyManagement.set(KeyMgmt.NONE); @@ -960,8 +929,7 @@ public class WifiConfigController implements TextWatcher, private void showSecurityFields(boolean refreshEapMethods, boolean refreshCertificates) { if (mAccessPointSecurity == AccessPoint.SECURITY_NONE || - mAccessPointSecurity == AccessPoint.SECURITY_OWE || - mAccessPointSecurity == AccessPoint.SECURITY_OWE_TRANSITION) { + mAccessPointSecurity == AccessPoint.SECURITY_OWE) { mView.findViewById(R.id.security_fields).setVisibility(View.GONE); return; } diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 8c4bfa28ad..4d3f230db1 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -494,9 +494,7 @@ public class WifiSettings extends RestrictedSettingsFragment if (isSavedNetwork) { connect(mSelectedAccessPoint.getConfig(), isSavedNetwork); } else if ((mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE) || - (mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_OWE) || - (mSelectedAccessPoint.getSecurity() - == AccessPoint.SECURITY_OWE_TRANSITION)) { + (mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) { /** Bypass dialog for unsecured networks */ mSelectedAccessPoint.generateOpenNetworkConfig(); connect(mSelectedAccessPoint.getConfig(), isSavedNetwork); @@ -750,8 +748,7 @@ public class WifiSettings extends RestrictedSettingsFragment preference.setOrder(index); if (mOpenSsid != null && mOpenSsid.equals(accessPoint.getSsidStr()) && (accessPoint.getSecurity() != AccessPoint.SECURITY_NONE && - accessPoint.getSecurity() != AccessPoint.SECURITY_OWE && - accessPoint.getSecurity() != AccessPoint.SECURITY_OWE_TRANSITION)) { + accessPoint.getSecurity() != AccessPoint.SECURITY_OWE)) { if (!accessPoint.isSaved() || isDisabledByWrongPassword(accessPoint)) { onPreferenceTreeClick(preference); mOpenSsid = null; diff --git a/src/com/android/settings/wifi/WifiUtils.java b/src/com/android/settings/wifi/WifiUtils.java index c4df567624..9b3c1b368c 100644 --- a/src/com/android/settings/wifi/WifiUtils.java +++ b/src/com/android/settings/wifi/WifiUtils.java @@ -268,8 +268,7 @@ public class WifiUtils { if (accessPoint.isOsuProvider()) { return CONNECT_TYPE_OSU_PROVISION; } else if ((accessPoint.getSecurity() == AccessPoint.SECURITY_NONE) || - (accessPoint.getSecurity() == AccessPoint.SECURITY_OWE) || - (accessPoint.getSecurity() == AccessPoint.SECURITY_OWE_TRANSITION)) { + (accessPoint.getSecurity() == AccessPoint.SECURITY_OWE)) { return CONNECT_TYPE_OPEN_NETWORK; } else if (accessPoint.isSaved() && config != null && config.getNetworkSelectionStatus() != null diff --git a/src/com/android/settings/wifi/dpp/WifiDppUtils.java b/src/com/android/settings/wifi/dpp/WifiDppUtils.java index 2a958e801e..fc1bc25b76 100644 --- a/src/com/android/settings/wifi/dpp/WifiDppUtils.java +++ b/src/com/android/settings/wifi/dpp/WifiDppUtils.java @@ -206,7 +206,7 @@ public class WifiDppUtils { setConfiguratorIntentExtra(intent, wifiManager, wifiConfiguration); // 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); } @@ -406,7 +406,6 @@ public class WifiDppUtils { } break; case AccessPoint.SECURITY_PSK: - case AccessPoint.SECURITY_PSK_SAE_TRANSITION: return true; default: } @@ -419,8 +418,6 @@ public class WifiDppUtils { case AccessPoint.SECURITY_PSK: case AccessPoint.SECURITY_WEP: case AccessPoint.SECURITY_NONE: - case AccessPoint.SECURITY_PSK_SAE_TRANSITION: - case AccessPoint.SECURITY_OWE_TRANSITION: return true; case AccessPoint.SECURITY_SAE: if (wifiManager.isWpa3SaeSupported()) {