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

Commit 9434c534 authored by Ecco Park's avatar Ecco Park
Browse files

passpoint-r2: change return type of getAllMatchingWifiConfigs



It is to get the scanresults per home or roaming network type for
matching PasspointProfile.
With this, UI is able to connect to an AP based on the following priority.
1) Home network
2) Roaming network

Bug: 119514793
Test: ./frameworks/base/wifi/tests/runtests.sh
Change-Id: I88cacddc072d04e478536276dee411ecc63ced52
Signed-off-by: default avatarEcco Park <eccopark@google.com>
parent a45875b3
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -234,6 +234,12 @@ public class WifiManager {
    @SystemApi
    public static final int WIFI_CREDENTIAL_FORGOT = 1;

    /** @hide */
    public static final int PASSPOINT_HOME_NETWORK = 0;

    /** @hide */
    public static final int PASSPOINT_ROAMING_NETWORK = 1;

    /**
     * Broadcast intent action indicating that a Passpoint provider icon has been received.
     *
@@ -1207,26 +1213,30 @@ public class WifiManager {
     * match the ScanResult.
     *
     * @param scanResults a list of scanResult that represents the BSSID
     * @return List that consists of {@link WifiConfiguration} and corresponding scanResults.
     * @return List that consists of {@link WifiConfiguration} and corresponding scanResults per
     * network type({@link #PASSPOINT_HOME_NETWORK} and {@link #PASSPOINT_ROAMING_NETWORK}).
     * @throws UnsupportedOperationException if Passpoint is not enabled on the device.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
    public List<Pair<WifiConfiguration, List<ScanResult>>> getAllMatchingWifiConfigs(
    public List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>> getAllMatchingWifiConfigs(
            @NonNull List<ScanResult> scanResults) {
        List<Pair<WifiConfiguration, List<ScanResult>>> configs = new ArrayList<>();
        List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>> configs = new ArrayList<>();
        try {
            Map<String, List<ScanResult>> results = mService.getAllMatchingFqdnsForScanResults(
            Map<String, Map<Integer, List<ScanResult>>> results =
                    mService.getAllMatchingFqdnsForScanResults(
                            scanResults);
            if (results.isEmpty()) {
                return configs;
            }
            List<WifiConfiguration> wifiConfigurations =
                    mService.getWifiConfigsForPasspointProfiles(new ArrayList<>(results.keySet()));
                    mService.getWifiConfigsForPasspointProfiles(
                            new ArrayList<>(results.keySet()));
            for (WifiConfiguration configuration : wifiConfigurations) {
                List<ScanResult> scanResultList = results.get(configuration.FQDN);
                if (scanResultList != null) {
                    configs.add(Pair.create(configuration, scanResultList));
                Map<Integer, List<ScanResult>> scanResultsPerNetworkType = results.get(
                        configuration.FQDN);
                if (scanResultsPerNetworkType != null) {
                    configs.add(Pair.create(configuration, scanResultsPerNetworkType));
                }
            }
        } catch (RemoteException e) {
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ public class BaseWifiService extends IWifiManager.Stub {
    }

    @Override
    public Map<String, List<ScanResult>> getAllMatchingFqdnsForScanResults(
    public Map<String, Map<Integer, List<ScanResult>>> getAllMatchingFqdnsForScanResults(
            List<ScanResult> scanResults) {
        throw new UnsupportedOperationException();
    }