History log of /frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6a328afbab37981f34d8578972dbb2bf1abb7c41 01-Dec-2012 Jeff Sharkey <jsharkey@android.com> Avoid null mobile interfaces.

Bug: 7634215
Change-Id: I6745f6a78c07ba11d98b4562a6b53386112ef652
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
8b2c3a14603d163d7564e6f60286995079687690 12-Nov-2012 Jeff Sharkey <jsharkey@android.com> Useful annotations for code documentation.

Bug: 6537978
Change-Id: I806c3c09e3255f8789455f13bf37c1dde2a93f1f
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
625239a05401bbf18b04d9874cea3f82da7c29a1 27-Sep-2012 Jeff Sharkey <jsharkey@android.com> Migrate more Secure settings to Global.

Migrate networking, storage, battery, DropBox, and PackageManager
related Secure settings to Global table.

Bug: 7232014, 7231331, 7231198
Change-Id: I772c2a9586a2f708c9db95622477f235064b8f4d
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
daa57e8d1866fe4579c280c41604f3660db7cd01 19-Sep-2012 Jeff Sharkey <jsharkey@android.com> Migrate network stats from removed users.

When a user is removed, migrate all network stats belonging to that
user into special UID_REMOVED bucket. Also removes those stats from
kernel to avoid double-counting if another user is created.

Bug: 7194784
Change-Id: I03f1d660fe3754566326b7749cae8068fc224ea9
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
e6e6197d7c2eb5c29224bcddb0131a302267f6de 14-Sep-2012 Jeff Sharkey <jsharkey@android.com> Actually move to Global settings.

Also add better ConnectivityService logging.

Bug: 7157464
Change-Id: Ia235a7e62ed809240913c4782920c1410c7d597d
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
023c05a341b87d0899c89bf355b6ae27d138bb03 14-Sep-2012 Jeff Sharkey <jsharkey@android.com> Move to Global.NETSTATS and Global.NTP constants.

Bug: 7157464
Change-Id: Ief10fd37940f62420f5684940994c9f93802e0be
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
5ac72a29593ab9a20337a2225df52bdf4754be02 30-Aug-2012 Dianne Hackborn <hackbod@google.com> Improve multi-user broadcasts.

You can now use ALL and CURRENT when sending broadcasts, to specify
where the broadcast goes.

Sticky broadcasts are now correctly separated per user, and registered
receivers are filtered based on the requested target user.

New Context APIs for more kinds of sending broadcasts as users.

Updating a bunch of system code that sends broadcasts to explicitly
specify which user the broadcast goes to.

Made a single version of the code for interpreting the requested
target user ID that all entries to activity manager (start activity,
send broadcast, start service) use.

Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
216c181e76ee11a47a0b2a180f9af96740ab38ad 05-Aug-2012 Jeff Sharkey <jsharkey@android.com> Make generic BaseNetworkObserver.

This makes it easier to add new INetworkManagementEventObserver events
in future.

Change-Id: I432263d745558de4b878f313c1951230ed9db2b1
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
24d19fb6ab94cc5fd23f1c9a1d7916948a7fd571 01-Aug-2012 Jeff Sharkey <jsharkey@android.com> Revert "API to adjust network stats."
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
70c70530bd6793869736ec894498e4ebf5dc9b20 16-May-2012 Jeff Sharkey <jsharkey@android.com> Transition from DEV network stats to XT.

When XT stats are available, transition to prefer them over DEV,
since they aren't subject to hardware driver bugs. Only switches at
the first atomic XT bucket, and adds a Settings.Secure flag to force
back to DEV if needed. Includes tests to cover transition.

Fix tests where device overlay would change which network types
reflected data usage. Test both history and summary APIs. Fixed
collection timestamps to reflect full buckets.

Bug: 6504744
Change-Id: Idd7f3b2fdb064c36547c85c51c214fd938c59b7e
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
20f5c3d4135809ca0b72c23e0c8daf2a8e4e84b2 10-May-2012 Jeff Sharkey <jsharkey@android.com> Avoid updating thresholds during shutdown.

