History log of /frameworks/base/core/java/android/net/TrafficStats.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
24d19fb6ab94cc5fd23f1c9a1d7916948a7fd571 01-Aug-2012 Jeff Sharkey <jsharkey@android.com> Revert "API to adjust network stats."
/frameworks/base/core/java/android/net/TrafficStats.java
e7ed1ce4c84fe92caafc97b1f9044c6647aa3f7f 28-Jul-2012 Jeff Sharkey <jsharkey@android.com> API to adjust network stats. DO NOT MERGE.

Enables system apps to correctly account network usage performed on
behalf of another application.

Bug: 6695246
Change-Id: I39e243afd57936b6b30157a6ca511a17b6c55c39
/frameworks/base/core/java/android/net/TrafficStats.java
234766a36af6214644fa8205202287084ca9cf93 11-Apr-2012 Jeff Sharkey <jsharkey@android.com> Move TrafficStats iface counters to xt_qtaguid.

Use xt_qtaguid iface_stat_all counters, which are monotonic during
a single boot.

Track all ifaces associated with mobile networks since boot, and
move TrafficStats to using these ifaces. This will include usage of
networks omitted from config_data_usage_network_types, specifically
on devices that recycle network interfaces across APNs.

Split wildcard template matching, and move NetworkStatsService to
use mobile wildcard when logging stats.

Bug: 5324515
Change-Id: I2211c374c05d1b598cc647f2f873630538955ffe
/frameworks/base/core/java/android/net/TrafficStats.java
b52e3e55098c4a6e3dbfe19885895411cfb38911 06-Apr-2012 Jeff Sharkey <jsharkey@android.com> INetworkStatsSession with lifecycle for caching.

Users outside system_server now explicitly communicate their
lifecycle, which keeps a strong-reference chain to any fully loaded
NetworkStatsCollection histories.

Bug: 6236498
Change-Id: I8e22739b6e89a626b676967a736d7117fd000778
/frameworks/base/core/java/android/net/TrafficStats.java
241dde2306202e7655fdf41d5381f2874e47e108 03-Feb-2012 Jeff Sharkey <jsharkey@android.com> Unify shorthand for byte-based units.

Change-Id: If990859dee3f0973e1d4c48f05312c84071b3328
/frameworks/base/core/java/android/net/TrafficStats.java
63abc37356728c0575d6a62a203102ae6d97953b 12-Jan-2012 Jeff Sharkey <jsharkey@android.com> Move network stats to FileRotator pattern.

Split existing network stats into two separate classes: a recorder
which generates historical data based on periodic counter snapshots,
and a collection of historical data with persistance logic.

Recorder keeps a pending history in memory until outstanding data
crosses a specific threshold. Persisting is handled through a given
FileRotator. This pattern significantly reduces disk churn and
memory overhead. Separate UID data from UID tag data, enabling a
shorter rotation cycle. Migrate existing stats into new structure.

Remove "xt" stats until iptables hooks are ready. Avoid consuming
Entry values when recording into NetworkStatsHistory. Assign
operation counts to default route interface.

Introduce "Rewriter" interface in FileRotator with methods to enable
rewriteAll(). Introduce IndentingPrintWriter to handle indenting in
dump() methods.

Bug: 5386531
Change-Id: Ibe086230a17999a197206ca62d45f266225fdff1
/frameworks/base/core/java/android/net/TrafficStats.java
5a7bcf31a44d9875ca5fc010dc213aa2bd5b1168 11-Jan-2012 Jeff Sharkey <jsharkey@android.com> Move non-monotonic reporting to interface.

Report non-monotonic NetworkStats through an observer interface
instead of throwing, since those events are still recoverable.

Change-Id: Ic0749f4634b0ac05dbe90e95ca490957ec8b2f23
/frameworks/base/core/java/android/net/TrafficStats.java
163e6443f27884a9bfcb9a48ef606dc635852c23 01-Nov-2011 Jeff Sharkey <jsharkey@android.com> Correct proc file reader, optimizations.

Moved away from BufferedReader, which only reads the first 8KB of
some proc files because it aggresively fills its buffer. Optimized
proc parsing, now double the speed. Tests to cover.

