Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa
am: d841d71593 * commit 'd841d71593c0c4a7c5beaf5196a22d9158c2d697': Debug logging for when getActiveNetworkInfo returns BLOCKED.
This commit is contained in:
@@ -169,6 +169,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
private static final boolean VDBG = false;
|
private static final boolean VDBG = false;
|
||||||
|
|
||||||
private static final boolean LOGD_RULES = false;
|
private static final boolean LOGD_RULES = false;
|
||||||
|
private static final boolean LOGD_BLOCKED_NETWORKINFO = true;
|
||||||
|
|
||||||
// TODO: create better separation between radio types and network types
|
// TODO: create better separation between radio types and network types
|
||||||
|
|
||||||
@@ -955,6 +956,21 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maybeLogBlockedNetworkInfo(NetworkInfo ni, int uid) {
|
||||||
|
if (ni == null || !LOGD_BLOCKED_NETWORKINFO) return;
|
||||||
|
boolean removed = false;
|
||||||
|
boolean added = false;
|
||||||
|
synchronized (mBlockedAppUids) {
|
||||||
|
if (ni.getDetailedState() == DetailedState.BLOCKED && mBlockedAppUids.add(uid)) {
|
||||||
|
added = true;
|
||||||
|
} else if (ni.isConnected() && mBlockedAppUids.remove(uid)) {
|
||||||
|
removed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (added) log("Returning blocked NetworkInfo to uid=" + uid);
|
||||||
|
else if (removed) log("Returning unblocked NetworkInfo to uid=" + uid);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a filtered {@link NetworkInfo}, potentially marked
|
* Return a filtered {@link NetworkInfo}, potentially marked
|
||||||
* {@link DetailedState#BLOCKED} based on
|
* {@link DetailedState#BLOCKED} based on
|
||||||
@@ -965,10 +981,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
// network is blocked; clone and override state
|
// network is blocked; clone and override state
|
||||||
info = new NetworkInfo(info);
|
info = new NetworkInfo(info);
|
||||||
info.setDetailedState(DetailedState.BLOCKED, null, null);
|
info.setDetailedState(DetailedState.BLOCKED, null, null);
|
||||||
if (VDBG) {
|
|
||||||
log("returning Blocked NetworkInfo for ifname=" +
|
|
||||||
lp.getInterfaceName() + ", uid=" + uid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (info != null && mLockdownTracker != null) {
|
if (info != null && mLockdownTracker != null) {
|
||||||
info = mLockdownTracker.augmentNetworkInfo(info);
|
info = mLockdownTracker.augmentNetworkInfo(info);
|
||||||
@@ -989,7 +1001,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
enforceAccessPermission();
|
enforceAccessPermission();
|
||||||
final int uid = Binder.getCallingUid();
|
final int uid = Binder.getCallingUid();
|
||||||
NetworkState state = getUnfilteredActiveNetworkState(uid);
|
NetworkState state = getUnfilteredActiveNetworkState(uid);
|
||||||
return getFilteredNetworkInfo(state.networkInfo, state.linkProperties, uid);
|
NetworkInfo ni = getFilteredNetworkInfo(state.networkInfo, state.linkProperties, uid);
|
||||||
|
maybeLogBlockedNetworkInfo(ni, uid);
|
||||||
|
return ni;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -3882,6 +3896,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
private final HashMap<Messenger, NetworkAgentInfo> mNetworkAgentInfos =
|
private final HashMap<Messenger, NetworkAgentInfo> mNetworkAgentInfos =
|
||||||
new HashMap<Messenger, NetworkAgentInfo>();
|
new HashMap<Messenger, NetworkAgentInfo>();
|
||||||
|
|
||||||
|
@GuardedBy("mBlockedAppUids")
|
||||||
|
private final HashSet<Integer> mBlockedAppUids = new HashSet();
|
||||||
|
|
||||||
// Note: if mDefaultRequest is changed, NetworkMonitor needs to be updated.
|
// Note: if mDefaultRequest is changed, NetworkMonitor needs to be updated.
|
||||||
private final NetworkRequest mDefaultRequest;
|
private final NetworkRequest mDefaultRequest;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user