Bug: 6472388
Change-Id: I70e1ed5dc75056840f2f0b130ce0dfecb06f385e
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
6de357e4d10fa5977ab9a6c665dc858765e95d34 09-May-2012 Jeff Sharkey <jsharkey@android.com> Recover from Throwable in FileRotator, dump.

In rewriteSingle(), catch Throwable to rollback to backup file,
instead of just IOException. Also add dumpAll() to pack up contents
for later debugging, and use it when encountering bad stats.

Bug: 6467868
Change-Id: Ic8e287cf5a235706811a304a88d71d11d3a79cd4
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
5801597a90949240e99c3980c0bb889deeec2e5c 07-May-2012 Jeff Sharkey <jsharkey@android.com> Ack, wrap advisePersistThreshold() in lock.

Bug: 6449725
Change-Id: I702dc2ff9d4b237c46d89bcae41289bc3e9ef2f8
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
ac3fcb1590e1da21324c13ce237ec48f2bf488bf 03-May-2012 Jeff Sharkey <jsharkey@android.com> Reduce persist threshold for lower warning/limit.

Default is 2MB persist threshold, but even that can be substantial
for devices on 100MB/month plans. This change gradually reduces the
persist threshold up to 8x lower (256kb outstanding) based on lowest
active policy.

Bug: 5382676
Change-Id: Ief4e8cdb169bfb151a3d1b45722a8eaa01926508
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
e8914c36276710de50b347c1e6aecfa45d6a56cd 02-May-2012 Jeff Sharkey <jsharkey@android.com> Begin collecting xtables iface counters.

Add method to parse new iface_stat_fmt proc stats, or return null
when kernel support is unavailable. Add test and remove older, unused
parsing code. Create new "xt" recorder to persist the new xtables
counters when available.

Add SSID support to NetworkIdentity to fix policy tests.

Bug: 6422414
Change-Id: I77f70e9acb79a559ab626f3af5c4f3599801ed43
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
49c1d1764bce02cf12a68e9312f3aa9dfa2e25ce 23-Apr-2012 Jeff Sharkey <jsharkey@android.com> Clear identity when checking if bandwidth enabled.

Change-Id: I0f10f86dc14483e29609057c671454b322da4826
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
4190a047ca1c5eb19a1f7e5d599ef1d532da71c7 22-Apr-2012 Jeff Sharkey <jsharkey@android.com> Better assertions when bandwidth module disabled.

Also disable some verbose logging in WifiStateTracker.

Bug: 6368329
Change-Id: I9a5219bc1b3fd870468f7de46cdf4f173a437c59
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
bfdd680ab44da173a4a39fcd6feccdebb9d1f855 09-Apr-2012 Jeff Sharkey <jsharkey@android.com> Migrate to @Override to remove warnings.

Bug: 6303344
Change-Id: I0d33b2ed448467379d576ccd71fb5ae20c878852
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
21a547823de52806de48f70b8360353344a5ad88 09-Apr-2012 Jeff Sharkey <jsharkey@android.com> Splice operations before collapsing ifaces.

Bug: 6241038
Change-Id: Ide9058703f7305df8fb070af149ddce0653a0abf
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
8fc27e8b87bd1def854a03d84009143b315d4176 05-Apr-2012 Jeff Sharkey <jsharkey@android.com> Support metered Wi-Fi NetworkPolicy.

Add networkId field to NetworkIdentity to identify Wi-Fi networks by
SSID. Add support for policies without usage cycles.

Only apply mobile policies when SIM state is ready, which is cleaner
than just checking for airplane mode. Also avoids creating no-op
default policies when subscriberId is null.

Bug: 3001465, 3291052
Change-Id: I1f8aaa49a5db306df022c402ea7f3f5d4bc0cfc7
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
d4dd7716fb825f29a609c5c4cb31204eea78183a 16-Mar-2012 Jeff Sharkey <jsharkey@android.com> Combine network subtypes by default.

Subtype controls (3G-vs-4G) aren't exposed in the UI, so tracking
data with that granularity creates unnecessary overhead. For example,
some GSM networks can regularly flap between two subtypes.

