Move socket tagging from libcore.

Change-Id: I7515896936c5bbd212c88e2801b831914219a925
This commit is contained in:
Jesse Wilson
2011-06-28 19:06:31 -07:00
parent 9279006a00
commit b05f41c97f

View File

@@ -25,8 +25,9 @@ import android.os.INetworkManagementService;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import dalvik.system.BlockGuard; import com.android.server.NetworkManagementSocketTagger;
import dalvik.system.SocketTagger;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
@@ -92,7 +93,7 @@ public class TrafficStats {
* {@link #tagSocket(Socket)}. * {@link #tagSocket(Socket)}.
*/ */
public static void setThreadStatsTag(int tag) { public static void setThreadStatsTag(int tag) {
BlockGuard.setThreadSocketStatsTag(tag); NetworkManagementSocketTagger.setThreadSocketStatsTag(tag);
} }
/** /**
@@ -104,7 +105,7 @@ public class TrafficStats {
} }
public static void clearThreadStatsTag() { public static void clearThreadStatsTag() {
BlockGuard.setThreadSocketStatsTag(-1); NetworkManagementSocketTagger.setThreadSocketStatsTag(-1);
} }
/** /**
@@ -121,12 +122,12 @@ public class TrafficStats {
* {@hide} * {@hide}
*/ */
public static void setThreadStatsUid(int uid) { public static void setThreadStatsUid(int uid) {
BlockGuard.setThreadSocketStatsUid(uid); NetworkManagementSocketTagger.setThreadSocketStatsUid(uid);
} }
/** {@hide} */ /** {@hide} */
public static void clearThreadStatsUid() { public static void clearThreadStatsUid() {
BlockGuard.setThreadSocketStatsUid(-1); NetworkManagementSocketTagger.setThreadSocketStatsUid(-1);
} }
/** /**
@@ -139,14 +140,14 @@ public class TrafficStats {
* @see #setThreadStatsUid(int) * @see #setThreadStatsUid(int)
*/ */
public static void tagSocket(Socket socket) throws SocketException { public static void tagSocket(Socket socket) throws SocketException {
BlockGuard.tagSocketFd(socket.getFileDescriptor$()); SocketTagger.get().tag(socket);
} }
/** /**
* Remove any statistics parameters from the given {@link Socket}. * Remove any statistics parameters from the given {@link Socket}.
*/ */
public static void untagSocket(Socket socket) throws SocketException { public static void untagSocket(Socket socket) throws SocketException {
BlockGuard.untagSocketFd(socket.getFileDescriptor$()); SocketTagger.get().untag(socket);
} }
/** /**