Support "don't ask again" in the avoid bad wifi dialog.
This contains the following changes: 1. Make NETWORK_AVOID_BAD_WIFI a tristate: 0 means never avoid bad wifi, unset means prompt the user, 1 means always avoid. 2. Look at NETWORK_AVOID_BAD_WIFI only if the carrier restricts avoiding bad wifi (previously, we relied on the setting being null and defaulting to the value of the config variable). 3. Add an avoidUnvalidated bit to NetworkAgentInfo to track whether the user has requested switching away from this unvalidated network even though avoiding bad wifi is generally disabled. This is set to true when the user selects "switch" in the dialog without setting the "Don't ask again" checkbox. 4. Add a hidden setAvoidUnvalidated API to ConnectivityManager to set the avoidUnvalidated bit. 5. Additional unit test coverage. Bug: 31075769 Change-Id: I1be60c3016c8095df3c4752330149ce638bd0ce1
This commit is contained in:
@@ -3197,6 +3197,27 @@ public class ConnectivityManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs the system to penalize {@code network}'s score when it becomes unvalidated. This is
|
||||
* only meaningful if the system is configured not to penalize such networks, e.g., if the
|
||||
* {@code config_networkAvoidBadWifi} configuration variable is set to 0 and the {@code
|
||||
* NETWORK_AVOID_BAD_WIFI setting is unset}.
|
||||
*
|
||||
* <p>This method requires the caller to hold the permission
|
||||
* {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}
|
||||
*
|
||||
* @param network The network to accept.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void setAvoidUnvalidated(Network network) {
|
||||
try {
|
||||
mService.setAvoidUnvalidated(network);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all connectivity manager settings back to factory defaults.
|
||||
* @hide
|
||||
|
||||
@@ -161,6 +161,7 @@ interface IConnectivityManager
|
||||
void releaseNetworkRequest(in NetworkRequest networkRequest);
|
||||
|
||||
void setAcceptUnvalidated(in Network network, boolean accept, boolean always);
|
||||
void setAvoidUnvalidated(in Network network);
|
||||
|
||||
int getRestoreDefaultNetworkDelay(int networkType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user