Bug: 6118868
Change-Id: Id098891dba52336d00d0f96632a7924e228b4713
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
6341fcecc8826924a4bb24169aaf80fec9a20894 07-Mar-2012 Jeff Sharkey <jsharkey@android.com> Avoid updating network stats after shutdown.

Bug: 6109476
Change-Id: I9a3a8b182c8fa56d83ddc755d204d5b267c9bc5d
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
706498d387eaceb574cf4aa982fee3c288819dad 07-Feb-2012 Jeff Sharkey <jsharkey@android.com> List rotated netstats files during --checkin dump.

Also disable verbose logging.

Change-Id: I4c51e05d695eac43f0d9c28f9699f1655c642a99
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
241dde2306202e7655fdf41d5381f2874e47e108 03-Feb-2012 Jeff Sharkey <jsharkey@android.com> Unify shorthand for byte-based units.

Change-Id: If990859dee3f0973e1d4c48f05312c84071b3328
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
25ce9ed57f137dc0b21045ab90fe595640ebf926 02-Feb-2012 Jeff Sharkey <jsharkey@android.com> Avoid NDC deadlock when re-arming network alert.

When NDC delivers limitReached() event, NMS re-arms the alert, which
makes another call back to NDC. If NDC already started processing
another call, this causes deadlock.

Fix this by re-arming on a handler thread.

Bug: 5879848
Change-Id: I46fa78fe1f1122c5f31dd6020483e5ae89a9f39d
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
e630f7b31bb1e77a2eb4ef3102a25f2927cfd5c3 01-Feb-2012 Jeff Sharkey <jsharkey@android.com> Clear identity when updating network stats.

Bug: 5945461
Change-Id: Ie51ea3f107a705c395b65684f21bf4c28c7f4d33
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
4529bb66c47fd02b990ecb0810031157b4f36c2f 14-Dec-2011 Jeff Sharkey <jsharkey@android.com> Move NMS to CONNECTIVITY_INTERNAL permission.

Change-Id: I6043c1b9cb10aeeafb93d1b5c60da571d2fec5c9
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
17b289048766d6b101e70061fe5774ec8f370b55 14-Dec-2011 Jeff Sharkey <jsharkey@android.com> Merge "Avoid reading network stats when disabled."
418d12dc8f2c518b673ebc522de4af6f7dbf0bf3 14-Dec-2011 Jeff Sharkey <jsharkey@android.com> Avoid reading network stats when disabled.

Bug: 5518868
Change-Id: Idb5c588b018bf735597ad7ff904ecc69224dd0a0
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
d04ff11d6fa5eb26ca19ac9962b899d9fb0470f0 13-Dec-2011 Jeff Sharkey <jsharkey@android.com> Avoid NPE when missing network stats.

Bug: 5750339
Change-Id: I4b739dbd076b270a5a2b2e2a1e0f6e445d8c124e
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
c506ff615080082515b1f634ad49b19fd2111669 17-Nov-2011 Jeff Sharkey <jsharkey@android.com> Only write network stats when already loaded.

Bug: 5584564
Change-Id: Ife2a68804bf3691e9bccdc167807204bce8a85b2
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
684c54a2eb860062f1960f4eba6bc71aa1cfa71d 17-Nov-2011 Jeff Sharkey <jsharkey@android.com> Update NTP outside locks, log large trim events.

Move NTP updates outside locks to avoid blocking ShutdownThread. Add
logging around trim events that remove substantial history. Include
history start in sample events.

Bug: 5627247, 5584564
Change-Id: If9bbd93842c710efcdec94e68da87e9e42a5f961
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
7ee8658453fe4efe04781bea9a14368e1d5ff41f 15-Nov-2011 Jeff Sharkey <jsharkey@android.com> Conservatively trim data usage stats.

Instead of trusting NTP time alone, use the most-conservative of
system clock and NTP.

Bug: 5584564
Change-Id: I5dd87fc009959b1cf0a7d660e385a0b1a8be238b
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
d4ef8c8fc9ea70448e5d8138bf8bc96f4e69903f 11-Nov-2011 Jeff Sharkey <jsharkey@android.com> Clamp non-monotonic stats instead of dropping.

