am 28ca40ff: am 425aacdc: Merge "Only use mDefaultDns if the network claims to offer Internet" into lmp-mr1-dev

* commit '28ca40ff78dc5e62d0e26e7340b74ad6e5ba767e':
  Only use mDefaultDns if the network claims to offer Internet
This commit is contained in:
Lorenzo Colitti
2014-12-02 07:00:45 +00:00
committed by Android Git Automerger

View File

@@ -3593,8 +3593,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
// updateMtu(lp, null);
// }
updateTcpBufferSizes(networkAgent);
// TODO: deprecate and remove mDefaultDns when we can do so safely.
// For now, use it only when the network has Internet access. http://b/18327075
final boolean useDefaultDns = networkAgent.networkCapabilities.hasCapability(
NetworkCapabilities.NET_CAPABILITY_INTERNET);
final boolean flushDns = updateRoutes(newLp, oldLp, netId);
updateDnses(newLp, oldLp, netId, flushDns);
updateDnses(newLp, oldLp, netId, flushDns, useDefaultDns);
updateClat(newLp, oldLp, networkAgent);
if (isDefaultNetwork(networkAgent)) handleApplyDefaultProxy(newLp.getHttpProxy());
// TODO - move this check to cover the whole function
@@ -3688,10 +3694,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
return !routeDiff.added.isEmpty() || !routeDiff.removed.isEmpty();
}
private void updateDnses(LinkProperties newLp, LinkProperties oldLp, int netId, boolean flush) {
private void updateDnses(LinkProperties newLp, LinkProperties oldLp, int netId,
boolean flush, boolean useDefaultDns) {
if (oldLp == null || (newLp.isIdenticalDnses(oldLp) == false)) {
Collection<InetAddress> dnses = newLp.getDnsServers();
if (dnses.size() == 0 && mDefaultDns != null) {
if (dnses.size() == 0 && mDefaultDns != null && useDefaultDns) {
dnses = new ArrayList();
dnses.add(mDefaultDns);
if (DBG) {