Merge changes from topic "bindprocess-resolv" am: af8e41c434 am: 4b8dee1177
am: 301ff56903
Change-Id: I3f35e6719db4a1152281d1143e8756e726d51e64
This commit is contained in:
@@ -4022,10 +4022,17 @@ public class ConnectivityManager {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean setProcessDefaultNetwork(@Nullable Network network) {
|
public static boolean setProcessDefaultNetwork(@Nullable Network network) {
|
||||||
int netId = (network == null) ? NETID_UNSET : network.netId;
|
int netId = (network == null) ? NETID_UNSET : network.netId;
|
||||||
if (netId == NetworkUtils.getBoundNetworkForProcess()) {
|
boolean isSameNetId = (netId == NetworkUtils.getBoundNetworkForProcess());
|
||||||
return true;
|
|
||||||
|
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.
|
// Set HTTP proxy system properties to match network.
|
||||||
// TODO: Deprecate this static method and replace it with a non-static version.
|
// TODO: Deprecate this static method and replace it with a non-static version.
|
||||||
try {
|
try {
|
||||||
@@ -4039,10 +4046,9 @@ public class ConnectivityManager {
|
|||||||
// Must flush socket pool as idle sockets will be bound to previous network and may
|
// Must flush socket pool as idle sockets will be bound to previous network and may
|
||||||
// cause subsequent fetches to be performed on old network.
|
// cause subsequent fetches to be performed on old network.
|
||||||
NetworkEventDispatcher.getInstance().onNetworkConfigurationChanged();
|
NetworkEventDispatcher.getInstance().onNetworkConfigurationChanged();
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user