summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2020-02-28 18:08:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-02-28 18:08:27 +0000
commit516660c9456c20f5b9a2b6fa139dbba43202d3d0 (patch)
tree32f38aa85614c9d4e48d1c32f1c2989fcaaef8aa
parent227e8747060bb3ebadb01834fb68c5db0572e624 (diff)
parentb25e55d892f91decd1be0bcbf6fce592a3ea636b (diff)
Merge "[Passpoint] Added support for Other Home Partners matching" into rvc-dev
-rw-r--r--service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java8
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointProvider.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java33
3 files changed, 52 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java b/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java
index dd39174df..a920c5ec1 100644
--- a/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java
+++ b/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java
@@ -40,9 +40,9 @@ public class ANQPMatcher {
*
* @param element The Domain Name ANQP element
* @param fqdn The FQDN to compare against
- * @param imsiParam The IMSI parameter of the provider
+ * @param imsiParam The IMSI parameter of the provider (needed only for IMSI matching)
* @param simImsi The IMSI from the installed SIM cards that best matched provider's
- * IMSI parameter
+ * IMSI parameter (needed only for IMSI matching)
* @return true if a match is found
*/
public static boolean matchDomainName(DomainNameElement element, String fqdn,
@@ -56,6 +56,10 @@ public class ANQPMatcher {
return true;
}
+ if (imsiParam == null || simImsi == null) {
+ continue;
+ }
+
// Try to retrieve the MCC-MNC string from the domain (for 3GPP network domain) and
// match against the provider's SIM credential.
if (matchMccMnc(Utils.getMccMnc(Utils.splitDomain(domain)), imsiParam, simImsi)) {
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java b/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java
index c8de0c499..205c71f78 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointProvider.java
@@ -711,6 +711,21 @@ public class PasspointProvider {
return PasspointMatch.HomeProvider;
}
+ // Other Home Partners matching.
+ if (mConfig.getHomeSp().getOtherHomePartners() != null) {
+ for (String otherHomePartner : mConfig.getHomeSp().getOtherHomePartners()) {
+ if (ANQPMatcher.matchDomainName(
+ (DomainNameElement) anqpElements.get(ANQPElementType.ANQPDomName),
+ otherHomePartner, null, null)) {
+ if (mVerboseLoggingEnabled) {
+ Log.d(TAG, "Other Home Partner " + otherHomePartner
+ + " match: HomeProvider");
+ }
+ return PasspointMatch.HomeProvider;
+ }
+ }
+ }
+
// ANQP Roaming Consortium OI matching.
long[] providerOIs = mConfig.getHomeSp().getRoamingConsortiumOis();
if (ANQPMatcher.matchRoamingConsortium(
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java
index c23ea3411..4ebc6bd23 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointProviderTest.java
@@ -93,6 +93,7 @@ public class PasspointProviderTest extends WifiBaseTest {
private static final int TEST_USAGE_LIMIT_DATA_LIMIT = 100;
private static final String TEST_FQDN = "test.com";
private static final String TEST_FQDN2 = "test2.com";
+ private static final String TEST_FQDN3 = "test3.com";
private static final String TEST_FRIENDLY_NAME = "Friendly Name";
private static final long[] TEST_RC_OIS = new long[] {0x1234L, 0x2345L};
private static final long[] TEST_IE_RC_OIS = new long[] {0x1234L, 0x2133L};
@@ -1392,8 +1393,8 @@ public class PasspointProviderTest extends WifiBaseTest {
}
/**
- * Verify that an expected WifiConfiguration will be returned for a Passpoint provider
- * with a user credential.
+ * Verify that a provider is a home provider when there is a match between Other Home Partners
+ * in the profile and the Domain Name ANQP element.
*
* @throws Exception
*/
@@ -1427,4 +1428,32 @@ public class PasspointProviderTest extends WifiBaseTest {
verifyWifiConfigWithTestData(config,
createProvider(config).getWifiConfig());
}
+
+ /**
+ * Verify that an expected WifiConfiguration will be returned for a Passpoint provider
+ * with a user credential.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void matchOtherPartnersDomainName() throws Exception {
+ // Setup test provider.
+ PasspointConfiguration config = generateTestPasspointConfiguration(
+ CredentialType.USER, false);
+
+ // Configuration was created with TEST_FQDN as the FQDN, add TEST_FQDN3 as other home
+ // partner.
+ HomeSp homeSp = config.getHomeSp();
+ homeSp.setOtherHomePartners(new String [] {TEST_FQDN3});
+ config.setHomeSp(homeSp);
+ mProvider = createProvider(config);
+
+ // Setup Domain Name ANQP element to TEST_FQDN2 and TEST_FQDN3
+ Map<ANQPElementType, ANQPElement> anqpElementMap = new HashMap<>();
+ anqpElementMap.put(ANQPElementType.ANQPDomName,
+ createDomainNameElement(new String[] {TEST_FQDN2, TEST_FQDN3}));
+
+ assertEquals(PasspointMatch.HomeProvider,
+ mProvider.match(anqpElementMap, mRoamingConsortium));
+ }
}