History log of /frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d86b8fea43ebb6e5c31691b44d8ceb0d8d3c9072 03-Jun-2017 Jeff Sharkey <jsharkey@android.com> Annotate @SystemApi with required permissions.

Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
50a021a019ef706ca6f9c9471d41269a0e6c6afa 07-Nov-2016 Stephen Chen <stewchen@google.com> Fix documentation for NetworkStatsManager methods.

Test: N/A
Change-Id: I054ce104e561ece8e414c7ddad718665e51a692e
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
25147878974f82f875062e99cdee85dd33f3f078 21-Oct-2016 Stephen Chen <stewchen@google.com> Implement metered tracking for NetworkStats summary queries.

Dependent on ag/1550196 where API is defined.

Bug: 31015360
Bug: 26545374
Test: runtest --path
frameworks/base/core/tests/coretests/src/android/net/NetworkStatsTest.java,
other test classes.

Change-Id: I968b9e3352d7880e3fc438f12de628a2da057e0a
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
49ca529a850e60482ddcc8c0762105b4aa10f35f 10-May-2016 Jeff Sharkey <jsharkey@android.com> Avoid caching services with missing binders.

When fetching system services early during boot, if the underlying
binder interface hasn't been published yet, we end up caching a
manager class that is broken for the remainder of the process
lifetime, and innocent downstream callers end up using the broken
cached manager.

Fix this by using an explicit exception to quickly abort manager
creation when the underlying binder is missing. The exception is
only used to skip the remainder of the manager creation, and it
doesn't actually crash the process.

Bug: 28634953
Change-Id: I0cb62261e6d6833660704b93a11185aa11a2ac97
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
f704837429a8d3024a71f6139eb7e5dcb780cd9a 21-Jun-2016 Antonio Cansado <acansado@google.com> Fix infinite loop when registering data usage callback.

Trivial fix is to call the method that takes the handler as a param.

Bug: 29508547
Change-Id: I75ba30a1663be265eed56b24deda82e83fd47a43
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
904237f83940676433104952d165d3b28d961044 25-May-2016 Antonio Cansado <acansado@google.com> Cleaning up NetworkStatsManager.

- Throwing SecurityExceptionand and IllegalArgumentException instead of null for new APIs
- removing @removed APIs

Bug:27530098,27379882
Change-Id: Ifbe65bfc5051aa33aff2baa22cfa8e67b0f7c358
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
6965c1869aa8499706522d057b5143bbc240178b 30-Mar-2016 Antonio Cansado <acansado@google.com> Addressing API council comments on NetworkStatsManager.

Callbacks
- DataUsageCallback renamed to UsageCallback
- DataUsagePolicy removed; passing in params directly to register method
- making it an abstract class
- passing in (networkType, subscriberId) that reached its threshold
- renaming onLimitReached to onThresholdReached to match existing naming
- only monitor single network,subscriberId
- no monitoring of specific uids; using device or user wide instead

Tags
- only owner uid can read its tags
- exposing only TAG_NONE to match service side

BUG: 27530098

Change-Id: I2b2664da71806868a1e937d2bf4d1f234637509b
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
cd42acd9515bdce89d4f1401ee2888d684bf1918 17-Feb-2016 Antonio Cansado <acansado@google.com> Implementation of data usage callbacks.

NetworkStatsService will register data usage requests
and keep data usage stats scoped to the request.

There are different types of data usage requests
- scoped to a set of NetworkTemplate; these are restrictred to
device owners and carrier apps and allow the caller to monitor
all activity on the specified interfaces.
- scoped to all uids visible to the user, if the user has
android.Manifest.permission#PACKAGE_USAGE_STATS permission.
The set of uids may change over time, so we keep track of that.
- scoped to a set of uids given by the caller, granted that
the caller has access to those uids.
- scoped to the caller's own data usage. This doesn't require
PACKAGE_USAGE_STATS.

Bug: 25812785
Change-Id: Ie11f35fc1f29d0dbe82f7fc924b169bb55c76708
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
ba8288d238737de7d8461fa0d77b3c46ee8d8d62 02-Dec-2015 Antonio Cansado <acansado@google.com> Adding a callback to notify data usage.

Allow holders of android.Manifest.permission#PACKAGE_USAGE_STATS
to be notified when data usage has exceeded a given threshold.
This allows an app to update its data usage metrics without
polling.

