Merge "Add bugreport info about network feature use. DO NOT MERGE" into eclair

This commit is contained in:
Robert Greenwalt
2010-01-20 13:26:04 -08:00
committed by Android (Google) Code Review

View File

@ -454,6 +454,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
IBinder mBinder; IBinder mBinder;
int mPid; int mPid;
int mUid; int mUid;
long mCreateTime;
FeatureUser(int type, String feature, IBinder binder) { FeatureUser(int type, String feature, IBinder binder) {
super(); super();
@ -462,6 +463,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mBinder = binder; mBinder = binder;
mPid = getCallingPid(); mPid = getCallingPid();
mUid = getCallingUid(); mUid = getCallingUid();
mCreateTime = System.currentTimeMillis();
try { try {
mBinder.linkToDeath(this, 0); mBinder.linkToDeath(this, 0);
@ -476,15 +478,22 @@ public class ConnectivityService extends IConnectivityManager.Stub {
public void binderDied() { public void binderDied() {
Log.d(TAG, "ConnectivityService FeatureUser binderDied(" + Log.d(TAG, "ConnectivityService FeatureUser binderDied(" +
mNetworkType + ", " + mFeature + ", " + mBinder); mNetworkType + ", " + mFeature + ", " + mBinder + "), created " +
(System.currentTimeMillis() - mCreateTime) + " mSec ago");
stopUsingNetworkFeature(this, false); stopUsingNetworkFeature(this, false);
} }
public void expire() { public void expire() {
Log.d(TAG, "ConnectivityService FeatureUser expire(" + Log.d(TAG, "ConnectivityService FeatureUser expire(" +
mNetworkType + ", " + mFeature + ", " + mBinder); mNetworkType + ", " + mFeature + ", " + mBinder +"), created " +
(System.currentTimeMillis() - mCreateTime) + " mSec ago");
stopUsingNetworkFeature(this, false); stopUsingNetworkFeature(this, false);
} }
public String toString() {
return "FeatureUser("+mNetworkType+","+mFeature+","+mPid+","+mUid+"), created " +
(System.currentTimeMillis() - mCreateTime) + " mSec ago";
}
} }
// javadoc from interface // javadoc from interface
@ -596,6 +605,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return stopUsingNetworkFeature(u, true); return stopUsingNetworkFeature(u, true);
} else { } else {
// none found! // none found!
if (DBG) Log.d(TAG, "ignoring stopUsingNetworkFeature - not a live request");
return 1; return 1;
} }
} }
@ -640,6 +650,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (x.mUid == u.mUid && x.mPid == u.mPid && if (x.mUid == u.mUid && x.mPid == u.mPid &&
x.mNetworkType == u.mNetworkType && x.mNetworkType == u.mNetworkType &&
TextUtils.equals(x.mFeature, u.mFeature)) { TextUtils.equals(x.mFeature, u.mFeature)) {
if (DBG) Log.d(TAG, "ignoring stopUsingNetworkFeature as dup is found");
return 1; return 1;
} }
} }
@ -1198,14 +1209,32 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} }
pw.println(); pw.println();
for (NetworkStateTracker nst : mNetTrackers) { for (NetworkStateTracker nst : mNetTrackers) {
if (nst.getNetworkInfo().isConnected()) { if (nst != null) {
pw.println("Active network: " + nst.getNetworkInfo(). if (nst.getNetworkInfo().isConnected()) {
getTypeName()); pw.println("Active network: " + nst.getNetworkInfo().
getTypeName());
}
pw.println(nst.getNetworkInfo());
pw.println(nst);
pw.println();
} }
pw.println(nst.getNetworkInfo());
pw.println(nst);
pw.println();
} }
pw.println("Network Requester Pids:");
for (int net : mPriorityList) {
String pidString = net + ": ";
for (Object pid : mNetRequestersPids[net]) {
pidString = pidString + pid.toString() + ", ";
}
pw.println(pidString);
}
pw.println();
pw.println("FeatureUsers:");
for (Object requester : mFeatureUsers) {
pw.println(requester.toString());
}
pw.println();
} }
// must be stateless - things change under us. // must be stateless - things change under us.