From eafca1bbbab6edc4c986c03645545782d11029cf Mon Sep 17 00:00:00 2001 From: Quang Luong Date: Mon, 15 Apr 2019 14:15:25 -0700 Subject: [PATCH] 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 --- .../src/com/android/settingslib/wifi/AccessPoint.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java index 1976ec45bf458..d1e4fdf472c00 100644 --- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java +++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java @@ -337,6 +337,7 @@ public class AccessPoint implements Comparable { mContext = context; networkId = config.networkId; mConfig = config; + mFqdn = config.FQDN; setScanResultsPasspoint(homeScans, roamingScans); updateKey(); } @@ -673,6 +674,13 @@ public class AccessPoint implements Comparable { 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));