diff --git a/api/system-current.txt b/api/system-current.txt index 6d3abe9813d1a..4bd6220b1377f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3642,6 +3642,7 @@ package android.net.wifi { public class WifiManager { method public void connect(android.net.wifi.WifiConfiguration, android.net.wifi.WifiManager.ActionListener); method public java.util.List getAllMatchingWifiConfigs(java.util.List); + method public java.util.List getMatchingOsuProviders(java.util.List); method public java.util.List getPrivilegedConfiguredNetworks(); method public android.net.wifi.WifiConfiguration getWifiApConfiguration(); method public int getWifiApState(); diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 7ca3c53154aab..92f60ef00cd22 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -63,7 +63,7 @@ interface IWifiManager List getAllMatchingWifiConfigs(in List scanResult); - List getMatchingOsuProviders(in ScanResult scanResult); + List getMatchingOsuProviders(in List scanResult); int addOrUpdateNetwork(in WifiConfiguration config, String packageName); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 4b6f5fac408ab..f934380be9bc1 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1095,19 +1095,21 @@ public class WifiManager { } /** - * Returns a list of Hotspot 2.0 OSU (Online Sign-Up) providers associated with the given AP. + * Returns a list of unique Hotspot 2.0 OSU (Online Sign-Up) providers associated with a given + * list of ScanResult. * * An empty list will be returned if no match is found. * - * @param scanResult scanResult that represents the BSSID - * @return list of {@link OsuProvider} + * @param scanResults a list of ScanResult + * @return A list of {@link OsuProvider} that does not contain duplicate entries. * @throws UnsupportedOperationException if Passpoint is not enabled on the device. * @hide */ + @SystemApi @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) - public List getMatchingOsuProviders(ScanResult scanResult) { + public List getMatchingOsuProviders(List scanResults) { try { - return mService.getMatchingOsuProviders(scanResult); + return mService.getMatchingOsuProviders(scanResults); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/wifi/java/com/android/server/wifi/AbstractWifiService.java b/wifi/java/com/android/server/wifi/AbstractWifiService.java index 6cdef50515246..e5324285c4871 100644 --- a/wifi/java/com/android/server/wifi/AbstractWifiService.java +++ b/wifi/java/com/android/server/wifi/AbstractWifiService.java @@ -108,11 +108,23 @@ public abstract class AbstractWifiService extends IWifiManager.Stub { throw new UnsupportedOperationException(); } - @Override + /** + * Returns a list of Hotspot 2.0 OSU (Online Sign-Up) providers associated with the given AP. + * + * @param scanResult a single ScanResult Object + * @return + * @deprecated use {@link #getMatchingOsuProviders(List)} instead. + */ + @Deprecated public List getMatchingOsuProviders(ScanResult scanResult) { throw new UnsupportedOperationException(); } + @Override + public List getMatchingOsuProviders(List scanResults) { + throw new UnsupportedOperationException(); + } + @Override public int addOrUpdateNetwork(WifiConfiguration config, String packageName) { throw new UnsupportedOperationException(); diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java index ecf65c9d29052..a3deb9337139f 100644 --- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java +++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java @@ -1278,12 +1278,12 @@ i * Verify that a call to cancel WPS immediately returns a failure. /** * Check the call to getMatchingOsuProviders calls getMatchingOsuProviders of WifiService - * with the provided a single ScanResult. + * with the provided a list of ScanResult. */ @Test public void testGetMatchingOsuProviders() throws Exception { - mWifiManager.getMatchingOsuProviders(new ScanResult()); + mWifiManager.getMatchingOsuProviders(new ArrayList<>()); - verify(mWifiService).getMatchingOsuProviders(any(ScanResult.class)); + verify(mWifiService).getMatchingOsuProviders(any(List.class)); } }