Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Data usage tags explained
Stay organized with collections
Save and categorize content based on your preferences.
Tags represent one of the metrics the data usage counters will be
tracked against. By default, and implicitly, a tag is just based on
the UID. The UID is used as the base for policing, and cannot be
ignored. So a tag will always at least represent a UID (uid_tag). A
tag can be explicitly augmented with an "accounting tag" which is
associated with a UID. User space can use
TrafficStats.setThreadStatsTag()
to set the acct_tag portion of the
tag which is then used with sockets: all data belonging to that
socket will be counted against the tag. The policing is then based on
the tag's uid_tag portion, and stats are collected for the acct_tag
portion separately.
Without explicit tagging, the qtaguid module will assume the
default_tag: {acct_tag=0, uid_tag=10003}
a: {acct_tag=1, uid_tag=10003}
b: {acct_tag=2, uid_tag=10003}
c: {acct_tag=3, uid_tag=10003}
a, b, c…
represent explicit tags associated with specific sockets.
default_tag (acct_tag=0)
is the default accounting tag that contains
the total traffic for that uid, including all untagged
traffic, and is typically used to enforce policing/quota rules.
These tags can be used to profile the network traffic of an
application into separate logical categories (at a network socket
level). Such tags can be removed, reapplied, or modified during
runtime.
The qtaguid module has been implemented on kernel/common branch of
android-3.0
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-08-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-26 UTC."],[],[],null,["# Data usage tags explained\n\nTags represent one of the metrics the data usage counters will be\ntracked against. By default, and implicitly, a tag is just based on\nthe UID. The UID is used as the base for policing, and cannot be\nignored. So a tag will always at least represent a UID (uid_tag). A\ntag can be explicitly augmented with an \"accounting tag\" which is\nassociated with a UID. User space can use\n`TrafficStats.setThreadStatsTag()` to set the acct_tag portion of the\ntag which is then used with sockets: all data belonging to that\nsocket will be counted against the tag. The policing is then based on\nthe tag's uid_tag portion, and stats are collected for the acct_tag\nportion separately.\n\nWithout explicit tagging, the qtaguid module will assume the\n`default_tag: {acct_tag=0, uid_tag=10003}` \n\n```\n a: {acct_tag=1, uid_tag=10003}\n b: {acct_tag=2, uid_tag=10003}\n c: {acct_tag=3, uid_tag=10003}\n```\n\n`a, b, c...` represent explicit tags associated with specific sockets.\n\n`default_tag (acct_tag=0)` is the default accounting tag that contains\nthe total traffic for that uid, including all untagged\ntraffic, and is typically used to enforce policing/quota rules.\n\nThese tags can be used to profile the network traffic of an\napplication into separate logical categories (at a network socket\nlevel). Such tags can be removed, reapplied, or modified during\nruntime.\n\nThe qtaguid module has been implemented on [kernel/common branch of\nandroid-3.0](https://android-review.googlesource.com/#/q/project:kernel/common+branch:android-3.0,n,z)"]]