Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8561aa32 authored by Ecco Park's avatar Ecco Park
Browse files

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



This API is required to support control of OSU Service Providers with
scan results on Setting UI.
Internally, previous API is merged into new API to take a list of
ScanResult Objects instead of a single ScanResult.

Bug: 119514793
Test: ./frameworks/base/wifi/tests/runtests.sh
Change-Id: Ib2f2e406c8c295c83924e7884657b4088dd23bb3
Signed-off-by: default avatarEcco Park <eccopark@google.com>
parent 33ac9a43
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3641,6 +3641,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();
+1 −1
Original line number Diff line number Diff line
@@ -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);

+7 −5
Original line number Diff line number Diff line
@@ -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();
        }
+13 −1
Original line number Diff line number Diff line
@@ -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();
+3 −3
Original line number Diff line number Diff line
@@ -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));
    }
}