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
This commit is contained in:
Roshan Pius 2019-09-13 10:20:13 -07:00
parent 641a6834ba
commit c3b87926fb
4 changed files with 1 additions and 41 deletions

View File

@ -108,8 +108,6 @@ interface IWifiManager
int getWifiEnabledState();
void setCountryCode(String country);
String getCountryCode();
boolean isDualBandSupported();

View File

@ -2489,25 +2489,6 @@ public class WifiManager {
return false;
}
/**
* 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.

View File

@ -205,7 +205,7 @@ public class BaseWifiService extends IWifiManager.Stub {
throw new UnsupportedOperationException();
}
@Override
/** @removed */
public void setCountryCode(String country) {
throw new UnsupportedOperationException();
}

View File

@ -972,25 +972,6 @@ public class WifiManagerTest {
verify(mWifiService).stopWatchLocalOnlyHotspot();
}
/**
* 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.