diff options
| author | 2019-05-13 15:31:41 -0700 | |
|---|---|---|
| committer | 2019-05-13 15:37:43 -0700 | |
| commit | 2195d1fc668c17ef76aa0ba3344415117ae13ed6 (patch) | |
| tree | cd34da5ed03e0c444a0109063bd6f87a67c25fa2 | |
| parent | 1198fc4e7101db6cc7206594d489bb92b3d954ac (diff) | |
[OWE] Support OWE in transition mode
Support OWE in transition mode for devices with OWE support
and devices without OWE support. Scan results will return a
new type of network for OWE in transition networks on devices
that support OWE, and Open for devices that don't support OWE.
Handle the case where Open network is manually added to a device
that supports OWE.
Bug: 132139642
Test: Device with OWE: Connect to Open, OWE-Transition, OWE networks
Test: Device without OWE: Connect to Open, OWE-Transition
Test: Manually create Open network, connect to OWE-Transition
Change-Id: I29e69eaae2672562420ee7c6393bf2cc4d7f1b91
3 files changed, 33 insertions, 5 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index 05af4e1f80b3..e28c612453b4 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -180,7 +180,8 @@ public class AccessPoint implements Comparable<AccessPoint> { public static final int SECURITY_SAE = 5; public static final int SECURITY_EAP_SUITE_B = 6; public static final int SECURITY_PSK_SAE_TRANSITION = 7; - public static final int SECURITY_MAX_VAL = 8; // Has to be the last + public static final int SECURITY_OWE_TRANSITION = 8; + public static final int SECURITY_MAX_VAL = 9; // Has to be the last private static final int PSK_UNKNOWN = 0; private static final int PSK_WPA = 1; @@ -869,6 +870,12 @@ public class AccessPoint implements Comparable<AccessPoint> { return concise ? context.getString(R.string.wifi_security_short_sae) : context.getString(R.string.wifi_security_sae); } + case SECURITY_OWE_TRANSITION: + if (mConfig != null && getSecurity(mConfig) == SECURITY_OWE) { + return concise ? context.getString(R.string.wifi_security_short_owe) : + context.getString(R.string.wifi_security_owe); + } + return concise ? "" : context.getString(R.string.wifi_security_none); case SECURITY_OWE: return concise ? context.getString(R.string.wifi_security_short_owe) : context.getString(R.string.wifi_security_owe); @@ -1179,7 +1186,8 @@ public class AccessPoint implements Comparable<AccessPoint> { * Can only be called for unsecured networks. */ public void generateOpenNetworkConfig() { - if ((security != SECURITY_NONE) && (security != SECURITY_OWE)) { + if ((security != SECURITY_NONE) && (security != SECURITY_OWE) + && (security != SECURITY_OWE_TRANSITION)) { throw new IllegalStateException(); } if (mConfig != null) @@ -1187,7 +1195,7 @@ public class AccessPoint implements Comparable<AccessPoint> { mConfig = new WifiConfiguration(); mConfig.SSID = AccessPoint.convertToQuotedString(ssid); - if (security == SECURITY_NONE) { + if (security == SECURITY_NONE || !getWifiManager().isEasyConnectSupported()) { mConfig.allowedKeyManagement.set(KeyMgmt.NONE); } else { mConfig.allowedKeyManagement.set(KeyMgmt.OWE); @@ -1229,6 +1237,9 @@ public class AccessPoint implements Comparable<AccessPoint> { private static final String sPskSuffix = "," + String.valueOf(SECURITY_PSK); private static final String sSaeSuffix = "," + String.valueOf(SECURITY_SAE); private static final String sPskSaeSuffix = "," + String.valueOf(SECURITY_PSK_SAE_TRANSITION); + private static final String sOweSuffix = "," + String.valueOf(SECURITY_OWE); + private static final String sOpenSuffix = "," + String.valueOf(SECURITY_NONE); + private static final String sOweTransSuffix = "," + String.valueOf(SECURITY_OWE_TRANSITION); private boolean isKeyEqual(String compareTo) { if (mKey == null) { @@ -1243,6 +1254,14 @@ public class AccessPoint implements Comparable<AccessPoint> { compareTo.substring(0, compareTo.lastIndexOf(','))); } } + if (compareTo.endsWith(sOpenSuffix) || compareTo.endsWith(sOweSuffix)) { + if (mKey.endsWith(sOweTransSuffix)) { + // Special handling for OWE/Open networks. If AP advertises OWE in transition mode + // and we have an Open network saved, allow this connection to be established. + return TextUtils.equals(mKey.substring(0, mKey.lastIndexOf(',')), + compareTo.substring(0, compareTo.lastIndexOf(','))); + } + } return mKey.equals(compareTo); } @@ -1579,10 +1598,11 @@ public class AccessPoint implements Comparable<AccessPoint> { return SECURITY_EAP_SUITE_B; } else if (result.capabilities.contains("EAP")) { return SECURITY_EAP; + } else if (result.capabilities.contains("OWE_TRANSITION")) { + return SECURITY_OWE_TRANSITION; } else if (result.capabilities.contains("OWE")) { return SECURITY_OWE; } - return SECURITY_NONE; } @@ -1628,6 +1648,8 @@ public class AccessPoint implements Comparable<AccessPoint> { return "OWE"; } else if (security == SECURITY_PSK_SAE_TRANSITION) { return "PSK+SAE"; + } else if (security == SECURITY_OWE_TRANSITION) { + return "OWE_TRANSITION"; } return "NONE"; } diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java index 6269a717b333..dae546497aba 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java @@ -201,7 +201,8 @@ public class AccessPointPreference extends Preference { return; } if ((mAccessPoint.getSecurity() != AccessPoint.SECURITY_NONE) - && (mAccessPoint.getSecurity() != AccessPoint.SECURITY_OWE)) { + && (mAccessPoint.getSecurity() != AccessPoint.SECURITY_OWE) + && (mAccessPoint.getSecurity() != AccessPoint.SECURITY_OWE_TRANSITION)) { mFrictionSld.setState(STATE_SECURED); } else if (mAccessPoint.isMetered()) { mFrictionSld.setState(STATE_METERED); diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java index 0b1108d56b7f..c0c0361dd92f 100644 --- a/wifi/java/android/net/wifi/ScanResult.java +++ b/wifi/java/android/net/wifi/ScanResult.java @@ -160,6 +160,11 @@ public class ScanResult implements Parcelable { public static final int KEY_MGMT_FT_SAE = 11; /** * @hide + * Security key management scheme: OWE in transition mode. + */ + public static final int KEY_MGMT_OWE_TRANSITION = 12; + /** + * @hide * No cipher suite. */ public static final int CIPHER_NONE = 0; |