Added AccessPoint.matches(AccessPoint) method to match AP objects

Previously there was no single method to match two AccessPoint objects
that represent the same method. This provides a clear method to match
AccessPoints of the same network (especially Passpoint networks).

Test: atest AccessPointTest
Bug: 130373102

Change-Id: I14eae0e331a5253f4be52c2835b5629172ca23ba
This commit is contained in:
Quang Luong
2019-04-15 14:15:25 -07:00
parent 37da9859f6
commit eafca1bbba

View File

@@ -337,6 +337,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
mContext = context;
networkId = config.networkId;
mConfig = config;
mFqdn = config.FQDN;
setScanResultsPasspoint(homeScans, roamingScans);
updateKey();
}
@@ -673,6 +674,13 @@ public class AccessPoint implements Comparable<AccessPoint> {
return mKey;
}
/**
* Determines if the other AccessPoint represents the same network as this AccessPoint
*/
public boolean matches(AccessPoint other) {
return getKey().equals(other.getKey());
}
public boolean matches(WifiConfiguration config) {
if (config.isPasspoint()) {
return (isPasspoint() && config.FQDN.equals(mConfig.FQDN));