Loading core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.res.Resources; import android.database.Cursor; import android.database.SQLException; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.BatteryManager; import android.os.Bundle; import android.os.RemoteException; Loading Loading @@ -2834,6 +2835,16 @@ public final class Settings { */ public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; /** * The operational wifi frequency band * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} * * @hide */ public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; /** * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile * data connectivity to be established after a disconnect from Wi-Fi. Loading core/res/res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,8 @@ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" --> <string translatable="false" name="config_tether_apndata"></string> <!-- Boolean indicating whether the wifi chipset has dual frequency band support --> <bool translatable="false" name="config_wifi_dual_band_support">false</bool> <!-- Flag indicating whether the keyguard should be bypassed when the slider is open. This can be set or unset depending how easily Loading services/java/com/android/server/WifiService.java +32 −0 Original line number Diff line number Diff line Loading @@ -732,6 +732,38 @@ public class WifiService extends IWifiManager.Stub { mWifiStateMachine.setCountryCode(countryCode, persist); } /** * Set the operational frequency band * @param band One of * {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ}, * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}, * @param persist {@code true} if the setting should be remembered. * */ public void setFrequencyBand(int band, boolean persist) { enforceChangePermission(); if (!isDualBandSupported()) return; Slog.i(TAG, "WifiService trying to set frequency band to " + band + " with persist set to " + persist); mWifiStateMachine.setFrequencyBand(band, persist); } /** * Get the operational frequency band */ public int getFrequencyBand() { enforceAccessPermission(); return mWifiStateMachine.getFrequencyBand(); } public boolean isDualBandSupported() { //TODO: Should move towards adding a driver API that checks at runtime return mContext.getResources().getBoolean( com.android.internal.R.bool.config_wifi_dual_band_support); } /** * Return the DHCP-assigned addresses from the last successful DHCP request, * if any. Loading wifi/java/android/net/wifi/IWifiManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,12 @@ interface IWifiManager void setCountryCode(String country, boolean persist); void setFrequencyBand(int band, boolean persist); int getFrequencyBand(); boolean isDualBandSupported(); boolean saveConfiguration(); DhcpInfo getDhcpInfo(); Loading wifi/java/android/net/wifi/WifiManager.java +65 −1 Original line number Diff line number Diff line Loading @@ -373,6 +373,25 @@ public class WifiManager { /** Anything better than or equal to this will show the max bars. */ private static final int MAX_RSSI = -55; /** * Auto settings in the driver. The driver could choose to operate on both * 2.4 GHz and 5 GHz or make a dynamic decision on selecting the band. * @hide */ public static final int WIFI_FREQUENCY_BAND_AUTO = 0; /** * Operation on 5 GHz alone * @hide */ public static final int WIFI_FREQUENCY_BAND_5GHZ = 1; /** * Operation on 2.4 GHz alone * @hide */ public static final int WIFI_FREQUENCY_BAND_2GHZ = 2; IWifiManager mService; Handler mHandler; Loading Loading @@ -684,6 +703,51 @@ public class WifiManager { } catch (RemoteException e) { } } /** * Set the operational frequency band. * @param band One of * {@link #WIFI_FREQUENCY_BAND_AUTO}, * {@link #WIFI_FREQUENCY_BAND_5GHZ}, * {@link #WIFI_FREQUENCY_BAND_2GHZ}, * @param persist {@code true} if this needs to be remembered * @hide */ public void setFrequencyBand(int band, boolean persist) { try { mService.setFrequencyBand(band, persist); } catch (RemoteException e) { } } /** * Get the operational frequency band. * @return One of * {@link #WIFI_FREQUENCY_BAND_AUTO}, * {@link #WIFI_FREQUENCY_BAND_5GHZ}, * {@link #WIFI_FREQUENCY_BAND_2GHZ} or * {@code -1} on failure. * @hide */ public int getFrequencyBand() { try { return mService.getFrequencyBand(); } catch (RemoteException e) { return -1; } } /** * Check if the chipset supports dual frequency band (2.4 GHz and 5 GHz) * @return {@code true} if supported, {@code false} otherwise. * @hide */ public boolean isDualBandSupported() { try { return mService.isDualBandSupported(); } catch (RemoteException e) { return false; } } /** * Return the DHCP-assigned addresses from the last successful DHCP request, * if any. Loading Loading
core/java/android/provider/Settings.java +11 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.res.Resources; import android.database.Cursor; import android.database.SQLException; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.BatteryManager; import android.os.Bundle; import android.os.RemoteException; Loading Loading @@ -2834,6 +2835,16 @@ public final class Settings { */ public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count"; /** * The operational wifi frequency band * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ} * * @hide */ public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band"; /** * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile * data connectivity to be established after a disconnect from Wi-Fi. Loading
core/res/res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,8 @@ note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN" --> <string translatable="false" name="config_tether_apndata"></string> <!-- Boolean indicating whether the wifi chipset has dual frequency band support --> <bool translatable="false" name="config_wifi_dual_band_support">false</bool> <!-- Flag indicating whether the keyguard should be bypassed when the slider is open. This can be set or unset depending how easily Loading
services/java/com/android/server/WifiService.java +32 −0 Original line number Diff line number Diff line Loading @@ -732,6 +732,38 @@ public class WifiService extends IWifiManager.Stub { mWifiStateMachine.setCountryCode(countryCode, persist); } /** * Set the operational frequency band * @param band One of * {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO}, * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ}, * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}, * @param persist {@code true} if the setting should be remembered. * */ public void setFrequencyBand(int band, boolean persist) { enforceChangePermission(); if (!isDualBandSupported()) return; Slog.i(TAG, "WifiService trying to set frequency band to " + band + " with persist set to " + persist); mWifiStateMachine.setFrequencyBand(band, persist); } /** * Get the operational frequency band */ public int getFrequencyBand() { enforceAccessPermission(); return mWifiStateMachine.getFrequencyBand(); } public boolean isDualBandSupported() { //TODO: Should move towards adding a driver API that checks at runtime return mContext.getResources().getBoolean( com.android.internal.R.bool.config_wifi_dual_band_support); } /** * Return the DHCP-assigned addresses from the last successful DHCP request, * if any. Loading
wifi/java/android/net/wifi/IWifiManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,12 @@ interface IWifiManager void setCountryCode(String country, boolean persist); void setFrequencyBand(int band, boolean persist); int getFrequencyBand(); boolean isDualBandSupported(); boolean saveConfiguration(); DhcpInfo getDhcpInfo(); Loading
wifi/java/android/net/wifi/WifiManager.java +65 −1 Original line number Diff line number Diff line Loading @@ -373,6 +373,25 @@ public class WifiManager { /** Anything better than or equal to this will show the max bars. */ private static final int MAX_RSSI = -55; /** * Auto settings in the driver. The driver could choose to operate on both * 2.4 GHz and 5 GHz or make a dynamic decision on selecting the band. * @hide */ public static final int WIFI_FREQUENCY_BAND_AUTO = 0; /** * Operation on 5 GHz alone * @hide */ public static final int WIFI_FREQUENCY_BAND_5GHZ = 1; /** * Operation on 2.4 GHz alone * @hide */ public static final int WIFI_FREQUENCY_BAND_2GHZ = 2; IWifiManager mService; Handler mHandler; Loading Loading @@ -684,6 +703,51 @@ public class WifiManager { } catch (RemoteException e) { } } /** * Set the operational frequency band. * @param band One of * {@link #WIFI_FREQUENCY_BAND_AUTO}, * {@link #WIFI_FREQUENCY_BAND_5GHZ}, * {@link #WIFI_FREQUENCY_BAND_2GHZ}, * @param persist {@code true} if this needs to be remembered * @hide */ public void setFrequencyBand(int band, boolean persist) { try { mService.setFrequencyBand(band, persist); } catch (RemoteException e) { } } /** * Get the operational frequency band. * @return One of * {@link #WIFI_FREQUENCY_BAND_AUTO}, * {@link #WIFI_FREQUENCY_BAND_5GHZ}, * {@link #WIFI_FREQUENCY_BAND_2GHZ} or * {@code -1} on failure. * @hide */ public int getFrequencyBand() { try { return mService.getFrequencyBand(); } catch (RemoteException e) { return -1; } } /** * Check if the chipset supports dual frequency band (2.4 GHz and 5 GHz) * @return {@code true} if supported, {@code false} otherwise. * @hide */ public boolean isDualBandSupported() { try { return mService.isDualBandSupported(); } catch (RemoteException e) { return false; } } /** * Return the DHCP-assigned addresses from the last successful DHCP request, * if any. Loading