When encountering non-monotonic stats rows, recover remaining data by
clamping to 0. In particular, this avoids edge-case where persisting
threshold checks would never trigger. Also recover when tethering
snapshots are missing.

Bug: 5600785, 5433871, 5600678
Change-Id: I1871954ce3955cc4ac8846f9841bae0066176ffe
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
630a13bdd88723599a7617ca4df20ab923e7ffbb 09-Nov-2011 Jeff Sharkey <jsharkey@android.com> Merge "Bootstrap stats before registering listeners." into ics-mr1
3359aca7655a7d18615c1ada6cbabeff403947d1 09-Nov-2011 Jeff Sharkey <jsharkey@android.com> Bootstrap stats before registering listeners.

Also move ISE to handled NonMonotonicException.

Bug: 5570872
Change-Id: I793f349287ef5589185f117dfbec6f1fad73a661
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
4abb1b8ef64dc4cd71966b59dc5d72a15055bf13 09-Nov-2011 Jeff Sharkey <jsharkey@android.com> Make operation counts monotonically increase.

Bug: 5585704
Change-Id: I5247a68acdb209a4ef0f5aac18944595c295e6ca
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
293779f9c63cbae0dde564449f0270b595593b0d 06-Oct-2011 Jeff Sharkey <jsharkey@android.com> Refine random stats generation.

Offer parameters to pick out specific list of packages, and to change
duration and total data.

Bug: 5416742
Change-Id: I6970a5e76f3198ef23a400c079037212b000ca6b
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
905b5891d2aa802f447ac2ce5d77b6c5ba06277a 01-Oct-2011 Jeff Sharkey <jsharkey@android.com> Track xtables summary, move tether stats, time.

Begin tracking xtables summary of data usage to compare with values
reported from /proc/net/dev. Roll tethering directly into UID stats
to trigger UID stats persisting when crossing threshold.

Include xtables summary and authoritative time in samples.

Bug: 5373561, 5397882, 5381980
Change-Id: Ib7945522caadfbe0864fdf391582dc820f4f371e
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
367d15ab1a33b6159447fa8542d4fa8ff148371c 22-Sep-2011 Jeff Sharkey <jsharkey@android.com> Watch network subtype, tethering teardown, empty.

Watch for changes to telephony network subtype, and update iface
mapping to persist stats under correct type. Update network stats
before removing tethering NAT rules.

Skip recording that would create empty historical buckets. Query UID
stats before iface stats to always skew positive when counters are
actively rolling forward.

Bug: 5360042, 5359860, 5335674, 5334448
Change-Id: I8aa37b568e8ffb70647218aa1aff5195d3e44d5a
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
92cefaeb319b2642d119abb8640828ff0bbf2ac7 20-Sep-2011 Jeff Sharkey <jsharkey@android.com> Upload correct txPackets count.

Bug: 5321340
Change-Id: Ie4dc7a91bf1cdc4d64c75ff09ae0cdd0fb141b5d
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
1f0b13b9d64085dd8342ba942f39b6063b6d534d 18-Sep-2011 Jeff Sharkey <jsharkey@android.com> DO NOT MERGE: Sample atomic network stats buckets, full poll.

When sampling network stats, always use atomic buckets instead of
interpolating. Always poll iface and UID together so we distribute
into buckets equally. Move stale bucket trimming to just before
writing stats.

Bug: 5321340
Change-Id: I78a2226778a79c875f3668336e39ea24a7b4d5c4
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
991d1b1b3f303ad247a959881b1d5b57766f678b 15-Sep-2011 Jeff Sharkey <jsharkey@android.com> Network stats flag to force complete poll.

Devices currently delay collecting UID stats during common operations
like global alerts to reduce parsing load. Here we introduce a flag
to always collect UID and iface stats together to aid debugging.

Bug: 5321340
Change-Id: Ia8e1daf1a6f9d5f5cf1f64a04b6b6766ee965ab6
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
b3d5957604f8fcaafe72bd76052bc76b682bf443 08-Sep-2011 Jeff Sharkey <jsharkey@android.com> Poll UID stats during iface changes, enforce idx.