Log when NetworkStats counters roll backwards when subtracting, and
optimizations around findIndex(). When system removes UID, also
remove from last stats snapshot to avoid xt counters from rolling
backwards.

Bug: 5472949, 5458380
Change-Id: I07c08fe5233156fac2b84450f6291868bf9bfaf2
/frameworks/base/core/java/android/net/TrafficStats.java
cdd02c5d76d3dd4e21b5bb922d7fcfb86efec85f 16-Sep-2011 Jeff Sharkey <jsharkey@android.com> Collect and persist tethering stats.

Use new "gettetherstats" netd command to retrieve statistics for
active tethering connections. Keep tethering poll events separate
from UID poll, even though they end up same historical structures.

Bug: 5244846
Change-Id: Ia0c5165f6712c12b51586f86c331a2aad4ad6afb
/frameworks/base/core/java/android/net/TrafficStats.java
d18addb4e3d0cd4da798dd35ad676d98465ebed3 14-Sep-2011 Jeff Sharkey <jsharkey@android.com> Remove deprecated TrafficStats API.

Bug: 5314214
Change-Id: If7dc3ef012a0e998e83ab4fef27ff19398d3e14c
/frameworks/base/core/java/android/net/TrafficStats.java
558a23200697d306b75750cf4612cf0717e73537 25-Aug-2011 Jeff Sharkey <jsharkey@android.com> Data usage buckets active time, parsing ISE.

When recording data usage, measure the actual active time, since
buckets can be quite long. Offer incrementOperationCount() version
that reads thread stats tag for caller. Rethrow any NPE as ISE
during stats parsing, which callers already handle.

Bug: 5171812, 5184508, 5180659
Change-Id: I6da80ccc0162be68bee279529e3a23b6f98ebd87
/frameworks/base/core/java/android/net/TrafficStats.java
b5d55e302d2253e4bfb233ea705caf258cdc4cb9 11-Aug-2011 Jeff Sharkey <jsharkey@android.com> Foreground/background network stats using sets.

Teach NetworkStats about "counter sets" coming from kernel, and use
them to track usage in foreground/background. Add AID_NET_BW_ACCT to
system_server so it can control counter sets.

Move to composite key of NetworkIdentitySet, UID, set, and tag when
recording historical usage. Persisting still clusters by identity,
since that is heaviest object.

Request async stats poll during systemReady() to bootstrap later
delta calculations. Reset kernel counters when UID removed. Update
various tests.

Bug: 5105592, 5146067
Change-Id: Idabec9e3ffcaf212879821515602ecde0a03de8c
/frameworks/base/core/java/android/net/TrafficStats.java
a63ba59260cd1bb3f5c16e395ace45a61f1d4461 20-Jul-2011 Jeff Sharkey <jsharkey@android.com> Add operation counts to network statistics.

Provide API to increment "operation counts" for a UID and tag, used
to eventually derive bytes/operation stats. Internally is stored at
network layer, but should belong at data layer. Switch profiling
to use data layer stats, which are emulated by summarizing network
layer details.

Read packet counts from new /proc/ columns and collect them into
NetworkStatsHistory. Prevent double-counting by ignoring values from
first snapshot. Watch for duplicate /proc/ entries. Update tests
to verify packet and operation counters.

Bug: 5052136, 5097392
Change-Id: I1832f65a2b8a9188f8088f253474a667c21a2f09
/frameworks/base/core/java/android/net/TrafficStats.java
eaef351afcd586d5a84e80455f12f72fd12213ef 19-Jul-2011 Alon Albert <aalbert@google.com> Add a getter for the active tag

Change-Id: I597e041867fba7efae41feea63fa196bc10e4aa2
/frameworks/base/core/java/android/net/TrafficStats.java
8568db534118fc14cc28100306d51626464ff319 29-Jun-2011 Jesse Wilson <jessewilson@google.com> Move socket tagging from libcore.

Change-Id: I7515896936c5bbd212c88e2801b831914219a925
/frameworks/base/core/java/android/net/TrafficStats.java
4414cea13908b8230640f84ef39603d68ff9c377 25-Jun-2011 Jeff Sharkey <jsharkey@android.com> Better network stats parsing, integer tags, async.

