Merge "Use the carrier-given dns addrs for tethering." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
f449ea9e96
@ -118,7 +118,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
|||||||
"192.168.48.2", "192.168.48.254",
|
"192.168.48.2", "192.168.48.254",
|
||||||
};
|
};
|
||||||
|
|
||||||
private String[] mDnsServers;
|
private String[] mDefaultDnsServers;
|
||||||
private static final String DNS_DEFAULT_SERVER1 = "8.8.8.8";
|
private static final String DNS_DEFAULT_SERVER1 = "8.8.8.8";
|
||||||
private static final String DNS_DEFAULT_SERVER2 = "8.8.4.4";
|
private static final String DNS_DEFAULT_SERVER2 = "8.8.4.4";
|
||||||
|
|
||||||
@ -171,9 +171,9 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
|||||||
updateConfiguration();
|
updateConfiguration();
|
||||||
|
|
||||||
// TODO - remove and rely on real notifications of the current iface
|
// TODO - remove and rely on real notifications of the current iface
|
||||||
mDnsServers = new String[2];
|
mDefaultDnsServers = new String[2];
|
||||||
mDnsServers[0] = DNS_DEFAULT_SERVER1;
|
mDefaultDnsServers[0] = DNS_DEFAULT_SERVER1;
|
||||||
mDnsServers[1] = DNS_DEFAULT_SERVER2;
|
mDefaultDnsServers[1] = DNS_DEFAULT_SERVER2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateConfiguration() {
|
void updateConfiguration() {
|
||||||
@ -1245,7 +1245,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mNMService.setDnsForwarders(mDnsServers);
|
mNMService.setDnsForwarders(mDefaultDnsServers);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
transitionTo(mSetDnsForwardersErrorState);
|
transitionTo(mSetDnsForwardersErrorState);
|
||||||
return false;
|
return false;
|
||||||
@ -1321,7 +1321,19 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
|||||||
try {
|
try {
|
||||||
linkProperties = mConnService.getLinkProperties(upType);
|
linkProperties = mConnService.getLinkProperties(upType);
|
||||||
} catch (RemoteException e) { }
|
} catch (RemoteException e) { }
|
||||||
if (linkProperties != null) iface = linkProperties.getInterfaceName();
|
if (linkProperties != null) {
|
||||||
|
iface = linkProperties.getInterfaceName();
|
||||||
|
String[] dnsServers = mDefaultDnsServers;
|
||||||
|
Collection<InetAddress> dnses = linkProperties.getDnses();
|
||||||
|
if (dnses != null) {
|
||||||
|
dnsServers = NetworkUtils.makeStrings(dnses);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
mNMService.setDnsForwarders(dnsServers);
|
||||||
|
} catch (Exception e) {
|
||||||
|
transitionTo(mSetDnsForwardersErrorState);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
notifyTetheredOfNewUpstreamIface(iface);
|
notifyTetheredOfNewUpstreamIface(iface);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user