When ifaces change, poll UID stats without persisting, since they
depend on knowing active iface to store correctly. Log dropped UID
stats when iface is unknown. Switch to using flags when calling
performPoll().

Enforce that "idx" values are consistent from xt_qtaguid. Transition
to using Log.wtf() for important checks, mostly around file I/O,
kernel stats parsing, and kernel module control. Increase stats
persist threshold to 2MB to reduce churn.

Bug: 5269476, 5270106
Change-Id: I721215bfb65127f95775c71cf135e907cd567e92
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
07b0dd9a092273f0451cd9881312cb9b22a7af3f 01-Sep-2011 Jeff Sharkey <jsharkey@android.com> Sample network statistics for sanity check.

After detailed poll events, sample high-level network statistics to
sanity check iface totals against UID totals.

Bug: 5248382
Change-Id: I1c1fbb7c094c9ff0c9dde416467c563dda68f478
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
961e30458319cfd50e1892ba7dd14a1d0ebe4cc7 30-Aug-2011 Jeff Sharkey <jsharkey@android.com> Introduce immediate CONNECTIVITY_ACTION variant.

New broadcast that is dispatched immediately after connectivity
changes have been handled by ConnectivityService, bypassing any
applicable CONNECTIVITY_CHANGE_DELAY.

Also protect CONNECTIVITY_CHANGE broadcasts, since they should only
be sent by system.

Bug: 5198167
Change-Id: I75f1fb44b21da1879f0ab960bcaa481126d70fde
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
47eb102b40cd1324d89816a7fb0fecd14fd7a408 26-Aug-2011 Jeff Sharkey <jsharkey@android.com> Always splice historical data stats, debug info.

When reading network counters, always splice in xt_qtaguid values
to avoid counting backwards. Test to verify.

Remove verbose logging around global alerts, and add dumpsys debug
info for NMS and MDST. Also fix subtle bug around stats persisting
and dumping.

Bug: 5212893, 5211028
Change-Id: I783e5286637a67ee2dd2b09878198711a926d0cb
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
8e9992ae5053a3ac52d28a5a892aed0a0798c7ab 24-Aug-2011 Jeff Sharkey <jsharkey@android.com> Register for kernel global data usage alerts.

Instead of polling every 15 minutes, register for alerts that trigger
when system-wide traffic passes a threshold. Still mixed with polling
to persist UID stats, but relaxed to 30 minutes. Currently watches
for every 512kB.

Make persistence decision separately for network versus UID, and use
total delta bytes when making decision. Use light bootstrap during
systemReady() instead of heavy poll, which had been force-loading all
UID data unnecessarily.

Bug: 5023631
Change-Id: I04b723d6c4bf872fb1028071122dba66a8e1b576
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
63d27a9233fed934340231f438493746084a681d 04-Aug-2011 Jeff Sharkey <jsharkey@android.com> Network stats with varint, omit parcel fields.

Persist NetworkStatsHistory using variable-length encoding; since
most buckets have small numbers, we can encode them tighter. Initial
test showed 44% space savings. Also persist packet and operation
counters.

Let NetworkStatsHistory consumers request which fields they actually
need to reduce parcel overhead.

Tests for verify varint and history field requests, also verify end-
to-end by persisting history into byte[] and restoring. Expose
bandwidth control enabled state. Extend random generation to create
packet and operation counts. Moved operation counts to long.

Fix bug that miscalculated bytes since last persist, which would
cause partial stats loss when battery pulled.

Bug: 4581977, 5023706, 5023635, 5096903
Change-Id: If61e89f681ffa11fe5711471fd9f7c238d3d37b0
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
6248926e199dca9bde3c76c5f82c486c293cdcdd 17-Jul-2011 Jeff Sharkey <jsharkey@android.com> Acquire wakelock during network stats collection.

Bug: 4517275
Change-Id: I01dfe3b13d7aca84605446e9e9927d0648623552
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
4e814c348ce205fcc1a273427f95ef1d100ed60c 15-Jul-2011 Jeff Sharkey <jsharkey@android.com> Hide NetworkTemplate details, buffered stats I/O.

