WifiManager: Remove setCountryCode API
Wifi stack will instead call existing public Telephony API/broadcast
to get the country code.
Bug: 140744935
Test: Manual tests
Test: atest android.net.wifi
Change-Id: I83be57123630c510e121f49ceadb30644e26c29c
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index c755c0f..a97a5a5 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -108,8 +108,6 @@
int getWifiEnabledState();
- void setCountryCode(String country);
-
String getCountryCode();
boolean isDualBandSupported();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 61cad48..00895e8 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -2490,25 +2490,6 @@
}
/**
- * Set the country code.
- * @param countryCode country code in ISO 3166 format.
- *
- * @hide
- */
- public void setCountryCode(@NonNull String country) {
- try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (TextUtils.isEmpty(country)) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.setCountryCode(country);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
- /**
* get the country code.
* @return the country code in ISO 3166 format.
*
diff --git a/wifi/java/com/android/server/wifi/BaseWifiService.java b/wifi/java/com/android/server/wifi/BaseWifiService.java
index 032a13e..2e82f4e 100644
--- a/wifi/java/com/android/server/wifi/BaseWifiService.java
+++ b/wifi/java/com/android/server/wifi/BaseWifiService.java
@@ -205,7 +205,7 @@
throw new UnsupportedOperationException();
}
- @Override
+ /** @removed */
public void setCountryCode(String country) {
throw new UnsupportedOperationException();
}
diff --git a/wifi/tests/src/android/net/wifi/WifiManagerTest.java b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
index 8beee57..7e7f002 100644
--- a/wifi/tests/src/android/net/wifi/WifiManagerTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiManagerTest.java
@@ -973,25 +973,6 @@
}
/**
- * Verify that calls WifiServiceImpl to set country code when no exception happens.
- */
- @Test
- public void testSetWifiCountryCode() throws Exception {
- mWifiManager.setCountryCode(TEST_COUNTRY_CODE);
- verify(mWifiService).setCountryCode(TEST_COUNTRY_CODE);
- }
-
- /**
- * Verify that WifiManager.setCountryCode() rethrows exceptions if caller does not
- * have necessary permissions.
- */
- @Test(expected = SecurityException.class)
- public void testSetWifiCountryCodeFailedOnSecurityException() throws Exception {
- doThrow(new SecurityException()).when(mWifiService).setCountryCode(anyString());
- mWifiManager.setCountryCode(TEST_COUNTRY_CODE);
- }
-
- /**
* Test that calls to get the current WPS config token return null and do not have any
* interactions with WifiServiceImpl.
*/