Merge changes from topic "bindprocess-resolv" am: af8e41c434

am: 4b8dee1177

Change-Id: I80f85170981c2f5b1ef949b5db88baf5fc101cd0
This commit is contained in:
Remi NGUYEN VAN
2019-01-31 00:19:37 -08:00
committed by android-build-merger

View File

@@ -4006,10 +4006,17 @@ public class ConnectivityManager {
@Deprecated
public static boolean setProcessDefaultNetwork(@Nullable Network network) {
int netId = (network == null) ? NETID_UNSET : network.netId;
if (netId == NetworkUtils.getBoundNetworkForProcess()) {
return true;
boolean isSameNetId = (netId == NetworkUtils.getBoundNetworkForProcess());
if (netId != NETID_UNSET) {
netId = network.getNetIdForResolv();
}
if (NetworkUtils.bindProcessToNetwork(netId)) {
if (!NetworkUtils.bindProcessToNetwork(netId)) {
return false;
}
if (!isSameNetId) {
// Set HTTP proxy system properties to match network.
// TODO: Deprecate this static method and replace it with a non-static version.
try {
@@ -4023,10 +4030,9 @@ public class ConnectivityManager {
// Must flush socket pool as idle sockets will be bound to previous network and may
// cause subsequent fetches to be performed on old network.
NetworkEventDispatcher.getInstance().onNetworkConfigurationChanged();
return true;
} else {
return false;
}
return true;
}
/**