Change NMS parsing to handle extended /proc/ stats formats by pairing
values with header keys. Move TrafficStats to integer tags to match
kernel internals, and offer well-known tags for system services.

Async policy event dispatch from NPMS, and update tests to block for
event dispatch. Narrow app policy to exclude apps signed with system
key, which are usually critical.

Bug: 4948913, 4903489, 4585280

Change-Id: Idb357227ccaa617906411f309371cea18d7bc519
/frameworks/base/core/java/android/net/TrafficStats.java
b09540f33a6cabe50edec0ef32d0b1d0b0d96fff 19-Jun-2011 Jeff Sharkey <jsharkey@android.com> Handle removed UIDs in network stats and policy.

When UID_REMOVED, clean up any existing UID network policy so it
doesn't linger for future apps. Also move any NetworkStatsHistory
to special UID_REMOVED tracking bucket.

Tests for new removal code. Also test detailed UID stats, including
network changes to verify template matching logic.

Bug: 4584212
Change-Id: I9faadf6b6f3830eb45d86c7f1980a27cdbcdb11e
/frameworks/base/core/java/android/net/TrafficStats.java
1b5a2a96f793211bfbd39aa29cc41031dfa23950 19-Jun-2011 Jeff Sharkey <jsharkey@android.com> Read "qtaguid" network stats, refactor templates.

Teach NMS to read qtaguid stats from kernel, but fall back to older
stats when kernel doesn't support. Add "tags" to NetworkStats entries
to support qtaguid. To work around double-reporting bug, subtract
tagged stats from TAG_NONE entry.

Flesh out stronger NetworkTemplate. All NetworkStatsService requests
now require a template, and moved matching logic into template.

Record UID stats keyed on complete NetworkIdentitySet definition,
similar to how interface stats are stored. Since previous UID stats
didn't have iface breakdown, discard during file format upgrade.

Change-Id: I0447b5e7d205d73d28e71c889c568e536e91b8e4
/frameworks/base/core/java/android/net/TrafficStats.java
22c055e6424e0e9579711545d8f4800c0f796db8 13-Jun-2011 Jeff Sharkey <jsharkey@android.com> External mutation of full NetworkPolicy set.

Instead of embedding complex template coexistence rules into policy
service, rely on external editors to enforce, and offer atomic
get/set operations for full policy sets.

Generate default mobile policy when none exists, using default of 4GB
warning and cycle reset of current day. Dispatch listener events
through Handler when holding internal lock, and catch CLASS_UNKNOWN
networks in 3G_LOWER template.

Change-Id: I063cf1eaf330e32b75d0697b89fc04488e6dfaea
/frameworks/base/core/java/android/net/TrafficStats.java
3f3913550c10792edb8aecf66cc83c3db5c8b311 06-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist network stats using AtomicFile.

Implements read/write of network stats using AtomicFile, along with
magic number and versioning. Stores in "/data/system/netstats.bin"
for now. Tests to verify that stats are persisted across a simulated
reboot, and to verify that TEMPLATE_WIFI is working.

Fixed bug where kernel counters rolling backwards would cause negative
stats to be recorded; now we clamp deltas at 0.

Change-Id: I53bce26fc8fd3f4ab1e34ce135d302edfa34db34
/frameworks/base/core/java/android/net/TrafficStats.java
d2a458750e5a3d490af09cecb5c28370baf0a913 29-May-2011 Jeff Sharkey <jsharkey@android.com> Map network identity using ConnectivityService.

Instead of deriving network identity based on raw subsystem broadcasts,
listen for updates from ConnectivityService. Added atomic view of all
active NetworkState, and build map from "iface" to NetworkIdentity set
for stats tracking.

To avoid exposing internal complexity, INetworkStatsService calls use
general templates. Added TelephonyManager mapping to classify network
types using broad labels like "3G" or "4G", used to drive templates.

Cleaned up Objects and Preconditions.

Change-Id: I1d4c1403f0503bc3635a59bb378841ba42239a91
/frameworks/base/core/java/android/net/TrafficStats.java
75279904202357565cf5a1cb11148d01f42b4569 25-May-2011 Jeff Sharkey <jsharkey@android.com> Collect historical network stats.

Periodically records delta network traffic into historical buckets to
support other services, such NetworkPolicyManager and Settings UI.

