[WPA3] Settingslib changes to support new WPA3/OWE types
Added new strings and types for WPA3 and OWE new Wi-Fi Security standards. Modified WPA2-PSK to WPA2-Personal, and added WPA3-Personal, WPA3-Enterprise and Enhanced Open modes. Bug: 112195778 Test: Functional unit tests Change-Id: Ie5d27c2bbf082bf536d4f8c5cb5d5704155c0940
This commit is contained in:
@@ -21,35 +21,47 @@
|
||||
<!-- Toast message when Wi-Fi cannot scan for networks -->
|
||||
<string name="wifi_fail_to_scan">Can\'t scan for networks</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with WEP security -->
|
||||
<string name="wifi_security_short_wep">WEP</string>
|
||||
<string name="wifi_security_short_wep" translatable="false">WEP</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with WPA security -->
|
||||
<string name="wifi_security_short_wpa">WPA</string>
|
||||
<string name="wifi_security_short_wpa" translatable="false">WPA</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with WPA2 security -->
|
||||
<string name="wifi_security_short_wpa2">WPA2</string>
|
||||
<string name="wifi_security_short_wpa2" translatable="false">WPA2</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with both WPA/WPA2 security -->
|
||||
<string name="wifi_security_short_wpa_wpa2">WPA/WPA2</string>
|
||||
<string name="wifi_security_short_wpa_wpa2" translatable="false">WPA/WPA2</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with unknown PSK type -->
|
||||
<string name="wifi_security_short_psk_generic">@string/wifi_security_short_wpa_wpa2</string>
|
||||
<string name="wifi_security_short_psk_generic" translatable="false">@string/wifi_security_short_wpa_wpa2</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with 802.1x EAP security -->
|
||||
<string name="wifi_security_short_eap">802.1x</string>
|
||||
<string name="wifi_security_short_eap" translatable="false">802.1x</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with WPA3 security -->
|
||||
<string name="wifi_security_short_sae" translatable="false">WPA3</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with OWE security -->
|
||||
<string name="wifi_security_short_owe" translatable="false">OWE</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with 802.1x EAP Suite-B security -->
|
||||
<string name="wifi_security_short_eap_suiteb" translatable="false">Suite-B</string>
|
||||
|
||||
<!-- Used in Wi-Fi settings dialogs when Wi-Fi does not have any security. -->
|
||||
<string name="wifi_security_none">None</string>
|
||||
<string name="wifi_security_none" translatable="false">None</string>
|
||||
|
||||
<!-- Do not translate. Terminology for wifi with WEP security -->
|
||||
<string name="wifi_security_wep">WEP</string>
|
||||
<string name="wifi_security_wep" translatable="false">WEP</string>
|
||||
<!-- Do not translate. Terminology for wifi with WPA security -->
|
||||
<string name="wifi_security_wpa">WPA PSK</string>
|
||||
<string name="wifi_security_wpa" translatable="false">WPA-Personal</string>
|
||||
<!-- Do not translate. Terminology for wifi with WPA2 security -->
|
||||
<string name="wifi_security_wpa2">WPA2 PSK</string>
|
||||
<string name="wifi_security_wpa2" translatable="false">WPA2-Personal</string>
|
||||
<!-- Do not translate. Terminology for wifi with both WPA/WPA2 security, or unknown -->
|
||||
<string name="wifi_security_wpa_wpa2">WPA/WPA2 PSK</string>
|
||||
<string name="wifi_security_wpa_wpa2" translatable="false">WPA/WPA2-Personal</string>
|
||||
<!-- Do not translate. Terminology for wifi with unknown PSK type -->
|
||||
<string name="wifi_security_psk_generic">@string/wifi_security_wpa_wpa2</string>
|
||||
<string name="wifi_security_psk_generic" translatable="false">@string/wifi_security_wpa_wpa2</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with 802.1x EAP security -->
|
||||
<string name="wifi_security_eap">802.1x EAP</string>
|
||||
<string name="wifi_security_eap" translatable="false">WPA/WPA2-Enterprise</string>
|
||||
<!-- Do not translate. Concise terminology for Passpoint network -->
|
||||
<string name="wifi_security_passpoint">Passpoint</string>
|
||||
<string name="wifi_security_passpoint" translatable="false">Passpoint</string>
|
||||
<!-- Do not translate. Terminology for wifi with WPA3 security -->
|
||||
<string name="wifi_security_sae" translatable="false">WPA3-Personal</string>
|
||||
<!-- Do not translate. Terminology for wifi with OWE security -->
|
||||
<string name="wifi_security_owe" translatable="false">Enhanced Open</string>
|
||||
<!-- Do not translate. Concise terminology for wifi with 802.1x EAP Suite-B security -->
|
||||
<string name="wifi_security_eap_suiteb" translatable="false">WPA3-Enterprise</string>
|
||||
|
||||
<!-- Summary for the remembered network. -->
|
||||
<string name="wifi_remembered">Saved</string>
|
||||
|
||||
@@ -158,9 +158,12 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
* These values are matched in string arrays -- changes must be kept in sync
|
||||
*/
|
||||
public static final int SECURITY_NONE = 0;
|
||||
public static final int SECURITY_WEP = 1;
|
||||
public static final int SECURITY_PSK = 2;
|
||||
public static final int SECURITY_EAP = 3;
|
||||
public static final int SECURITY_OWE = 1;
|
||||
public static final int SECURITY_WEP = 2;
|
||||
public static final int SECURITY_PSK = 3;
|
||||
public static final int SECURITY_SAE = 4;
|
||||
public static final int SECURITY_EAP = 5;
|
||||
public static final int SECURITY_EAP_SUITE_B = 6;
|
||||
|
||||
private static final int PSK_UNKNOWN = 0;
|
||||
private static final int PSK_WPA = 1;
|
||||
@@ -433,7 +436,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
if (isConnectable()) {
|
||||
builder.append(',').append("connectable");
|
||||
}
|
||||
if (security != SECURITY_NONE) {
|
||||
if ((security != SECURITY_NONE) && (security != SECURITY_OWE)) {
|
||||
builder.append(',').append(securityToString(security, pskType));
|
||||
}
|
||||
builder.append(",level=").append(getLevel());
|
||||
@@ -720,6 +723,9 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
case SECURITY_EAP:
|
||||
return concise ? context.getString(R.string.wifi_security_short_eap) :
|
||||
context.getString(R.string.wifi_security_eap);
|
||||
case SECURITY_EAP_SUITE_B:
|
||||
return concise ? context.getString(R.string.wifi_security_short_eap_suiteb) :
|
||||
context.getString(R.string.wifi_security_eap_suiteb);
|
||||
case SECURITY_PSK:
|
||||
switch (pskType) {
|
||||
case PSK_WPA:
|
||||
@@ -739,6 +745,12 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
case SECURITY_WEP:
|
||||
return concise ? context.getString(R.string.wifi_security_short_wep) :
|
||||
context.getString(R.string.wifi_security_wep);
|
||||
case SECURITY_SAE:
|
||||
return concise ? context.getString(R.string.wifi_security_short_sae) :
|
||||
context.getString(R.string.wifi_security_sae);
|
||||
case SECURITY_OWE:
|
||||
return concise ? context.getString(R.string.wifi_security_short_owe) :
|
||||
context.getString(R.string.wifi_security_owe);
|
||||
case SECURITY_NONE:
|
||||
default:
|
||||
return concise ? "" : context.getString(R.string.wifi_security_none);
|
||||
@@ -980,13 +992,20 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
* Can only be called for unsecured networks.
|
||||
*/
|
||||
public void generateOpenNetworkConfig() {
|
||||
if (security != SECURITY_NONE)
|
||||
if ((security != SECURITY_NONE) && (security != SECURITY_OWE)) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (mConfig != null)
|
||||
return;
|
||||
mConfig = new WifiConfiguration();
|
||||
mConfig.SSID = AccessPoint.convertToQuotedString(ssid);
|
||||
mConfig.allowedKeyManagement.set(KeyMgmt.NONE);
|
||||
|
||||
if (security == SECURITY_NONE) {
|
||||
mConfig.allowedKeyManagement.set(KeyMgmt.NONE);
|
||||
} else {
|
||||
mConfig.allowedKeyManagement.set(KeyMgmt.OWE);
|
||||
mConfig.requirePMF = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveWifiState(Bundle savedState) {
|
||||
@@ -1288,22 +1307,38 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
private static int getSecurity(ScanResult result) {
|
||||
if (result.capabilities.contains("WEP")) {
|
||||
return SECURITY_WEP;
|
||||
} else if (result.capabilities.contains("SAE")) {
|
||||
return SECURITY_SAE;
|
||||
} else if (result.capabilities.contains("PSK")) {
|
||||
return SECURITY_PSK;
|
||||
} else if (result.capabilities.contains("EAP_SUITE_B_192")) {
|
||||
return SECURITY_EAP_SUITE_B;
|
||||
} else if (result.capabilities.contains("EAP")) {
|
||||
return SECURITY_EAP;
|
||||
} else if (result.capabilities.contains("OWE")) {
|
||||
return SECURITY_OWE;
|
||||
}
|
||||
|
||||
return SECURITY_NONE;
|
||||
}
|
||||
|
||||
static int getSecurity(WifiConfiguration config) {
|
||||
if (config.allowedKeyManagement.get(KeyMgmt.SAE)) {
|
||||
return SECURITY_SAE;
|
||||
}
|
||||
if (config.allowedKeyManagement.get(KeyMgmt.WPA_PSK)) {
|
||||
return SECURITY_PSK;
|
||||
}
|
||||
if (config.allowedKeyManagement.get(KeyMgmt.SUITE_B_192)) {
|
||||
return SECURITY_EAP_SUITE_B;
|
||||
}
|
||||
if (config.allowedKeyManagement.get(KeyMgmt.WPA_EAP) ||
|
||||
config.allowedKeyManagement.get(KeyMgmt.IEEE8021X)) {
|
||||
return SECURITY_EAP;
|
||||
}
|
||||
if (config.allowedKeyManagement.get(KeyMgmt.OWE)) {
|
||||
return SECURITY_OWE;
|
||||
}
|
||||
return (config.wepKeys[0] != null) ? SECURITY_WEP : SECURITY_NONE;
|
||||
}
|
||||
|
||||
@@ -1321,6 +1356,12 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
return "PSK";
|
||||
} else if (security == SECURITY_EAP) {
|
||||
return "EAP";
|
||||
} else if (security == SECURITY_SAE) {
|
||||
return "SAE";
|
||||
} else if (security == SECURITY_EAP_SUITE_B) {
|
||||
return "SUITE_B";
|
||||
} else if (security == SECURITY_OWE) {
|
||||
return "OWE";
|
||||
}
|
||||
return "NONE";
|
||||
}
|
||||
|
||||
@@ -200,7 +200,8 @@ public class AccessPointPreference extends Preference {
|
||||
if (frictionImageView == null || mFrictionSld == null) {
|
||||
return;
|
||||
}
|
||||
if (mAccessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
|
||||
if ((mAccessPoint.getSecurity() != AccessPoint.SECURITY_NONE)
|
||||
&& (mAccessPoint.getSecurity() != AccessPoint.SECURITY_OWE)) {
|
||||
mFrictionSld.setState(STATE_SECURED);
|
||||
} else if (mAccessPoint.isMetered()) {
|
||||
mFrictionSld.setState(STATE_METERED);
|
||||
|
||||
Reference in New Issue
Block a user