From e8fd83b34e2d7e7ac275fef0baa1f33b9982a0b1 Mon Sep 17 00:00:00 2001 From: Peter Qiu Date: Mon, 20 Mar 2017 13:55:52 -0700 Subject: hotspot2: request ANQP element for OSU Providers Ideally, we would only want to request OSU Providers ANQP element when no provider is installed and request all elements when at least one provider is installed. However, this would result in more complexity on the cache management and the code. Since the ANQP results will cached, the traffic hits should be minimized. This can be optimized in the future if needed to. Bug: 36174048 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: Ie948caf4f37b2ff206271bd1d34d14fc2061ead6 --- .../server/wifi/hotspot2/ANQPRequestManager.java | 3 ++- .../server/wifi/hotspot2/PasspointManager.java | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/hotspot2/ANQPRequestManager.java b/service/java/com/android/server/wifi/hotspot2/ANQPRequestManager.java index dfdf4ad16..a050b1606 100644 --- a/service/java/com/android/server/wifi/hotspot2/ANQPRequestManager.java +++ b/service/java/com/android/server/wifi/hotspot2/ANQPRequestManager.java @@ -77,7 +77,8 @@ public class ANQPRequestManager { private static final List R2_ANQP_BASE_SET = Arrays.asList( Constants.ANQPElementType.HSFriendlyName, Constants.ANQPElementType.HSWANMetrics, - Constants.ANQPElementType.HSConnCapability); + Constants.ANQPElementType.HSConnCapability, + Constants.ANQPElementType.HSOSUProviders); /** * Class to keep track of AP status for ANQP requests. diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java index f472d86db..eb2ef2281 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java @@ -18,7 +18,9 @@ package com.android.server.wifi.hotspot2; import static android.net.wifi.WifiManager.ACTION_PASSPOINT_DEAUTH_IMMINENT; import static android.net.wifi.WifiManager.ACTION_PASSPOINT_ICON; +import static android.net.wifi.WifiManager.ACTION_PASSPOINT_OSU_PROVIDERS_LIST; import static android.net.wifi.WifiManager.ACTION_PASSPOINT_SUBSCRIPTION_REMEDIATION; +import static android.net.wifi.WifiManager.EXTRA_ANQP_ELEMENT_DATA; import static android.net.wifi.WifiManager.EXTRA_BSSID_LONG; import static android.net.wifi.WifiManager.EXTRA_DELAY; import static android.net.wifi.WifiManager.EXTRA_ESS; @@ -47,6 +49,7 @@ import com.android.server.wifi.WifiKeyStore; import com.android.server.wifi.WifiNative; import com.android.server.wifi.hotspot2.anqp.ANQPElement; import com.android.server.wifi.hotspot2.anqp.Constants; +import com.android.server.wifi.hotspot2.anqp.RawByteElement; import com.android.server.wifi.util.InformationElementUtil; import com.android.server.wifi.util.ScanResultUtil; @@ -117,6 +120,18 @@ public class PasspointManager { // Add new entry to the cache. mAnqpCache.addEntry(anqpKey, anqpElements); + + // Broadcast OSU providers info. + if (anqpElements.containsKey(Constants.ANQPElementType.HSOSUProviders)) { + RawByteElement osuProviders = (RawByteElement) anqpElements.get( + Constants.ANQPElementType.HSOSUProviders); + Intent intent = new Intent(ACTION_PASSPOINT_OSU_PROVIDERS_LIST); + intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + intent.putExtra(EXTRA_BSSID_LONG, bssid); + intent.putExtra(EXTRA_ANQP_ELEMENT_DATA, osuProviders.getPayload()); + mContext.sendBroadcastAsUser(intent, UserHandle.ALL, + android.Manifest.permission.ACCESS_WIFI_STATE); + } } @Override @@ -296,11 +311,6 @@ public class PasspointManager { * @return A pair of {@link PasspointProvider} and match status. */ public Pair matchProvider(ScanResult scanResult) { - // Nothing to be done if no Passpoint provider is installed. - if (mProviders.isEmpty()) { - return null; - } - // Retrieve the relevant information elements, mainly Roaming Consortium IE and Hotspot 2.0 // Vendor Specific IE. InformationElementUtil.RoamingConsortium roamingConsortium = -- cgit v1.2.3