summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2010-09-20 21:29:02 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-20 21:29:02 -0700
commit313af5a3b5ba51eb75dea35eb568c841aa4beb6a (patch)
tree4b537da2771804f5dfb032da1d1a1f87cc80e0c7
parentdf59f257583730470085db65c7faf44960c3b32e (diff)
parent4e8dfefb06227a911eb5abfcb2591d8eae5db42b (diff)
downloadframeworks_base-313af5a3b5ba51eb75dea35eb568c841aa4beb6a.zip
frameworks_base-313af5a3b5ba51eb75dea35eb568c841aa4beb6a.tar.gz
frameworks_base-313af5a3b5ba51eb75dea35eb568c841aa4beb6a.tar.bz2
Merge "Add Inet Condition log to bugreports" into gingerbread
-rw-r--r--services/java/com/android/server/ConnectivityService.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index c5505d1..8603e51 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -48,6 +48,7 @@ import com.android.server.connectivity.Tethering;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.GregorianCalendar;
import java.util.List;
/**
@@ -109,6 +110,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
private boolean mSystemReady;
private Intent mInitialBroadcast;
+ // used in DBG mode to track inet condition reports
+ private static final int INET_CONDITION_LOG_MAX_SIZE = 15;
+ private ArrayList mInetLog;
+
private static class NetworkAttributes {
/**
* Class for holding settings read from resources.
@@ -329,6 +334,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
mTethering.getTetherableWifiRegexs().length != 0) &&
mTethering.getUpstreamIfaceRegexs().length != 0);
+ if (DBG) {
+ mInetLog = new ArrayList();
+ }
}
@@ -1365,6 +1373,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
pw.println();
mTethering.dump(fd, pw, args);
+
+ if (mInetLog != null) {
+ pw.println();
+ pw.println("Inet condition reports:");
+ for(int i = 0; i < mInetLog.size(); i++) {
+ pw.println(mInetLog.get(i));
+ }
+ }
}
// must be stateless - things change under us.
@@ -1613,6 +1629,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
android.Manifest.permission.STATUS_BAR,
"ConnectivityService");
+ if (DBG) {
+ int pid = getCallingPid();
+ int uid = getCallingUid();
+ String s = pid + "(" + uid + ") reports inet is " +
+ (percentage > 50 ? "connected" : "disconnected") + " (" + percentage + ") on " +
+ "network Type " + networkType + " at " + GregorianCalendar.getInstance().getTime();
+ mInetLog.add(s);
+ while(mInetLog.size() > INET_CONDITION_LOG_MAX_SIZE) {
+ mInetLog.remove(0);
+ }
+ }
mHandler.sendMessage(mHandler.obtainMessage(
NetworkStateTracker.EVENT_INET_CONDITION_CHANGE, networkType, percentage));
}