Bug: 25812785
Change-Id: I3a4904a97f3c7fbaf8071b460f9ee6ca9c1ba4ed
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
46c75367fa47bfd0429cab6121da0b897b5620a2 11-Dec-2015 Antonio Cansado <acansado@google.com> Retuning tag information through NetworkStatsManager.

Network tags could be set since ICS but was not exposed
through the SDK. This CL extends existing functionality
of NetworkStatsManager to return network tags.

Bug: 25813338
Change-Id: I414b98193249ba88a3f2d64cb2e0d2633f64fa3f
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
3a8b343ce5220086c4f71e63f5d42f2d28434c4b 21-Jan-2016 Zoltan Szatmary-Ban <szatmz@google.com> Introduce DEVICESUMMARY access level to NetworkStatsAccess.

Apps with PACKAGE_USAGE_STATS app op or READ_NETWORK_USAGE_HISTORY
granted can query the summarized device data usage (but not individual
uids running in other users or profiles).

Bug:26677052
Change-Id: Id51631638f338a8cf48172c9b41746228a335084
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
a6a78076eeb27084ed815ce0492d4ffe08134bec 12-Jan-2016 Jeff Davidson <jpd@google.com> Implement roaming tracking in NetworkStats summary queries.

Whether a network is deemed roaming or not was already being tracked
as part of the NetworkIdentitySet, so the underlying data store
already tracks roaming and native data separately. However, this data
was being aggregated together in NetworkStatsCollection#getSummary,
since the NetworkIdentitySet is converted to an iface name for the
purposes of matching, and the iface name will be identical whether or
not the iface is considered roaming. Now it is separated.

Also fixes a long-standing bug in NetworkIdentitySet where an identity
read from a saved file would always be considered roaming == false,
even if it wasn't at the time it was written.

Bug: 25813438
Change-Id: I11ab5b51182ed8da7af8fde468df065f9fdc3dad
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
1efb1335814aea8ee0696144ca0ab24159b86e54 10-Dec-2015 Jeff Davidson <jpd@google.com> Relax permissions around NetworkStatsManager APIs.

Currently, access to network usage history and statistics requires a
signature|privileged permission, an AppOps bit (associated with the
PACKAGE_USAGE_STATS permission), or device/profile ownership. Once
access is granted via one of these mechanisms, it generally applies to
any UID running in the same user as the caller.

This CL expands access as follows:

-Any app can access its own usage history with no extra requirements.
-Carrier-privileged applications can access usage history for the
entire device.
-Device owners can access per-UID breakdowns for usage. Previously
they could access the summary for the whole device, but not the
individual breakdowns.

We simplify the permission model by defining three access levels -
DEFAULT (own app only), USER (all apps in the same user), and DEVICE
(all apps on the device), and propagate these levels throughout.

Finally, this CL fixes an apparent bug in
NetworkStatsSerice#hasAppOpsPermissions - if the AppOp bit was in
MODE_DEFAULT, hasAppOpsPermission would always return false instead of
falling back to the PackageManager permission check.

Bug: 25812859
Bug: 25813856
Change-Id: Ic96e0776e2a4215a400163872acea1ededfaced9
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
72027d2e424a94f002452d1e16310d00f3696d00 16-Jun-2015 Zoltan Szatmary-Ban <szatmz@google.com> Expose time-interval detail query on INetworkStatsSession

Also, force polling when a session is opened for NetworkStatsManager.

Bug: 21864554
Bug: 21754685
Change-Id: I24ea822c2d5bc1421ec7ee65d0cfe27cf02dd69e
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
381483b3a0ac416e02da058eb01ec683aa8ff9e1 13-May-2015 Zoltan Szatmary-Ban <szatmz@google.com> Rename NetworkUsageStats -> NetworkStats

Also making other changes to Data Usage API as requested by API review.

Bug: 20823478
Change-Id: Id766c5a725c856da9d8883d73ae788fc1472440a
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java
9c5dfa5c79fff17f96bf977b86c0c9ceb8c3cf9b 23-Feb-2015 Zoltan Szatmary-Ban <szatmz@google.com> Data Usage public API

Added new API consisting of android.app.usage.NetworkUsageManager and
android.app.usage.NetworkUsageStats. Through them data usage on a
network interface can be programmatically queried. Both summary and
details are available.

Bug: 19208876
Change-Id: I0e0c4b37ae23ad1e589d4b0c955b93f28ba4333e
/frameworks/base/core/java/android/app/usage/NetworkStatsManager.java