Bucket
class Bucket
kotlin.Any | |
↳ | android.app.usage.NetworkStats.Bucket |
Buckets are the smallest elements of a query result. As some dimensions of a result may be aggregated (e.g. time or state) some values may be equal across all buckets.
Summary
Constants | |
---|---|
static Int |
Combined usage for this network regardless of default network status. |
static Int |
Usage that occurs while this network is not a default network. |
static Int |
Usage that occurs while this network is a default network. |
static Int |
Combined usage across all metered states. |
static Int |
Usage that occurs on an unmetered network. |
static Int |
Usage that occurs on a metered network. |
static Int |
Combined usage across all roaming states. |
static Int |
Usage that occurs on a home, non-roaming network. |
static Int |
Usage that occurs on a roaming network. |
static Int |
Combined usage across all states. |
static Int |
Usage not accounted for in any other state. |
static Int |
Foreground usage. |
static Int |
Special TAG value for total data across all tags |
static Int |
Special UID value for aggregate/unspecified. |
static Int |
Special UID value for removed apps. |
static Int |
Special UID value for data usage by tethering. |
Public constructors | |
---|---|
Bucket() |
Public methods | |
---|---|
open Int |
Default network status. |
open Long |
End timestamp of the bucket's time interval. |
open Int |
Metered state. |
open Int |
Roaming state. |
open Long |
Number of bytes received during the bucket's time interval. |
open Long |
Number of packets received during the bucket's time interval. |
open Long |
Start timestamp of the bucket's time interval. |
open Int |
getState() Usage state. |
open Int |
getTag() Tag of the bucket. |
open Long |
Number of bytes transmitted during the bucket's time interval. |
open Long |
Number of packets transmitted during the bucket's time interval. |
open Int |
getUid() Key of the bucket. |
Constants
DEFAULT_NETWORK_ALL
static val DEFAULT_NETWORK_ALL: Int
Combined usage for this network regardless of default network status.
Value: -1
DEFAULT_NETWORK_NO
static val DEFAULT_NETWORK_NO: Int
Usage that occurs while this network is not a default network.
This implies that the app responsible for this usage requested that it occur on a specific network different from the one(s) the system would have selected for it.
Value: 1
DEFAULT_NETWORK_YES
static val DEFAULT_NETWORK_YES: Int
Usage that occurs while this network is a default network.
This implies that the app either did not select a specific network for this usage, or it selected a network that the system could have selected for app traffic.
Value: 2
METERED_ALL
static val METERED_ALL: Int
Combined usage across all metered states. Covers metered and unmetered usage.
Value: -1
METERED_NO
static val METERED_NO: Int
Usage that occurs on an unmetered network.
Value: 1
METERED_YES
static val METERED_YES: Int
Usage that occurs on a metered network.
A network is classified as metered when the user is sensitive to heavy data usage on that connection.
Value: 2
ROAMING_ALL
static val ROAMING_ALL: Int
Combined usage across all roaming states. Covers both roaming and non-roaming usage.
Value: -1
ROAMING_NO
static val ROAMING_NO: Int
Usage that occurs on a home, non-roaming network.
Any cellular usage in this bucket was incurred while the device was connected to a tower owned or operated by the user's wireless carrier, or a tower that the user's wireless carrier has indicated should be treated as a home network regardless.
This is also the default value for network types that do not support roaming.
Value: 1
ROAMING_YES
static val ROAMING_YES: Int
Usage that occurs on a roaming network.
Any cellular usage in this bucket as incurred while the device was roaming on another carrier's network, for which additional charges may apply.
Value: 2
STATE_ALL
static val STATE_ALL: Int
Combined usage across all states.
Value: -1
STATE_DEFAULT
static val STATE_DEFAULT: Int
Usage not accounted for in any other state.
Value: 1
TAG_NONE
static val TAG_NONE: Int
Special TAG value for total data across all tags
Value: 0
UID_ALL
static val UID_ALL: Int
Special UID value for aggregate/unspecified.
Value: -1
UID_REMOVED
static val UID_REMOVED: Int
Special UID value for removed apps.
Value: -4
UID_TETHERING
static val UID_TETHERING: Int
Special UID value for data usage by tethering.
Value: -5
Public constructors
Public methods
getDefaultNetworkStatus
open fun getDefaultNetworkStatus(): Int
Default network status. One of the following values:
Return | |
---|---|
Int |
Value is android.app.usage.NetworkStats.Bucket#DEFAULT_NETWORK_ALL , android.app.usage.NetworkStats.Bucket#DEFAULT_NETWORK_NO , or android.app.usage.NetworkStats.Bucket#DEFAULT_NETWORK_YES |
getEndTimeStamp
open fun getEndTimeStamp(): Long
End timestamp of the bucket's time interval. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis
.
Return | |
---|---|
Long |
End of interval. |
getMetered
open fun getMetered(): Int
Metered state. One of the following values:
A network is classified as metered when the user is sensitive to heavy data usage on that connection. Apps may warn before using these networks for large downloads. The metered state can be set by the user within data usage network restrictions.
Return | |
---|---|
Int |
Value is android.app.usage.NetworkStats.Bucket#METERED_ALL , android.app.usage.NetworkStats.Bucket#METERED_NO , or android.app.usage.NetworkStats.Bucket#METERED_YES |
getRoaming
open fun getRoaming(): Int
Roaming state. One of the following values:
Return | |
---|---|
Int |
Value is android.app.usage.NetworkStats.Bucket#ROAMING_ALL , android.app.usage.NetworkStats.Bucket#ROAMING_NO , or android.app.usage.NetworkStats.Bucket#ROAMING_YES |
getRxBytes
open fun getRxBytes(): Long
Number of bytes received during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.
Return | |
---|---|
Long |
Number of bytes. |
getRxPackets
open fun getRxPackets(): Long
Number of packets received during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.
Return | |
---|---|
Long |
Number of packets. |
getStartTimeStamp
open fun getStartTimeStamp(): Long
Start timestamp of the bucket's time interval. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis
.
Return | |
---|---|
Long |
Start of interval. |
getState
open fun getState(): Int
Usage state. One of the following values:
Return | |
---|---|
Int |
Usage state. Value is android.app.usage.NetworkStats.Bucket#STATE_ALL , android.app.usage.NetworkStats.Bucket#STATE_DEFAULT , or android.app.usage.NetworkStats.Bucket#STATE_FOREGROUND |
getTxBytes
open fun getTxBytes(): Long
Number of bytes transmitted during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.
Return | |
---|---|
Long |
Number of bytes. |
getTxPackets
open fun getTxPackets(): Long
Number of packets transmitted during the bucket's time interval. Statistics are measured at the network layer, so they include both TCP and UDP usage.
Return | |
---|---|
Long |
Number of packets. |
getUid
open fun getUid(): Int
Key of the bucket. Usually an app uid or one of the following special values:
Return | |
---|---|
Int |
Bucket key. |