TrafficStatsCompat
class TrafficStatsCompat
kotlin.Any | |
↳ | androidx.core.net.TrafficStatsCompat |
Helper for accessing features in TrafficStats
.
Summary
Public methods | |
---|---|
static Unit |
Clear active tag used when accounting |
static Int |
Get the active tag used when accounting |
static Unit |
incrementOperationCount(operationCount: Int) Increment count of network operations performed under the accounting tag currently active on the calling thread. |
static Unit |
incrementOperationCount(tag: Int, operationCount: Int) Increment count of network operations performed under the given accounting tag. |
static Unit |
setThreadStatsTag(tag: Int) Set active tag to use when accounting |
static Unit |
tagDatagramSocket(@NonNull socket: DatagramSocket) Tag the given |
static Unit |
Tag the given |
static Unit |
untagDatagramSocket(@NonNull socket: DatagramSocket) Remove any statistics parameters from the given |
static Unit |
untagSocket(socket: Socket!) Remove any statistics parameters from the given |
Public methods
clearThreadStatsTag
static funclearThreadStatsTag(): Unit
Deprecated: Use TrafficStats#clearThreadStatsTag()
directly.
Clear active tag used when accounting Socket
traffic originating from the current thread.
getThreadStatsTag
static fungetThreadStatsTag(): Int
Deprecated: Use TrafficStats#getThreadStatsTag()
directly.
Get the active tag used when accounting Socket
traffic originating from the current thread. Only one active tag per thread is supported. tagSocket(Socket)
.
incrementOperationCount
static funincrementOperationCount(operationCount: Int): Unit
Deprecated: Use TrafficStats#incrementOperationCount(int)
directly.
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 | |
---|---|
operationCount |
Int: Number of operations to increment count by. |
incrementOperationCount
static funincrementOperationCount(
tag: Int,
operationCount: Int
): Unit
Deprecated: Use TrafficStats#incrementOperationCount(int, int)
directly.
Increment count of network operations performed under the given accounting tag. This can be used to derive bytes-per-operation.
Parameters | |
---|---|
tag |
Int: Accounting tag used in setThreadStatsTag(int) . |
operationCount |
Int: Number of operations to increment count by. |
setThreadStatsTag
static funsetThreadStatsTag(tag: Int): Unit
Deprecated: Use TrafficStats#setThreadStatsTag(int)
directly.
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(Socket)
.
Tags between 0xFFFFFF00
and 0xFFFFFFFF
are reserved and used internally by system services like DownloadManager when performing traffic on behalf of an application.
tagDatagramSocket
static fun tagDatagramSocket(@NonNull socket: DatagramSocket): Unit
Tag the given DatagramSocket
with any statistics parameters active for the current thread. Subsequent calls always replace any existing parameters. When finished, call untagDatagramSocket(DatagramSocket)
to remove statistics parameters.
See Also
tagSocket
static funtagSocket(socket: Socket!): Unit
Deprecated: Use TrafficStats#tagSocket(Socket)
directly.
Tag the given Socket
with any statistics parameters active for the current thread. Subsequent calls always replace any existing parameters. When finished, call untagSocket(Socket)
to remove statistics parameters.
See Also
untagDatagramSocket
static fun untagDatagramSocket(@NonNull socket: DatagramSocket): Unit
Remove any statistics parameters from the given DatagramSocket
.
untagSocket
static fununtagSocket(socket: Socket!): Unit
Deprecated: Use TrafficStats#untagSocket(Socket)
directly.
Remove any statistics parameters from the given Socket
.