From 79ec1736be23bc624f67d65195ac5ac40def8f9e Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Mon, 19 Sep 2016 14:09:42 -0700 Subject: [PATCH 1/2] Remove WifiManager#get/setFrequencyBand These methods are marked @hide and only partially implemented by the WifiService. In general, it seems wrong to strictly prefer one WiFi band over another for all WiFi operations. To reduce implementation complexity, cause setFrequencyBand to become a noop and getFrequencyBand to reflect the underlying reality, which is that we will always operate on all supported bands. Bug: 31148223 Test: Compiles Change-Id: Iccff517915f7d5ed7e96bf56e4f195b2cda80f0a --- wifi/java/android/net/wifi/IWifiManager.aidl | 4 --- wifi/java/android/net/wifi/WifiManager.java | 34 -------------------- 2 files changed, 38 deletions(-) diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 706b29495c211..a91c9491c60ab 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -97,10 +97,6 @@ interface IWifiManager String getCountryCode(); - void setFrequencyBand(int band, boolean persist); - - int getFrequencyBand(); - boolean isDualBandSupported(); boolean saveConfiguration(); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 955161cf538b1..d04a60ecdfd2a 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1375,40 +1375,6 @@ public class WifiManager { } } - /** - * 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) { - throw e.rethrowFromSystemServer(); - } - } - - /** - * 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) { - throw e.rethrowFromSystemServer(); - } - } - /** * Check if the chipset supports dual frequency band (2.4 GHz and 5 GHz) * @return {@code true} if supported, {@code false} otherwise. From 93ce63760dd09870d689176ab94db652f578d926 Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Tue, 20 Sep 2016 15:33:49 -0700 Subject: [PATCH 2/2] Remove ability to set frequency from WifiAssociationTest This is no longer a supported API. Bug: 31148223 Test: This code would no longer compile Change-Id: I2d8ee6a40eda7e0f1a266cb0579aff2e504f29a7 --- .../functional/WifiAssociationTest.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiAssociationTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiAssociationTest.java index 68f3179f96c12..23135dd156902 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiAssociationTest.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiAssociationTest.java @@ -63,11 +63,6 @@ public class WifiAssociationTest extends ConnectivityManagerTestBase { String password = arguments.getString("password"); - String freqStr = arguments.getString("frequency-band"); - if (freqStr != null) { - setFrequencyBand(freqStr); - } - assertTrue("enable Wifi failed", enableWifi()); WifiInfo wi = mWifiManager.getConnectionInfo(); logv("%s", wi); @@ -79,28 +74,6 @@ public class WifiAssociationTest extends ConnectivityManagerTestBase { connectToWifi(config); } - /** - * Set the frequency band and verify that it has been set. - */ - private void setFrequencyBand(String frequencyBandStr) { - int frequencyBand = -1; - if ("2.4".equals(frequencyBandStr)) { - frequencyBand = WifiManager.WIFI_FREQUENCY_BAND_2GHZ; - } else if ("5.0".equals(frequencyBandStr)) { - frequencyBand = WifiManager.WIFI_FREQUENCY_BAND_5GHZ; - } else if ("auto".equals(frequencyBandStr)) { - frequencyBand = WifiManager.WIFI_FREQUENCY_BAND_AUTO; - } else { - fail("Invalid frequency-band"); - } - if (mWifiManager.getFrequencyBand() != frequencyBand) { - logv("Set frequency band to %s", frequencyBandStr); - mWifiManager.setFrequencyBand(frequencyBand, true); - } - assertEquals("Specified frequency band does not match operational band", - frequencyBand, mWifiManager.getFrequencyBand()); - } - /** * Get the {@link WifiConfiguration} based on ssid, security, and password. */