Update log control flag by using Log.isLoggable

The log is completely disabled in the TcpSocketTracker. It's
impossible to debug without building and flashing a new module.
Change the bit to refer to Log.isLoggable so that the log could
be controlled via property in the runtime. Also, update some
logs to help debugging.

Test: m ; observe log via changing the log prop
Change-Id: I7dd26cd3d14a3f2b50e51fd99fce4a4be7183a8c
diff --git a/src/com/android/networkstack/netlink/TcpSocketTracker.java b/src/com/android/networkstack/netlink/TcpSocketTracker.java
index b5eafd6..9cc2d60 100644
--- a/src/com/android/networkstack/netlink/TcpSocketTracker.java
+++ b/src/com/android/networkstack/netlink/TcpSocketTracker.java
@@ -86,8 +86,8 @@
  * This is not thread-safe. This should be only accessed from one thread.
  */
 public class TcpSocketTracker {
-    private static final String TAG = "TcpSocketTracker";
-    private static final boolean DBG = false;
+    private static final String TAG = TcpSocketTracker.class.getSimpleName();
+    private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG);
     private static final int[] ADDRESS_FAMILIES = new int[] {AF_INET6, AF_INET};
     // Enough for parsing v1 tcp_info for more than 200 sockets per time.
     private static final int DEFAULT_RECV_BUFSIZE = 60_000;
@@ -355,7 +355,7 @@
             stat.lostCount -= previous.tcpInfo.mLost;
             stat.retransmitCount -= previous.tcpInfo.mRetransmits;
         }
-
+        log("calculateLatestPacketsStat, stat:" + stat);
         return stat;
     }
 
@@ -519,6 +519,12 @@
             receivedCount += stat.receivedCount;
             retransmitCount += stat.retransmitCount;
         }
+
+        @Override
+        public String toString() {
+            return "TcpStat {sent=" + sentCount + ", lost=" + lostCount
+                    + ", retransmit=" + retransmitCount + ", received=" + receivedCount + "}";
+        }
     }
 
     /**