TrafficStatsCompat
public final class TrafficStatsCompat
Helper for accessing features in TrafficStats
.
Summary
Public methods |
|
---|---|
static void |
This method is deprecated. Use |
static int |
This method is deprecated. Use |
static void |
This method is deprecated. Use |
static void |
This method is deprecated. Use |
static void |
This method is deprecated. Use |
static void |
tagDatagramSocket(@NonNull DatagramSocket socket) Tag the given |
static void |
This method is deprecated. Use |
static void |
untagDatagramSocket(@NonNull DatagramSocket socket) Remove any statistics parameters from the given |
static void |
This method is deprecated. Use |
Public methods
public static void clearThreadStatsTag()
Clear active tag used when accounting Socket
traffic originating from the current thread.
public static int getThreadStatsTag()
Get the active tag used when accounting Socket
traffic originating from the current thread. Only one active tag per thread is supported. tagSocket
.
public static void incrementOperationCount(int operationCount)
Increment count of network operations performed under the accounting tag currently active on the calling thread. This can be used to derive bytes-per-operation.
Parameters | |
---|---|
int operationCount |
Number of operations to increment count by. |
public static void incrementOperationCount(int tag, int operationCount)
Increment count of network operations performed under the given accounting tag. This can be used to derive bytes-per-operation.
Parameters | |
---|---|
int tag |
Accounting tag used in |
int operationCount |
Number of operations to increment count by. |
public static void setThreadStatsTag(int tag)
Set active tag to use when accounting Socket
traffic originating from the current thread. Only one active tag per thread is supported.
Changes only take effect during subsequent calls to tagSocket
.
Tags between 0xFFFFFF00
and 0xFFFFFFFF
are reserved and used internally by system services like DownloadManager when performing traffic on behalf of an application.
tagDatagramSocket
public static void tagDatagramSocket(@NonNull DatagramSocket socket)
Tag the given DatagramSocket
with any statistics parameters active for the current thread. Subsequent calls always replace any existing parameters. When finished, call untagDatagramSocket
to remove statistics parameters.
Throws | |
---|---|
java.net.SocketException |
See also | |
---|---|
setThreadStatsTag |
public static voidtagSocket(Socket socket)
Tag the given Socket
with any statistics parameters active for the current thread. Subsequent calls always replace any existing parameters. When finished, call untagSocket
to remove statistics parameters.
Throws | |
---|---|
java.net.SocketException |
See also | |
---|---|
setThreadStatsTag |
untagDatagramSocket
public static void untagDatagramSocket(@NonNull DatagramSocket socket)
Remove any statistics parameters from the given DatagramSocket
.
Throws | |
---|---|
java.net.SocketException |
public static voiduntagSocket(Socket socket)
Remove any statistics parameters from the given Socket
.
Throws | |
---|---|
java.net.SocketException |