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

Commit d20d4b1d authored by Quang Luong's avatar Quang Luong Committed by Android (Google) Code Review
Browse files

Merge "Update Passpoint R1 AccessPoint with R2 config" into qt-dev

parents d166d21f e747f596
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1111,7 +1111,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
     * Return true if this AccessPoint represents a Passpoint provider configuration.
     */
    public boolean isPasspointConfig() {
        return mFqdn != null;
        return mFqdn != null && mConfig == null;
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -718,6 +718,7 @@ public class WifiTracker implements LifecycleObserver, OnStart, OnStop, OnDestro
        if (accessPoint == null) {
            accessPoint = new AccessPoint(mContext, config, homeScans, roamingScans);
        } else {
            accessPoint.update(config);
            accessPoint.setScanResultsPasspoint(homeScans, roamingScans);
        }
        return accessPoint;
+27 −4
Original line number Diff line number Diff line
@@ -314,7 +314,8 @@ public class WifiTrackerTest {

    private List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>>
            createPasspointMatchingWifiConfigWithScanResults(
            List<ScanResult> homeList, List<ScanResult> roamingList) {
            List<ScanResult> homeList, List<ScanResult> roamingList,
            String fqdn, String friendlyName) {
        List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>> matchingList =
                new ArrayList<>();
        Map<Integer, List<ScanResult>> mapping = new HashMap<>();
@@ -326,7 +327,7 @@ public class WifiTrackerTest {
            mapping.put(WifiManager.PASSPOINT_ROAMING_NETWORK, roamingList);
        }

        matchingList.add(new Pair(buildPasspointConfiguration(FQDN_1, PROVIDER_FRIENDLY_NAME_1),
        matchingList.add(new Pair(buildPasspointConfiguration(fqdn, friendlyName),
                mapping));

        return matchingList;
@@ -1077,7 +1078,7 @@ public class WifiTrackerTest {

        List<AccessPoint> passpointAccessPointsFirstUpdate = tracker.updatePasspointAccessPoints(
                createPasspointMatchingWifiConfigWithScanResults(Arrays.asList(result),
                        null), new ArrayList<>());
                        null, FQDN_1, PROVIDER_FRIENDLY_NAME_1), new ArrayList<>());
        List<AccessPoint> cachedAccessPoints = new ArrayList<>(passpointAccessPointsFirstUpdate);

        int prevRssi = result.level;
@@ -1086,7 +1087,7 @@ public class WifiTrackerTest {

        List<AccessPoint> passpointAccessPointsSecondUpdate = tracker.updatePasspointAccessPoints(
                createPasspointMatchingWifiConfigWithScanResults(Arrays.asList(result),
                        null), cachedAccessPoints);
                        null, FQDN_1, PROVIDER_FRIENDLY_NAME_1), cachedAccessPoints);

        // Verify second update AP is the same object as the first update AP
        assertThat(passpointAccessPointsFirstUpdate.get(0))
@@ -1096,6 +1097,28 @@ public class WifiTrackerTest {
                .isEqualTo((prevRssi + newRssi) / 2);
    }

    /**
     * Verifies that the internal WifiConfiguration of a Passpoint AccessPoint is updated
     */
    @Test
    public void updatePasspointAccessPoints_updatesConfig() {
        WifiTracker tracker = createMockedWifiTracker();

        ScanResult result = buildScanResult1();

        List<AccessPoint> passpointAccessPoints = tracker.updatePasspointAccessPoints(
                createPasspointMatchingWifiConfigWithScanResults(Arrays.asList(result),
                        null, FQDN_1, PROVIDER_FRIENDLY_NAME_1), new ArrayList<>());

        AccessPoint ap = passpointAccessPoints.get(0);
        assertEquals(ap.getTitle(), PROVIDER_FRIENDLY_NAME_1);

        tracker.updatePasspointAccessPoints(
                createPasspointMatchingWifiConfigWithScanResults(Arrays.asList(result),
                        null, FQDN_1, PROVIDER_FRIENDLY_NAME_2), passpointAccessPoints);
        assertEquals(ap.getTitle(), PROVIDER_FRIENDLY_NAME_2);
    }

    /**
     * Verifies that updateOsuAccessPoints will only return AccessPoints whose
     * isOsuProvider() evaluates as true.