Introduces NetworkStatsHistory structure which contains sparse, uniform
buckets of data usage defined by timestamps. Service periodically
polls NetworkStats and records changes into buckets. It only persists
to disk when substantial changes have occured. Current parameters
create 4 buckets each day, and persist for 90 days, resulting in about
8kB of data per network.

Only records stats for "well known" network interfaces that have been
claimed by Telephony or Wi-Fi subsystems. Historical stats are also
keyed off identity (such as IMSI) to support SIM swapping.

Change-Id: Ia27d1289556a2bf9545fbc4f3b789425a01be53a
/frameworks/base/core/java/android/net/TrafficStats.java
eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3 17-May-2011 Jeff Sharkey <jsharkey@android.com> APIs to profile network usage for current UID.

Added startDataProfiling() and stopDataProfiling() to TrafficStats,
which can be used by apps to measure network usage delta between two
points in time. Currently takes two NetworkStats snapshots and returns
delta, which will eventually include tag-level granularity. Added
tests for NetworkStats delta subtraction.

Added NMS.getNetworkStatsUidDetail() that returns stats for specific
UID. Always gives stats access for the calling UID, otherwise enforces
that caller has permission. Fix readSingleLongFromFile(), since
/proc/ files don't have well-defined lengths.

Change-Id: Ic5b6414d8effbd66846e275b00d4b8a82c74589d
/frameworks/base/core/java/android/net/TrafficStats.java
43be174888684ef3404a43d8434015193c656cce 22-Apr-2011 Jeff Sharkey <jsharkey@android.com> Add Socket tagging for granular data accounting.

Introduces public API to apply "tags" to track data traffic originating
from the current thread. (Under the hood, the tags are maintained and
applied in BlockGuard.) Also adds tag/untag methods for developers who
maintain their own Socket pools.

Change-Id: Ic2dd3155559a93a7b613c7853748d4c44fb3a39e
/frameworks/base/core/java/android/net/TrafficStats.java
227bec49157bc496f7c9e8e8f63c12728a448922 16-Feb-2011 Irfan Sheriff <isheriff@google.com> data activity reporting on wifi

Initial checkin, need icons to complete the feature

Bug: 3412258

Change-Id: I9a3ecc8159cc314d84707065dafe23d402409a84
/frameworks/base/core/java/android/net/TrafficStats.java
beda53d5a69691699edae81923ef974d69ea81c3 31-Jan-2011 Ashish Sharma <ashishsharma@google.com> Fix a minor documentation bug in TrafficStats.

Change-Id: I3cf2199797d875ccb6ab432c298afaace44c7527
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
/frameworks/base/core/java/android/net/TrafficStats.java
c39c1d4dee917560d174f6ba5402e4c6644edd47 28-Jan-2011 Ashish Sharma <ashishsharma@google.com> TrafficStats: Include UDP stats and packet count to API

Change-Id: I70063e6033d3c181bcc5b9e401f9474900e25281
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
/frameworks/base/core/java/android/net/TrafficStats.java
2b4abcd0c7c4361af8ab6d5d7b073fb75ac6d219 08-Apr-2010 Dan Egnor <egnor@google.com> Change TrafficStats to a new JNI implementation.

Also change phone's ConnectionStateTrackers to use it directly,
rather than through the INetStat binder interface.

Bug: 2578938
Change-Id: I8858e2609cbec3be845a0ce5178cb03f67e01b41
/frameworks/base/core/java/android/net/TrafficStats.java
5c19aeca3d41c6a5820dc05a51c38736d3583378 04-Feb-2010 Ken Shirriff <kens@google.com> API review: TrafficStats: rename Pkts to Packets

Rename getMobileTxPackets(), getMobileRxPackets(), getTotalTxPackets(),
getMobileRxPackets()

bug 2420318
/frameworks/base/core/java/android/net/TrafficStats.java
f7d0b01387c10f93bf17981d45087810c80f0902 08-Dec-2009 Ken Shirriff <kens@google.com> Add TrafficStats class to SDK.

This class (a rename of NetStat) provides network byte and packet statistics.
NetStat will be removed separately, to avoid breaking other packages when submitting.
/frameworks/base/core/java/android/net/TrafficStats.java