Reduce ConnectivityService logging
bug:5106520 Change-Id: I4a7a5cac51c09e9e2275b30b7b2c053f94b9088d
This commit is contained in:
@@ -344,7 +344,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mPolicyManager.registerListener(mPolicyListener);
|
mPolicyManager.registerListener(mPolicyListener);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// ouch, no rules updates means some processes may never get network
|
// ouch, no rules updates means some processes may never get network
|
||||||
Slog.e(TAG, "unable to register INetworkPolicyListener", e);
|
loge("unable to register INetworkPolicyListener" + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
final PowerManager powerManager = (PowerManager) context.getSystemService(
|
final PowerManager powerManager = (PowerManager) context.getSystemService(
|
||||||
@@ -798,9 +798,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void expire() {
|
public void expire() {
|
||||||
|
if (VDBG) {
|
||||||
log("ConnectivityService FeatureUser expire(" +
|
log("ConnectivityService FeatureUser expire(" +
|
||||||
mNetworkType + ", " + mFeature + ", " + mBinder +"), created " +
|
mNetworkType + ", " + mFeature + ", " + mBinder +"), created " +
|
||||||
(System.currentTimeMillis() - mCreateTime) + " mSec ago");
|
(System.currentTimeMillis() - mCreateTime) + " mSec ago");
|
||||||
|
}
|
||||||
stopUsingNetworkFeature(this, false);
|
stopUsingNetworkFeature(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,7 +845,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if(networkType == ConnectivityManager.TYPE_MOBILE) {
|
if(networkType == ConnectivityManager.TYPE_MOBILE) {
|
||||||
usedNetworkType = convertFeatureToNetworkType(feature);
|
usedNetworkType = convertFeatureToNetworkType(feature);
|
||||||
if (usedNetworkType < 0) {
|
if (usedNetworkType < 0) {
|
||||||
Slog.e(TAG, "Can't match any netTracker!");
|
loge("Can't match any netTracker!");
|
||||||
usedNetworkType = networkType;
|
usedNetworkType = networkType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -953,7 +955,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
return stopUsingNetworkFeature(u, true);
|
return stopUsingNetworkFeature(u, true);
|
||||||
} else {
|
} else {
|
||||||
// none found!
|
// none found!
|
||||||
if (DBG) log("ignoring stopUsingNetworkFeature - not a live request");
|
if (VDBG) log("ignoring stopUsingNetworkFeature - not a live request");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1081,7 +1083,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
if (tracker == null || !tracker.getNetworkInfo().isConnected() ||
|
if (tracker == null || !tracker.getNetworkInfo().isConnected() ||
|
||||||
tracker.isTeardownRequested()) {
|
tracker.isTeardownRequested()) {
|
||||||
if (DBG) {
|
if (VDBG) {
|
||||||
log("requestRouteToHostAddress on down network " +
|
log("requestRouteToHostAddress on down network " +
|
||||||
"(" + networkType + ") - dropped");
|
"(" + networkType + ") - dropped");
|
||||||
}
|
}
|
||||||
@@ -1152,13 +1154,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (doAdd) {
|
if (doAdd) {
|
||||||
if (DBG) log("Adding " + r + " for interface " + ifaceName);
|
if (VDBG) log("Adding " + r + " for interface " + ifaceName);
|
||||||
mAddedRoutes.add(r);
|
mAddedRoutes.add(r);
|
||||||
try {
|
try {
|
||||||
mNetd.addRoute(ifaceName, r);
|
mNetd.addRoute(ifaceName, r);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
loge("Exception trying to add a route: " + e);
|
if (VDBG) loge("Exception trying to add a route: " + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1166,16 +1168,16 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
// we can remove it from the table
|
// we can remove it from the table
|
||||||
mAddedRoutes.remove(r);
|
mAddedRoutes.remove(r);
|
||||||
if (mAddedRoutes.contains(r) == false) {
|
if (mAddedRoutes.contains(r) == false) {
|
||||||
if (DBG) log("Removing " + r + " for interface " + ifaceName);
|
if (VDBG) log("Removing " + r + " for interface " + ifaceName);
|
||||||
try {
|
try {
|
||||||
mNetd.removeRoute(ifaceName, r);
|
mNetd.removeRoute(ifaceName, r);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// never crash - catch them all
|
// never crash - catch them all
|
||||||
loge("Exception trying to remove a route: " + e);
|
if (VDBG) loge("Exception trying to remove a route: " + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("not removing " + r + " as it's still in use");
|
if (VDBG) log("not removing " + r + " as it's still in use");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1220,7 +1222,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
enforceAccessPermission();
|
enforceAccessPermission();
|
||||||
boolean retVal = Settings.Secure.getInt(mContext.getContentResolver(),
|
boolean retVal = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.MOBILE_DATA, 1) == 1;
|
Settings.Secure.MOBILE_DATA, 1) == 1;
|
||||||
if (DBG) log("getMobileDataEnabled returning " + retVal);
|
if (VDBG) log("getMobileDataEnabled returning " + retVal);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1247,7 +1249,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
||||||
|
|
||||||
if (LOGD_RULES) {
|
if (LOGD_RULES) {
|
||||||
Slog.d(TAG, "onUidRulesChanged(uid=" + uid + ", uidRules=" + uidRules + ")");
|
log("onUidRulesChanged(uid=" + uid + ", uidRules=" + uidRules + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mRulesLock) {
|
synchronized (mRulesLock) {
|
||||||
@@ -1268,8 +1270,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
mContext.enforceCallingOrSelfPermission(MANAGE_NETWORK_POLICY, TAG);
|
||||||
|
|
||||||
if (LOGD_RULES) {
|
if (LOGD_RULES) {
|
||||||
Slog.d(TAG,
|
log("onMeteredIfacesChanged(ifaces=" + Arrays.toString(meteredIfaces) + ")");
|
||||||
"onMeteredIfacesChanged(ifaces=" + Arrays.toString(meteredIfaces) + ")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mRulesLock) {
|
synchronized (mRulesLock) {
|
||||||
@@ -1294,8 +1295,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
private void handleSetMobileData(boolean enabled) {
|
private void handleSetMobileData(boolean enabled) {
|
||||||
if (mNetTrackers[ConnectivityManager.TYPE_MOBILE] != null) {
|
if (mNetTrackers[ConnectivityManager.TYPE_MOBILE] != null) {
|
||||||
if (DBG) {
|
if (VDBG) {
|
||||||
Slog.d(TAG, mNetTrackers[ConnectivityManager.TYPE_MOBILE].toString() + enabled);
|
log(mNetTrackers[ConnectivityManager.TYPE_MOBILE].toString() + enabled);
|
||||||
}
|
}
|
||||||
mNetTrackers[ConnectivityManager.TYPE_MOBILE].setDataEnable(enabled);
|
mNetTrackers[ConnectivityManager.TYPE_MOBILE].setDataEnable(enabled);
|
||||||
}
|
}
|
||||||
@@ -1587,7 +1588,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mNetConfigs[type].priority) ||
|
mNetConfigs[type].priority) ||
|
||||||
mNetworkPreference == mActiveDefaultNetwork) {
|
mNetworkPreference == mActiveDefaultNetwork) {
|
||||||
// don't accept this one
|
// don't accept this one
|
||||||
if (DBG) {
|
if (VDBG) {
|
||||||
log("Not broadcasting CONNECT_ACTION " +
|
log("Not broadcasting CONNECT_ACTION " +
|
||||||
"to torn down network " + info.getTypeName());
|
"to torn down network " + info.getTypeName());
|
||||||
}
|
}
|
||||||
@@ -1688,11 +1689,13 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetMask = NetworkUtils.RESET_ALL_ADDRESSES;
|
resetMask = NetworkUtils.RESET_ALL_ADDRESSES;
|
||||||
|
if (DBG) {
|
||||||
log("handleConnectivityChange: interface not not equivalent reset both" +
|
log("handleConnectivityChange: interface not not equivalent reset both" +
|
||||||
" linkProperty[" + netType + "]:" +
|
" linkProperty[" + netType + "]:" +
|
||||||
" resetMask=" + resetMask);
|
" resetMask=" + resetMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (mNetConfigs[netType].isDefault()) {
|
if (mNetConfigs[netType].isDefault()) {
|
||||||
handleApplyDefaultProxy(netType);
|
handleApplyDefaultProxy(netType);
|
||||||
}
|
}
|
||||||
@@ -1798,7 +1801,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
String bufferSizes = SystemProperties.get(key);
|
String bufferSizes = SystemProperties.get(key);
|
||||||
|
|
||||||
if (bufferSizes.length() == 0) {
|
if (bufferSizes.length() == 0) {
|
||||||
loge(key + " not found in system properties. Using defaults");
|
if (VDBG) log(key + " not found in system properties. Using defaults");
|
||||||
|
|
||||||
// Setting to default values so we won't be stuck to previous values
|
// Setting to default values so we won't be stuck to previous values
|
||||||
key = "net.tcp.buffersize.default";
|
key = "net.tcp.buffersize.default";
|
||||||
@@ -1807,7 +1810,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
// Set values in kernel
|
// Set values in kernel
|
||||||
if (bufferSizes.length() != 0) {
|
if (bufferSizes.length() != 0) {
|
||||||
if (DBG) {
|
if (VDBG) {
|
||||||
log("Setting TCP values: [" + bufferSizes
|
log("Setting TCP values: [" + bufferSizes
|
||||||
+ "] which comes from [" + key + "]");
|
+ "] which comes from [" + key + "]");
|
||||||
}
|
}
|
||||||
@@ -1849,7 +1852,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
*/
|
*/
|
||||||
private void reassessPidDns(int myPid, boolean doBump)
|
private void reassessPidDns(int myPid, boolean doBump)
|
||||||
{
|
{
|
||||||
if (DBG) log("reassessPidDns for pid " + myPid);
|
if (VDBG) log("reassessPidDns for pid " + myPid);
|
||||||
for(int i : mPriorityList) {
|
for(int i : mPriorityList) {
|
||||||
if (mNetConfigs[i].isDefault()) {
|
if (mNetConfigs[i].isDefault()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -1935,7 +1938,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
String value = mDefaultDns.getHostAddress();
|
String value = mDefaultDns.getHostAddress();
|
||||||
if (!value.equals(SystemProperties.get("net.dns1"))) {
|
if (!value.equals(SystemProperties.get("net.dns1"))) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("no dns provided for " + network + " - using " + value);
|
loge("no dns provided for " + network + " - using " + value);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
SystemProperties.set("net.dns1", value);
|
SystemProperties.set("net.dns1", value);
|
||||||
@@ -1948,7 +1951,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if (!changed && value.equals(SystemProperties.get(key))) {
|
if (!changed && value.equals(SystemProperties.get(key))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (DBG) {
|
if (VDBG) {
|
||||||
log("adding dns " + value + " for " + network);
|
log("adding dns " + value + " for " + network);
|
||||||
}
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1957,7 +1960,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
for (int i = last + 1; i <= mNumDnsEntries; ++i) {
|
for (int i = last + 1; i <= mNumDnsEntries; ++i) {
|
||||||
String key = "net.dns" + i;
|
String key = "net.dns" + i;
|
||||||
if (DBG) log("erasing " + key);
|
if (VDBG) log("erasing " + key);
|
||||||
changed = true;
|
changed = true;
|
||||||
SystemProperties.set(key, "");
|
SystemProperties.set(key, "");
|
||||||
}
|
}
|
||||||
@@ -1968,7 +1971,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
|
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
|
||||||
mNetd.setDefaultInterfaceForDns(iface);
|
mNetd.setDefaultInterfaceForDns(iface);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.e(TAG, "exception setting default dns interface: " + e);
|
loge("exception setting default dns interface: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
|
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
|
||||||
@@ -1998,7 +2001,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mNetd.setDnsServersForInterface(p.getInterfaceName(),
|
mNetd.setDnsServersForInterface(p.getInterfaceName(),
|
||||||
NetworkUtils.makeStrings(dnses));
|
NetworkUtils.makeStrings(dnses));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.e(TAG, "exception setting dns servers: " + e);
|
loge("exception setting dns servers: " + e);
|
||||||
}
|
}
|
||||||
// set per-pid dns for attached secondary nets
|
// set per-pid dns for attached secondary nets
|
||||||
List pids = mNetRequestersPids[netType];
|
List pids = mNetRequestersPids[netType];
|
||||||
@@ -2335,7 +2338,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
// 100 percent is full good, 0 is full bad.
|
// 100 percent is full good, 0 is full bad.
|
||||||
public void reportInetCondition(int networkType, int percentage) {
|
public void reportInetCondition(int networkType, int percentage) {
|
||||||
if (DBG) log("reportNetworkCondition(" + networkType + ", " + percentage + ")");
|
if (VDBG) log("reportNetworkCondition(" + networkType + ", " + percentage + ")");
|
||||||
mContext.enforceCallingOrSelfPermission(
|
mContext.enforceCallingOrSelfPermission(
|
||||||
android.Manifest.permission.STATUS_BAR,
|
android.Manifest.permission.STATUS_BAR,
|
||||||
"ConnectivityService");
|
"ConnectivityService");
|
||||||
@@ -2372,7 +2375,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mDefaultInetCondition = condition;
|
mDefaultInetCondition = condition;
|
||||||
int delay;
|
int delay;
|
||||||
if (mInetConditionChangeInFlight == false) {
|
if (mInetConditionChangeInFlight == false) {
|
||||||
if (DBG) log("starting a change hold");
|
if (VDBG) log("starting a change hold");
|
||||||
// setup a new hold to debounce this
|
// setup a new hold to debounce this
|
||||||
if (mDefaultInetCondition > 50) {
|
if (mDefaultInetCondition > 50) {
|
||||||
delay = Settings.Secure.getInt(mContext.getContentResolver(),
|
delay = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
@@ -2387,12 +2390,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
} else {
|
} else {
|
||||||
// we've set the new condition, when this hold ends that will get
|
// we've set the new condition, when this hold ends that will get
|
||||||
// picked up
|
// picked up
|
||||||
if (DBG) log("currently in hold - not setting new end evt");
|
if (VDBG) log("currently in hold - not setting new end evt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleInetConditionHoldEnd(int netType, int sequence) {
|
private void handleInetConditionHoldEnd(int netType, int sequence) {
|
||||||
if (DBG) {
|
if (VDBG) {
|
||||||
log("Inet hold end, net=" + netType +
|
log("Inet hold end, net=" + netType +
|
||||||
", condition =" + mDefaultInetCondition +
|
", condition =" + mDefaultInetCondition +
|
||||||
", published condition =" + mDefaultInetConditionPublished);
|
", published condition =" + mDefaultInetConditionPublished);
|
||||||
@@ -2490,7 +2493,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
mDefaultProxy = null;
|
mDefaultProxy = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DBG) log("changing default proxy to " + proxy);
|
if (VDBG) log("changing default proxy to " + proxy);
|
||||||
if ((proxy == null && mGlobalProxy == null) || proxy.equals(mGlobalProxy)) return;
|
if ((proxy == null && mGlobalProxy == null) || proxy.equals(mGlobalProxy)) return;
|
||||||
if (mGlobalProxy != null) return;
|
if (mGlobalProxy != null) return;
|
||||||
sendProxyBroadcast(proxy);
|
sendProxyBroadcast(proxy);
|
||||||
@@ -2517,7 +2520,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
|
|
||||||
private void sendProxyBroadcast(ProxyProperties proxy) {
|
private void sendProxyBroadcast(ProxyProperties proxy) {
|
||||||
if (proxy == null) proxy = new ProxyProperties("", 0, "");
|
if (proxy == null) proxy = new ProxyProperties("", 0, "");
|
||||||
log("sending Proxy Broadcast for " + proxy);
|
if (DBG) log("sending Proxy Broadcast for " + proxy);
|
||||||
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
|
Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);
|
||||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING |
|
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING |
|
||||||
Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
||||||
|
|||||||
Reference in New Issue
Block a user