summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorPeter Qiu <zqiu@google.com>2017-06-06 14:30:47 -0700
committerPeter Qiu <zqiu@google.com>2017-06-13 16:11:16 +0000
commitb26271a52b97ea0a028351a3eef95d53f9339de3 (patch)
treeb4a5f50f0af2ec70a23e35f0cd2117298acf448c /service
parentac4ab1bfb7f7cdd4e1d9dd9eb8107aef1b960df2 (diff)
WifiServiceImpl: add support for retrieving Hotspot 2.0 OSU providers
For an R2 Passpoint AP, there might be zero or more OSU providers associated it. Add an API to retrieve the associated OSU providers. Bug: 62235301 Test: manual test by exercising this API in WifiTracker and verify the content of the OSU provider Change-Id: I5d9b7d86176bccf39a44f4a39e7f273c2bc2a210 Merged-In: I5d9b7d86176bccf39a44f4a39e7f273c2bc2a210
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java18
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java27
2 files changed, 45 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index d3f5b13de..1dbc1bd89 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -73,6 +73,7 @@ import android.net.wifi.WifiLinkLayerStats;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiManager.LocalOnlyHotspotCallback;
import android.net.wifi.WifiScanner;
+import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.AsyncTask;
import android.os.BatteryStats;
@@ -1527,6 +1528,23 @@ public class WifiServiceImpl extends IWifiManager.Stub {
}
/**
+ * Returns list of OSU (Online Sign-Up) providers associated with the given Passpoint network.
+ *
+ * @param scanResult scanResult of the Passpoint AP
+ * @return List of {@link OsuProvider}
+ */
+ @Override
+ public List<OsuProvider> getMatchingOsuProviders(ScanResult scanResult) {
+ enforceAccessPermission();
+ mLog.trace("getMatchingOsuProviders uid=%").c(Binder.getCallingUid()).flush();
+ if (!mContext.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI_PASSPOINT)) {
+ throw new UnsupportedOperationException("Passpoint not enabled");
+ }
+ return mWifiStateMachine.syncGetMatchingOsuProviders(scanResult, mWifiStateMachineChannel);
+ }
+
+ /**
* see {@link android.net.wifi.WifiManager#addOrUpdateNetwork(WifiConfiguration)}
* @return the supplicant-assigned identifier for the new or updated
* network if the operation succeeds, or {@code -1} if it fails
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 89675b62d..06714c72f 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -75,6 +75,7 @@ import android.net.wifi.WifiSsid;
import android.net.wifi.WpsInfo;
import android.net.wifi.WpsResult;
import android.net.wifi.WpsResult.Status;
+import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.p2p.IWifiP2pManager;
import android.os.BatteryStats;
@@ -600,6 +601,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
// Get the list of installed Passpoint configurations.
static final int CMD_GET_PASSPOINT_CONFIGS = BASE + 108;
+ // Get the list of OSU providers associated with a Passpoint network.
+ static final int CMD_GET_MATCHING_OSU_PROVIDERS = BASE + 109;
+
/* Commands from/to the SupplicantStateTracker */
/* Reset the supplicant state tracker */
static final int CMD_RESET_SUPPLICANT_STATE = BASE + 111;
@@ -1874,6 +1878,22 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
}
/**
+ * Retrieve a list of {@link OsuProvider} associated with the given AP synchronously.
+ *
+ * @param scanResult The scan result of the AP
+ * @param channel Channel for communicating with the state machine
+ * @return List of {@link OsuProvider}
+ */
+ public List<OsuProvider> syncGetMatchingOsuProviders(ScanResult scanResult,
+ AsyncChannel channel) {
+ Message resultMsg =
+ channel.sendMessageSynchronously(CMD_GET_MATCHING_OSU_PROVIDERS, scanResult);
+ List<OsuProvider> providers = (List<OsuProvider>) resultMsg.obj;
+ resultMsg.recycle();
+ return providers;
+ }
+
+ /**
* Add or update a Passpoint configuration synchronously.
*
* @param channel Channel for communicating with the state machine
@@ -3899,6 +3919,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
case CMD_GET_MATCHING_CONFIG:
replyToMessage(message, message.what);
break;
+ case CMD_GET_MATCHING_OSU_PROVIDERS:
+ replyToMessage(message, message.what, new ArrayList<OsuProvider>());
+ break;
case CMD_IP_CONFIGURATION_SUCCESSFUL:
case CMD_IP_CONFIGURATION_LOST:
case CMD_IP_REACHABILITY_LOST:
@@ -4982,6 +5005,10 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
replyToMessage(message, message.what,
mPasspointManager.getMatchingWifiConfig((ScanResult) message.obj));
break;
+ case CMD_GET_MATCHING_OSU_PROVIDERS:
+ replyToMessage(message, message.what,
+ mPasspointManager.getMatchingOsuProviders((ScanResult) message.obj));
+ break;
case CMD_RECONNECT:
mWifiConnectivityManager.forceConnectivityScan();
break;