Merge "Clean up Connectivity Logging." into lmp-dev

This commit is contained in:
Robert Greenwalt
2014-08-28 16:29:55 +00:00
committed by Android (Google) Code Review
3 changed files with 75 additions and 42 deletions

View File

@@ -45,7 +45,7 @@ public abstract class NetworkAgent extends Handler {
private volatile AsyncChannel mAsyncChannel;
private final String LOG_TAG;
private static final boolean DBG = true;
private static final boolean VDBG = true;
private static final boolean VDBG = false;
private final Context mContext;
private final ArrayList<Message>mPreConnectedQueue = new ArrayList<Message>();
@@ -134,7 +134,7 @@ public abstract class NetworkAgent extends Handler {
throw new IllegalArgumentException();
}
if (DBG) log("Registering NetworkAgent");
if (VDBG) log("Registering NetworkAgent");
ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService(
Context.CONNECTIVITY_SERVICE);
cm.registerNetworkAgent(new Messenger(this), new NetworkInfo(ni),
@@ -148,7 +148,7 @@ public abstract class NetworkAgent extends Handler {
if (mAsyncChannel != null) {
log("Received new connection while already connected!");
} else {
if (DBG) log("NetworkAgent fully connected");
if (VDBG) log("NetworkAgent fully connected");
AsyncChannel ac = new AsyncChannel();
ac.connected(null, this, msg.replyTo);
ac.replyToMessage(msg, AsyncChannel.CMD_CHANNEL_FULLY_CONNECTED,
@@ -164,7 +164,7 @@ public abstract class NetworkAgent extends Handler {
break;
}
case AsyncChannel.CMD_CHANNEL_DISCONNECT: {
if (DBG) log("CMD_CHANNEL_DISCONNECT");
if (VDBG) log("CMD_CHANNEL_DISCONNECT");
if (mAsyncChannel != null) mAsyncChannel.disconnect();
break;
}

View File

@@ -46,6 +46,7 @@ import com.android.internal.util.Protocol;
**/
public class NetworkFactory extends Handler {
private static final boolean DBG = true;
private static final boolean VDBG = false;
private static final int BASE = Protocol.BASE_NETWORK_FACTORY;
/**
@@ -164,13 +165,14 @@ public class NetworkFactory extends Handler {
private void handleAddRequest(NetworkRequest request, int score) {
NetworkRequestInfo n = mNetworkRequests.get(request.requestId);
if (n == null) {
if (DBG) log("got request " + request + " with score " + score);
n = new NetworkRequestInfo(request, score);
mNetworkRequests.put(n.request.requestId, n);
} else {
if (VDBG) log("new score " + score + " for exisiting request " + request);
n.score = score;
}
if (DBG) log("got request " + request + " with score " + score);
if (DBG) log(" my score=" + mScore + ", my filter=" + mCapabilityFilter);
if (VDBG) log(" my score=" + mScore + ", my filter=" + mCapabilityFilter);
evalRequest(n);
}