Provide a way to override the avoid bad wifi configuration
ConnectivityManager.setAvoidUnvalidated only works if the config_networkAvoidBadWifi configuration is set to 0 and the NETWORK_AVOID_BAD_WIFI setting is unset. There is no easy way for a testing app to temporary set a test value to verify the behavior of the API. Thus, add a mechanism to allow test app to set a period of time to temporary unstrict the resource configuration, i.e. Temporary simulate config_networkAvoidBadWifi configured to 0. Bug: 186061922 Test: atest CtsNetTestCases FrameworksNetTests Original-Change: https://android-review.googlesource.com/1733788 Merged-In: If772078c61a9b12926f104d5dfc9c9071e844732 Change-Id: If772078c61a9b12926f104d5dfc9c9071e844732
This commit is contained in:
@@ -4721,6 +4721,22 @@ public class ConnectivityManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily allow bad wifi to override {@code config_networkAvoidBadWifi} configuration.
|
||||
*
|
||||
* @param timeMs The expired current time. The value should be set within a limited time from
|
||||
* now.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void setTestAllowBadWifiUntil(long timeMs) {
|
||||
try {
|
||||
mService.setTestAllowBadWifiUntil(timeMs);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the system open the captive portal app on the specified network.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user