Move template matching to builder methods instead of exposing the
internal constants. Also rule to match Ethernet usage. Buffer
reading and writing of network stats, making operations 5x faster.

Change-Id: Iedb2d0ab3b26a976811c050f84a164e909eb74b6
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
434962e44ea93b1c4d216c55f636a435bf54aa54 13-Jul-2011 Jeff Sharkey <jsharkey@android.com> Include full network history around current time.

When requesting historical values with time ranges, always include
full values for buckets that span current time. (It doesn't make
sense to interpolate partial data.) Move getTotalData() to return
full Entry objects to prepare for packet counts.

Bug: 4691901
Change-Id: I717bd721be9f1d4a47c4121e46e07a56cb15bbf1
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
d37948f6ed1667d077e0e3a38808f42f981ddcc2 12-Jul-2011 Jeff Sharkey <jsharkey@android.com> Hide NetworkStatsHistory internals.

Instead of exposing internal storage details, offer getValues()
accessor which populates values into a recycled structure.

Change-Id: I5228d7099a8f61b2018a435a813435a67dae49b4
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
104344e507610be42fb70c7deda3c422c543bfcb 10-Jul-2011 Jeff Sharkey <jsharkey@android.com> Cached NTP time for system services.

Uses NTP server and timeout from secure settings, or fallback to
defaults in resources. Update various system services to use cached
NTP time when fresh enough, or force updates as needed.

Bug: 4517273
Change-Id: Ie1c4c4883836013d02ca0bbd850cf8949f93b34b
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
350083e36b9db6062e165954403ef921ff3dfdad 29-Jun-2011 Jeff Sharkey <jsharkey@android.com> Migrate bandwidth control to NMS, omit history.

Both stats and policy make NMS calls that depend on bandwidth control
being enabled, so move enable/disable into NMS and drop calls when
disabled. This avoids throwing heavy ISE exceptions when disabled.

Only include recent data when writing NetworkStatsHistory as part of
dumpsys call. Introduce manual poll event for Settings UI.

Bug: 4982115, 4770435, 4515856
Change-Id: I257820b057af2f0f99c736fb4f61e55b9fdc3e66
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
d94585279f0903259c4434aabe0dbdd141b6dbab 28-Jun-2011 JP Abgrall <jpa@google.com> NetworkStatsService: disabled by default

For now, there is still too much breakage around the kernel's new
qtaguid netfilter.
So no netstats up front.

But enable on the device until wiped:

./vendor/google/tools/override-gservices secure:netstats_enabled=1
adb reboot


Bug: 4903513

Change-Id: I230bd2d4efab85cac5c9abaa7d638c94f5e0c7d6
Signed-off-by: JP Abgrall <jpa@google.com>
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
b851cc23c80761f19ebd2839a35be49be30d9b14 23-Jun-2011 JP Abgrall <jpa@google.com> NetworkStatsService: check kernel bandwidth support before enabling

And catch the actual errors reported by the other side of NetworkManager.


Change-Id: I9a9393b659d6f896ee1bf40a8deaca7853ef8f94
Signed-off-by: JP Abgrall <jpa@google.com>
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
0a9ee1272b59ad350cea591f931b52290a5e0998 23-Jun-2011 Jeff Sharkey <jsharkey@android.com> Enable bandwidth module from stats service.

During systemReady(), tell netd to enable bandwidth tracking module,
which is used to provide detailed stats and controls.

Change-Id: Iecfd8b17a3b90f5a817d731fbe1c71777681ed6e
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
d03fd3f004e3ba8aaa1692ee0e92e8ae171d2a04 20-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist "tagged" network stats along with UIDs.

Now stores tags other than TAG_NONE (0x0), which are useful for app
debugging. Combine UID and tag together into single long key, and
expose tag data through AIDL when requested. Change NMS to track
TAG_NONE as total UID traffic, matching the kernel definition.

Added TAG_MAX_HISTORY to control how long tag-granularity statistics
are stored; overall UID usage is still kept for UID_MAX_HISTORY. Fix
bug to trim NetworkStatsHistory outside normal polling loops to catch
non-active networks and UIDs.

