Revert submission
Reason for revert: Incomplete fix that causes additional issues which were not anticipated earlier. Change-Id: Iff36d5a10e6c8ee8978a5842af8f19efc10c0a91
This commit is contained in:
@@ -748,7 +748,20 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
|| (mConfig != null && mConfig.shared != config.shared)) {
|
|| (mConfig != null && mConfig.shared != config.shared)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return security == getSecurity(config);
|
|
||||||
|
final int configSecurity = getSecurity(config);
|
||||||
|
final WifiManager wifiManager = getWifiManager();
|
||||||
|
switch (security) {
|
||||||
|
case SECURITY_PSK_SAE_TRANSITION:
|
||||||
|
return configSecurity == SECURITY_PSK
|
||||||
|
|| (wifiManager.isWpa3SaeSupported() && configSecurity == SECURITY_SAE);
|
||||||
|
case SECURITY_OWE_TRANSITION:
|
||||||
|
return configSecurity == SECURITY_NONE
|
||||||
|
|| (wifiManager.isEnhancedOpenSupported()
|
||||||
|
&& configSecurity == SECURITY_OWE);
|
||||||
|
default:
|
||||||
|
return security == configSecurity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WifiConfiguration getConfig() {
|
public WifiConfiguration getConfig() {
|
||||||
@@ -1321,10 +1334,34 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
mAccessPointListener = listener;
|
mAccessPointListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
private boolean isKeyEqual(String compareTo) {
|
||||||
if (mKey == null) {
|
if (mKey == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (compareTo.endsWith(sPskSuffix) || compareTo.endsWith(sSaeSuffix)) {
|
||||||
|
if (mKey.endsWith(sPskSaeSuffix)) {
|
||||||
|
// Special handling for PSK-SAE transition mode. If the AP has advertised both,
|
||||||
|
// we compare the key with both PSK and SAE for a match.
|
||||||
|
return TextUtils.equals(mKey.substring(0, mKey.lastIndexOf(',')),
|
||||||
|
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);
|
return mKey.equals(compareTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1661,6 +1698,8 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
private static int getSecurity(ScanResult result) {
|
private static int getSecurity(ScanResult result) {
|
||||||
if (result.capabilities.contains("WEP")) {
|
if (result.capabilities.contains("WEP")) {
|
||||||
return SECURITY_WEP;
|
return SECURITY_WEP;
|
||||||
|
} else if (result.capabilities.contains("PSK+SAE")) {
|
||||||
|
return SECURITY_PSK_SAE_TRANSITION;
|
||||||
} else if (result.capabilities.contains("SAE")) {
|
} else if (result.capabilities.contains("SAE")) {
|
||||||
return SECURITY_SAE;
|
return SECURITY_SAE;
|
||||||
} else if (result.capabilities.contains("PSK")) {
|
} else if (result.capabilities.contains("PSK")) {
|
||||||
@@ -1669,6 +1708,8 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
return SECURITY_EAP_SUITE_B;
|
return SECURITY_EAP_SUITE_B;
|
||||||
} else if (result.capabilities.contains("EAP")) {
|
} else if (result.capabilities.contains("EAP")) {
|
||||||
return SECURITY_EAP;
|
return SECURITY_EAP;
|
||||||
|
} else if (result.capabilities.contains("OWE_TRANSITION")) {
|
||||||
|
return SECURITY_OWE_TRANSITION;
|
||||||
} else if (result.capabilities.contains("OWE")) {
|
} else if (result.capabilities.contains("OWE")) {
|
||||||
return SECURITY_OWE;
|
return SECURITY_OWE;
|
||||||
}
|
}
|
||||||
@@ -1715,6 +1756,10 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
return "SUITE_B";
|
return "SUITE_B";
|
||||||
} else if (security == SECURITY_OWE) {
|
} else if (security == SECURITY_OWE) {
|
||||||
return "OWE";
|
return "OWE";
|
||||||
|
} else if (security == SECURITY_PSK_SAE_TRANSITION) {
|
||||||
|
return "PSK+SAE";
|
||||||
|
} else if (security == SECURITY_OWE_TRANSITION) {
|
||||||
|
return "OWE_TRANSITION";
|
||||||
}
|
}
|
||||||
return "NONE";
|
return "NONE";
|
||||||
}
|
}
|
||||||
@@ -1892,16 +1937,4 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Lets the caller know if the network was cloned from another network
|
|
||||||
*
|
|
||||||
* @return true if the network is cloned
|
|
||||||
*/
|
|
||||||
public boolean isCloned() {
|
|
||||||
if (mConfig == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return mConfig.clonedNetworkConfigKey != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,7 +384,12 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
public void setSecurityParams(@SecurityType int securityType) {
|
public void setSecurityParams(@SecurityType int securityType) {
|
||||||
// Clear all the bitsets.
|
// Clear all the bitsets.
|
||||||
allowedKeyManagement.clear();
|
allowedKeyManagement.clear();
|
||||||
|
allowedProtocols.clear();
|
||||||
allowedAuthAlgorithms.clear();
|
allowedAuthAlgorithms.clear();
|
||||||
|
allowedPairwiseCiphers.clear();
|
||||||
|
allowedGroupCiphers.clear();
|
||||||
|
allowedGroupManagementCiphers.clear();
|
||||||
|
allowedSuiteBCiphers.clear();
|
||||||
|
|
||||||
switch (securityType) {
|
switch (securityType) {
|
||||||
case SECURITY_TYPE_OPEN:
|
case SECURITY_TYPE_OPEN:
|
||||||
@@ -407,9 +412,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
requirePMF = true;
|
requirePMF = true;
|
||||||
break;
|
break;
|
||||||
case SECURITY_TYPE_EAP_SUITE_B:
|
case SECURITY_TYPE_EAP_SUITE_B:
|
||||||
allowedGroupCiphers.clear();
|
|
||||||
allowedGroupManagementCiphers.clear();
|
|
||||||
allowedSuiteBCiphers.clear();
|
|
||||||
allowedKeyManagement.set(WifiConfiguration.KeyMgmt.SUITE_B_192);
|
allowedKeyManagement.set(WifiConfiguration.KeyMgmt.SUITE_B_192);
|
||||||
allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
|
allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
|
||||||
allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher.BIP_GMAC_256);
|
allowedGroupManagementCiphers.set(WifiConfiguration.GroupMgmtCipher.BIP_GMAC_256);
|
||||||
@@ -944,12 +946,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public int meteredOverride = METERED_OVERRIDE_NONE;
|
public int meteredOverride = METERED_OVERRIDE_NONE;
|
||||||
|
|
||||||
/**
|
|
||||||
* This Wifi configuration is a clone of another network with lower security
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public String clonedNetworkConfigKey;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blend together all the various opinions to decide if the given network
|
* Blend together all the various opinions to decide if the given network
|
||||||
* should be considered metered or not.
|
* should be considered metered or not.
|
||||||
@@ -1808,7 +1804,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
shared = true;
|
shared = true;
|
||||||
dtimInterval = 0;
|
dtimInterval = 0;
|
||||||
mRandomizedMacAddress = MacAddress.fromString(WifiInfo.DEFAULT_MAC_ADDRESS);
|
mRandomizedMacAddress = MacAddress.fromString(WifiInfo.DEFAULT_MAC_ADDRESS);
|
||||||
clonedNetworkConfigKey = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2376,7 +2371,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
|
|
||||||
/** copy constructor {@hide} */
|
/** copy constructor {@hide} */
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
|
||||||
public WifiConfiguration(WifiConfiguration source) {
|
public WifiConfiguration(WifiConfiguration source) {
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
networkId = source.networkId;
|
networkId = source.networkId;
|
||||||
@@ -2460,7 +2454,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
requirePMF = source.requirePMF;
|
requirePMF = source.requirePMF;
|
||||||
updateIdentifier = source.updateIdentifier;
|
updateIdentifier = source.updateIdentifier;
|
||||||
carrierId = source.carrierId;
|
carrierId = source.carrierId;
|
||||||
clonedNetworkConfigKey = source.clonedNetworkConfigKey;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2536,7 +2529,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
dest.writeInt(osu ? 1 : 0);
|
dest.writeInt(osu ? 1 : 0);
|
||||||
dest.writeLong(randomizedMacExpirationTimeMs);
|
dest.writeLong(randomizedMacExpirationTimeMs);
|
||||||
dest.writeInt(carrierId);
|
dest.writeInt(carrierId);
|
||||||
dest.writeString(clonedNetworkConfigKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface {@hide} */
|
/** Implement the Parcelable interface {@hide} */
|
||||||
@@ -2614,7 +2606,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
config.osu = in.readInt() != 0;
|
config.osu = in.readInt() != 0;
|
||||||
config.randomizedMacExpirationTimeMs = in.readLong();
|
config.randomizedMacExpirationTimeMs = in.readLong();
|
||||||
config.carrierId = in.readInt();
|
config.carrierId = in.readInt();
|
||||||
config.clonedNetworkConfigKey = in.readString();
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user