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

Commit abdd22ca authored by Ahmed ElArabawy's avatar Ahmed ElArabawy Committed by Android (Google) Code Review
Browse files

Merge "Wifi: Replace dual_band with 5GHz band support"

parents ee18560f 9f8d8061
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -5672,7 +5672,6 @@ package android.net.wifi {
    method public boolean isApMacRandomizationSupported();
    method public boolean isConnectedMacRandomizationSupported();
    method @Deprecated public boolean isDeviceToDeviceRttSupported();
    method public boolean isDualBandSupported();
    method @RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS) public boolean isDualModeSupported();
    method public boolean isPortableHotspotSupported();
    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isWifiApEnabled();
+3 −1
Original line number Diff line number Diff line
@@ -108,7 +108,9 @@ interface IWifiManager

    String getCountryCode();

    boolean isDualBandSupported();
    boolean is5GHzBandSupported();

    boolean is6GHzBandSupported();

    boolean needs5GHzToAnyApBandConversion();

+25 −35
Original line number Diff line number Diff line
@@ -2156,8 +2156,6 @@ public class WifiManager {
    /** @hide */
    public static final long WIFI_FEATURE_INFRA            = 0x0001L;  // Basic infrastructure mode
    /** @hide */
    public static final long WIFI_FEATURE_INFRA_5G         = 0x0002L;  // Support for 5 GHz Band
    /** @hide */
    public static final long WIFI_FEATURE_PASSPOINT        = 0x0004L;  // Support for GAS/ANQP
    /** @hide */
    public static final long WIFI_FEATURE_P2P              = 0x0008L;  // Wifi-Direct
@@ -2227,8 +2225,6 @@ public class WifiManager {
    public static final long WIFI_FEATURE_MBO              = 0x800000000L; // MBO Support
    /** @hide */
    public static final long WIFI_FEATURE_OCE              = 0x1000000000L; // OCE Support
    /** @hide */
    public static final long WIFI_FEATURE_INFRA_6G         = 0x2000000000L; // Support 6 GHz band

    private long getSupportedFeatures() {
        try {
@@ -2242,21 +2238,6 @@ public class WifiManager {
        return (getSupportedFeatures() & feature) == feature;
    }

    /**
     * @return true if this adapter supports 5 GHz band
     */
    public boolean is5GHzBandSupported() {
        return isFeatureSupported(WIFI_FEATURE_INFRA_5G);
    }

    /**
     * @return true if the device supports operating in the 6 GHz band and Wi-Fi is enabled,
     *         false otherwise.
     */
    public boolean is6GHzBandSupported() {
        return isFeatureSupported(WIFI_FEATURE_INFRA_6G);
    }

   /**
     * @return true if this adapter supports Passpoint
     * @hide
@@ -2378,6 +2359,30 @@ public class WifiManager {
        return isFeatureSupported(WIFI_FEATURE_AP_RAND_MAC);
    }

    /**
     * Check if the chipset supports 5GHz band.
     * @return {@code true} if supported, {@code false} otherwise.
     */
    public boolean is5GHzBandSupported() {
        try {
            return mService.is5GHzBandSupported();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Check if the chipset supports 6GHz band.
     * @return {@code true} if supported, {@code false} otherwise.
     */
    public boolean is6GHzBandSupported() {
        try {
            return mService.is6GHzBandSupported();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Interface for Wi-Fi activity energy info listener. Should be implemented by applications and
     * set when calling {@link WifiManager#getWifiActivityEnergyInfoAsync}.
@@ -2591,21 +2596,6 @@ public class WifiManager {
        }
    }

    /**
     * Check if the chipset supports dual frequency band (2.4 GHz and 5 GHz).
     * No permissions are required to call this method.
     * @return {@code true} if supported, {@code false} otherwise.
     * @hide
     */
    @SystemApi
    public boolean isDualBandSupported() {
        try {
            return mService.isDualBandSupported();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Check if the device is dual mode capable i.e. supports concurrent STA + Soft AP.
     *
+12 −1
Original line number Diff line number Diff line
@@ -226,11 +226,22 @@ public class BaseWifiService extends IWifiManager.Stub {
        throw new UnsupportedOperationException();
    }

    @Override
    /** @deprecated use {@link #is5GHzBandSupported} instead */
    @Deprecated
    public boolean isDualBandSupported() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean is5GHzBandSupported() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean is6GHzBandSupported() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean needs5GHzToAnyApBandConversion() {
        throw new UnsupportedOperationException();
+15 −7
Original line number Diff line number Diff line
@@ -1696,8 +1696,6 @@ public class WifiManagerTest {
        assertTrue(mWifiManager.isPasspointSupported());
        assertTrue(mWifiManager.isP2pSupported());
        assertFalse(mWifiManager.isPortableHotspotSupported());
        assertFalse(mWifiManager.is5GHzBandSupported());
        assertFalse(mWifiManager.is6GHzBandSupported());
        assertFalse(mWifiManager.isDeviceToDeviceRttSupported());
        assertFalse(mWifiManager.isDeviceToApRttSupported());
        assertFalse(mWifiManager.isPreferredNetworkOffloadSupported());
@@ -1782,13 +1780,23 @@ public class WifiManagerTest {
    }

    /**
     * Test behavior of {@link WifiManager#isDualBandSupported()}
     * Test behavior of {@link WifiManager#is5GHzBandSupported()}
     */
    @Test
    public void testIsDualBandSupported() throws Exception {
        when(mWifiService.isDualBandSupported()).thenReturn(true);
        assertTrue(mWifiManager.isDualBandSupported());
        verify(mWifiService).isDualBandSupported();
    public void testIs5GHzBandSupported() throws Exception {
        when(mWifiService.is5GHzBandSupported()).thenReturn(true);
        assertTrue(mWifiManager.is5GHzBandSupported());
        verify(mWifiService).is5GHzBandSupported();
    }

    /**
     * Test behavior of {@link WifiManager#is6GHzBandSupported()}
     */
    @Test
    public void testIs6GHzBandSupported() throws Exception {
        when(mWifiService.is6GHzBandSupported()).thenReturn(true);
        assertTrue(mWifiManager.is6GHzBandSupported());
        verify(mWifiService).is6GHzBandSupported();
    }

    /**