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

Commit f75d7e6f authored by Arc Wang's avatar Arc Wang
Browse files

[Wi-Fi] Should not downgrade the security to connect an OWE access point

For an OWE transition mode AccessPoint, it returns the security
the device can support. So an OWE transition mode AP should not
be affected by the bug.

For an OWE AP and a device not supports OWE, this bug may let the
device try to connect to the OWE AP with SECURITY_NONE.

Bug: 146105831
Test: atest AccessPointTest
Change-Id: I6809aed76e399db3e3c2cbebf0bd44ebdf490755
parent a0b71f14
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1395,7 +1395,7 @@ public class AccessPoint implements Comparable<AccessPoint> {
        mConfig = new WifiConfiguration();
        mConfig.SSID = AccessPoint.convertToQuotedString(ssid);

        if (security == SECURITY_NONE || !getWifiManager().isEasyConnectSupported()) {
        if (security == SECURITY_NONE) {
            mConfig.allowedKeyManagement.set(KeyMgmt.NONE);
        } else {
            mConfig.allowedKeyManagement.set(KeyMgmt.OWE);
+17 −0
Original line number Diff line number Diff line
@@ -1713,4 +1713,21 @@ public class AccessPointTest {
                .setScanResults(new ArrayList<ScanResult>(Arrays.asList(scanResult)))
                .build();
    }

    @Test
    public void testGenerateOpenNetworkConfig_oweNotSupported_shouldGetCorrectSecurity() {
        when(mMockContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mMockWifiManager);
        AccessPoint oweAccessPoint = new TestAccessPointBuilder(mMockContext)
                .setSecurity(AccessPoint.SECURITY_OWE).build();
        AccessPoint noneAccessPoint = new TestAccessPointBuilder(mMockContext)
                .setSecurity(AccessPoint.SECURITY_NONE).build();

        oweAccessPoint.generateOpenNetworkConfig();
        noneAccessPoint.generateOpenNetworkConfig();

        assertThat(oweAccessPoint.getConfig().allowedKeyManagement.get(KeyMgmt.NONE)).isFalse();
        assertThat(oweAccessPoint.getConfig().allowedKeyManagement.get(KeyMgmt.OWE)).isTrue();
        assertThat(noneAccessPoint.getConfig().allowedKeyManagement.get(KeyMgmt.NONE)).isTrue();
        assertThat(noneAccessPoint.getConfig().allowedKeyManagement.get(KeyMgmt.OWE)).isFalse();
    }
}