Merge change Iaf08eabc into eclair
* changes: Reduce the ConnectivityManager logging.
This commit is contained in:
@@ -123,8 +123,10 @@ public abstract class NetworkStateTracker extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addPrivateDnsRoutes() {
|
public void addPrivateDnsRoutes() {
|
||||||
if (DBG) Log.d(TAG, "addPrivateDnsRoutes for " + this +
|
if (DBG) {
|
||||||
"(" + mInterfaceName + ") - mPrivateDnsRouteSet = "+mPrivateDnsRouteSet);
|
Log.d(TAG, "addPrivateDnsRoutes for " + this +
|
||||||
|
"(" + mInterfaceName + ") - mPrivateDnsRouteSet = "+mPrivateDnsRouteSet);
|
||||||
|
}
|
||||||
if (mInterfaceName != null && !mPrivateDnsRouteSet) {
|
if (mInterfaceName != null && !mPrivateDnsRouteSet) {
|
||||||
for (String addrString : getNameServers()) {
|
for (String addrString : getNameServers()) {
|
||||||
int addr = NetworkUtils.lookupHost(addrString);
|
int addr = NetworkUtils.lookupHost(addrString);
|
||||||
@@ -138,30 +140,36 @@ public abstract class NetworkStateTracker extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removePrivateDnsRoutes() {
|
public void removePrivateDnsRoutes() {
|
||||||
if (DBG) Log.d(TAG, "removePrivateDnsRoutes for " + this +
|
|
||||||
"(" + mInterfaceName + ")");
|
|
||||||
// TODO - we should do this explicitly but the NetUtils api doesnt
|
// TODO - we should do this explicitly but the NetUtils api doesnt
|
||||||
// support this yet - must remove all. No worse than before
|
// support this yet - must remove all. No worse than before
|
||||||
if (mInterfaceName != null && mPrivateDnsRouteSet) {
|
if (mInterfaceName != null && mPrivateDnsRouteSet) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, "removePrivateDnsRoutes for " + mNetworkInfo.getTypeName() +
|
||||||
|
" (" + mInterfaceName + ")");
|
||||||
|
}
|
||||||
NetworkUtils.removeHostRoutes(mInterfaceName);
|
NetworkUtils.removeHostRoutes(mInterfaceName);
|
||||||
mPrivateDnsRouteSet = false;
|
mPrivateDnsRouteSet = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDefaultRoute() {
|
public void addDefaultRoute() {
|
||||||
if (DBG) Log.d(TAG, "addDefaultRoute for " + this + "(" +
|
|
||||||
mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr);
|
|
||||||
if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) &&
|
if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) &&
|
||||||
mDefaultRouteSet == false) {
|
mDefaultRouteSet == false) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() +
|
||||||
|
" (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr);
|
||||||
|
}
|
||||||
NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr);
|
NetworkUtils.setDefaultRoute(mInterfaceName, mDefaultGatewayAddr);
|
||||||
mDefaultRouteSet = true;
|
mDefaultRouteSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDefaultRoute() {
|
public void removeDefaultRoute() {
|
||||||
if (DBG) Log.d(TAG, "removeDefaultRoute for " + this + "(" +
|
|
||||||
mInterfaceName + ")");
|
|
||||||
if (mInterfaceName != null && mDefaultRouteSet == true) {
|
if (mInterfaceName != null && mDefaultRouteSet == true) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, "removeDefaultRoute for " + mNetworkInfo.getTypeName() + " (" +
|
||||||
|
mInterfaceName + ")");
|
||||||
|
}
|
||||||
NetworkUtils.removeDefaultRoute(mInterfaceName);
|
NetworkUtils.removeDefaultRoute(mInterfaceName);
|
||||||
mDefaultRouteSet = false;
|
mDefaultRouteSet = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -765,8 +765,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
*/
|
*/
|
||||||
private void handleDisconnect(NetworkInfo info) {
|
private void handleDisconnect(NetworkInfo info) {
|
||||||
|
|
||||||
if (DBG) Log.v(TAG, "Handle DISCONNECT for " + info.getTypeName());
|
|
||||||
int prevNetType = info.getType();
|
int prevNetType = info.getType();
|
||||||
|
if (DBG) {
|
||||||
|
Log.v(TAG, "Handle DISCONNECT for " + info.getTypeName() +
|
||||||
|
(mNetAttributes[prevNetType].isDefault() ? ", a default network" : ""));
|
||||||
|
}
|
||||||
|
|
||||||
mNetTrackers[prevNetType].setTeardownRequested(false);
|
mNetTrackers[prevNetType].setTeardownRequested(false);
|
||||||
/*
|
/*
|
||||||
@@ -806,7 +809,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
*/
|
*/
|
||||||
NetworkStateTracker newNet = null;
|
NetworkStateTracker newNet = null;
|
||||||
if (mNetAttributes[prevNetType].isDefault()) {
|
if (mNetAttributes[prevNetType].isDefault()) {
|
||||||
if (DBG) Log.d(TAG, "disconnecting a default network");
|
|
||||||
if (mActiveDefaultNetwork == prevNetType) {
|
if (mActiveDefaultNetwork == prevNetType) {
|
||||||
mActiveDefaultNetwork = -1;
|
mActiveDefaultNetwork = -1;
|
||||||
}
|
}
|
||||||
@@ -1051,7 +1053,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
* table entries exist.
|
* table entries exist.
|
||||||
*/
|
*/
|
||||||
private void handleConnectivityChange() {
|
private void handleConnectivityChange() {
|
||||||
if (DBG) Log.d(TAG, "handleConnectivityChange");
|
|
||||||
/*
|
/*
|
||||||
* If a non-default network is enabled, add the host routes that
|
* If a non-default network is enabled, add the host routes that
|
||||||
* will allow it's DNS servers to be accessed. Only
|
* will allow it's DNS servers to be accessed. Only
|
||||||
@@ -1147,21 +1148,21 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleDnsConfigurationChange() {
|
private void handleDnsConfigurationChange() {
|
||||||
if (DBG) Log.d(TAG, "handleDnsConfig Change");
|
|
||||||
// add default net's dns entries
|
// add default net's dns entries
|
||||||
for (int x = mPriorityList.length-1; x>= 0; x--) {
|
for (int x = mPriorityList.length-1; x>= 0; x--) {
|
||||||
int netType = mPriorityList[x];
|
int netType = mPriorityList[x];
|
||||||
NetworkStateTracker nt = mNetTrackers[netType];
|
NetworkStateTracker nt = mNetTrackers[netType];
|
||||||
if (DBG) Log.d(TAG, " checking " + nt);
|
|
||||||
if (nt != null && nt.getNetworkInfo().isConnected() &&
|
if (nt != null && nt.getNetworkInfo().isConnected() &&
|
||||||
!nt.isTeardownRequested()) {
|
!nt.isTeardownRequested()) {
|
||||||
if (DBG) Log.d(TAG, " connected");
|
|
||||||
String[] dnsList = nt.getNameServers();
|
String[] dnsList = nt.getNameServers();
|
||||||
if (mNetAttributes[netType].isDefault()) {
|
if (mNetAttributes[netType].isDefault()) {
|
||||||
int j = 1;
|
int j = 1;
|
||||||
for (String dns : dnsList) {
|
for (String dns : dnsList) {
|
||||||
if (dns != null && !TextUtils.equals(dns, "0.0.0.0")) {
|
if (dns != null && !TextUtils.equals(dns, "0.0.0.0")) {
|
||||||
if (DBG) Log.d(TAG, " adding "+dns);
|
if (DBG) {
|
||||||
|
Log.d(TAG, "adding dns " + dns + " for " +
|
||||||
|
nt.getNetworkInfo().getTypeName());
|
||||||
|
}
|
||||||
SystemProperties.set("net.dns" + j++, dns);
|
SystemProperties.set("net.dns" + j++, dns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user