Merge "passpoint-r2: define getMatchingOsuProviders(List<ScanResult>) API"

This commit is contained in:
TreeHugger Robot
2018-11-16 22:32:53 +00:00
committed by Android (Google) Code Review
5 changed files with 25 additions and 10 deletions

View File

@@ -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<android.net.wifi.WifiConfiguration> getAllMatchingWifiConfigs(java.util.List<android.net.wifi.ScanResult>);
method public java.util.List<android.net.wifi.hotspot2.OsuProvider> getMatchingOsuProviders(java.util.List<android.net.wifi.ScanResult>);
method public java.util.List<android.net.wifi.WifiConfiguration> getPrivilegedConfiguredNetworks();
method public android.net.wifi.WifiConfiguration getWifiApConfiguration();
method public int getWifiApState();

View File

@@ -63,7 +63,7 @@ interface IWifiManager
List<WifiConfiguration> getAllMatchingWifiConfigs(in List<ScanResult> scanResult);
List<OsuProvider> getMatchingOsuProviders(in ScanResult scanResult);
List<OsuProvider> getMatchingOsuProviders(in List<ScanResult> scanResult);
int addOrUpdateNetwork(in WifiConfiguration config, String packageName);

View File

@@ -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<OsuProvider> getMatchingOsuProviders(ScanResult scanResult) {
public List<OsuProvider> getMatchingOsuProviders(List<ScanResult> scanResults) {
try {
return mService.getMatchingOsuProviders(scanResult);
return mService.getMatchingOsuProviders(scanResults);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -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<OsuProvider> getMatchingOsuProviders(ScanResult scanResult) {
throw new UnsupportedOperationException();
}
@Override
public List<OsuProvider> getMatchingOsuProviders(List<ScanResult> scanResults) {
throw new UnsupportedOperationException();
}
@Override
public int addOrUpdateNetwork(WifiConfiguration config, String packageName) {
throw new UnsupportedOperationException();

View File

@@ -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));
}
}