Test to verify UID and tag packing, and to verify that UID traffic on
two networks are combined to match MOBILE_ALL template.

Change-Id: If0e039416d9e7f63b1a39e04cddfb1133b5a78ee
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
af8339374fbf1e2f57b0be918c7fc772f4250f13 17-Jun-2011 Jeff Sharkey <jsharkey@android.com> Avoid clobbering UID stats when not yet loaded.

Bug: 4690822
Change-Id: Ia6c9e8f89e89739cf3380c4b98b9da6f52db48fa
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
497e4437af386930dff3bd55296d128bd4520959 15-Jun-2011 Jeff Sharkey <jsharkey@android.com> Data usage warning and limit notifications.

Watch for network statistics to cross NetworkPolicy warning or limit,
and show notifications to user as needed. Currently checks during
any statistics update, but will eventually move to event registration
through netd when kernel supports.

Fixed accounting bug in getSummaryForNetwork(). Only apply UID policy
to applications; applying to system processes could break critical
services like RIL.

Change-Id: Iac0f20e910e205f3cbc54ec96395ff268b1aa379
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
4a97122ebf4d92a3f94402041729d77905e6c0c0 12-Jun-2011 Jeff Sharkey <jsharkey@android.com> Growable NetworkStats object instead of builder.

NetworkStats now grows in place with arraycopy() instead of callers
needing to know record count a priori. Better growth calculation for
both NetworkStats and NetworkStatsHistory; 50% each time. Better
estimates of buckets needed in calling services.

Change-Id: I3adbffa0b7407612cc6349d9135a8b4eb63cd440
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
39ebc2195ed16b9e955dd57f5c95212bb7b934b6 12-Jun-2011 Jeff Sharkey <jsharkey@android.com> Persist UID stats, lazy loading, resize buckets.

Persisting detailed UID stats in separate "netstats_detail.bin" file
to enable different schedules for summary and detail polling. Only
load detailed UID history on demand, since it's not needed during
boot. Add test to verify UID stats are persisted across simulated
reboot.

Move external settings into well-named interface, which is still
backed by Settings.Secure. During periodic poll events, resize any
history to match current bucket duration setting. Test to verify.

Change-Id: I6366f3583a591f8ba859b0e5987daf8cafa4e95a
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
21c9c45e5caf62b935354b74392fb40c4bf18529 07-Jun-2011 Jeff Sharkey <jsharkey@android.com> Interface-level network policy, persist policies.

Define NetworkPolicy as cycle-reset day and warning/limit values, and
set/get through NetworkPolicyManager. Watch ConnectivityManager for
network connection events, and apply quota rules based on matching
interfaces. Policy service matches based on strong identity to support
IMSI-specific policy values.

Calculates remaining quota based on current stats recorded since the
last reset cycle day. Tests to verify edge cases around February.

Persist network and UID policies in XML, and restore on boot.

Change-Id: Id40ba7d6eed6094fbd5e18e6331286c606880d80
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java
19862bf5d058b6ab0c2979e7a5e0297dae6b170b 03-Jun-2011 Jeff Sharkey <jsharkey@android.com> Compute range-based usage in NetworkStatsHistory.

When given a start/end range, interpolate between buckets to return
the total network usage. Used to summarize detailed UID stats. Method
to combine NetworkStatsHistory regardless of bucket size. Used to
combine all histories matching a template.

Added tests for both methods.

Change-Id: Ia463910c0ecf7cf08dcf97c658ad99742bd6b882
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.java
61ee0bbb5b87fb5c4c3dc219868d52743def3d2b 30-May-2011 Jeff Sharkey <jsharkey@android.com> UID network stats, secure settings, and random.

Collect UID-granularity network stats during regular poll event. Add
dumpsys argument to generate fake historical data for debugging, and
move stats parameters to Settings.Secure.

Change-Id: I09b36a2955dc10c697d4b9c3ff23dcb3ac37bd70
/frameworks/base/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.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/services/java/com/android/server/net/NetworkStatsService.java