History log of /frameworks/base/core/java/android/net/NetworkPolicy.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
17bebd2fd7d3af0bc648172da6ae36f8b55ad7af 20-Jul-2017 Jeff Sharkey <jsharkey@android.com> Expose SubscriptionPlan API.

Clean up SubscriptionPlan, add docs, and expose as public API.

Deprecate older constants in CarrierConfigManager, and point users
towards new API. (The goal of CarrierConfigManager is to express
key/value pairs that are identical for all users on a particular
carrier, not to configure details that vary between users.)

Since a CarrierService may itself not have access to the plan
details, allow them to "delegate" the capability to configure plans
to another package name.

Factor out new RecurrenceRule class which is used by both
NetworkPolicy and SubscriptionPlan internally. Polish it to support
arbitrary periods, and continue to test it through NPMST.

Bug: 63391323
Test: bit FrameworksCoreTests:android.util.RecurrenceRuleTest
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I93fae4a43e58e9e4c32f8bf345a257dcd607f088
/frameworks/base/core/java/android/net/NetworkPolicy.java
53313d7e8153982f842910118371e1dc061248cd 14-Jul-2017 Jeff Sharkey <jsharkey@android.com> Iterate NetworkPolicy towards SubscriptionPlan.

Add new SubscriptionPlan API to describe the various types of carrier
data plans. Internally the OS will only use the first plan for
driving policy, but it will blindly plumb through the details for
Settings to display any secondary plans.

As part of getting Settings ready to roll towards SubscriptionPlan,
reduce references to NetworkPolicy internal fields. All usage cycle
details are now obtained from an Iterator which converts to
SubscriptionPlan under the hood.

Replace all data usage cycle calculation with new SubscriptionPlan
implementation, and retrofit large suite of existing tests to
exercise and verify the new logic.

Offer a debugging property that can be used to return "fake" plan
examples for testing.

Bug: 63391323
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I889c653980eeb7887abdfa4f5b6986f35855ee6d
/frameworks/base/core/java/android/net/NetworkPolicy.java
43d2a1700b6eb1d804924c6a1e5e0161a13a5348 12-Jul-2017 Jeff Sharkey <jsharkey@android.com> Move "metered" persistence to WifiConfiguration.

For a long time we've had a nasty tangled dependency between Wi-Fi
and NPMS, since they both persisted different details for configured
networks. As part of preparing for new carrier data plan APIs, move
the tracking of meteredness over to WifiConfiguration.

This also cleans up how meteredness is communicated through
NetworkAgents to rely completely on NET_CAPABILITY_NOT_METERED by
removing the metered flag on NetworkInfo, which has caused confusion
and staleness.

Migrates any existing user-configured metered networks over to
WifiConfiguration once the device finishes booting.

Remove support for NetworkQuotaInfo, since this information can no
longer be made available to apps. Frustratingly, some apps are
using it, so keep the object around returning stub values, and shame
them in the logs.

Bug: 63391323
Test: builds, boots, Wi-Fi policy is upgraded
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I64f865ddeb65cfcd330f8d2a847368abdf960a07
/frameworks/base/core/java/android/net/NetworkPolicy.java
adca34a0d6b5955f0cbc931dd0834b25fe3759b9 04-Feb-2016 Ritesh Reddy <riteshr@google.com> Enabled Network Policy Backup/Restore.

Added Backup Restore specific NetworkPolicySerializer
to NetworkPolicy Class and related classes.

Change-Id: I2a11e2afae8dd9e0ee0c3356e669a73f6a1361af
/frameworks/base/core/java/android/net/NetworkPolicy.java
3256601f5e4d94713f59e97b9d4912875c1bdcaf 03-Dec-2014 Jeff Sharkey <jsharkey@android.com> Offer to "merge" subscribers for data usage.

There are some cases where multiple subscriber identities (IMSI)
should be treated as "merged together" from a data usage
perspective. This is done by extending the template used for
matching purposes to support multiple subscribers.

Then, when we query historical usage or set network policies, we
normalize the matching template to merge to any other identities
that should be included. When normalizing, the "lowest" identity
is always used for equality and storage purposes, which allows
identities to come and go over time.

This change also fixes data usage recording for multi-SIM devices
by passing along the concrete subscriber identity for each network
interface. Also correctly create default policies for multi-SIM
devices. This change also drops setPolicyDataEnable() until it can
be wired up to the right underlying NetworkAgent. (This means we
still bring up the network, and then rely on iptables rules to block
traffic when over the limit, instead of proactively disabling the
connection.)

Bug: 18012787
Change-Id: If6acf32009fdfea2b836f5aff8e2f3e5e0248b4a
/frameworks/base/core/java/android/net/NetworkPolicy.java
e6585b32ea586743258a5457e2184ffc087f2d2f 13-Dec-2013 Kenny Root <kroot@google.com> Use java.util.Objects instead on internal API

Not needed since java.util.Objects implements all the needed
functionality.

Change-Id: Icd31d49a9801d1705427f028e9ac927d58e7d34c
/frameworks/base/core/java/android/net/NetworkPolicy.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/core/java/android/net/NetworkPolicy.java
837f9242ae2e8f5f380d0b30b8fffbc68494914f 21-Mar-2012 Jeff Sharkey <jsharkey@android.com> Remember when NetworkPolicy was inferred.

This helps future-proof NPMS if we need to correct default policies
after an upgrade.

Change-Id: I0ddfdeaf41757a46aeb867c91d495ccf981d544b
/frameworks/base/core/java/android/net/NetworkPolicy.java
9bf3150cfae03421c9dd237b46657714859d871c 10-Mar-2012 Jeff Sharkey <jsharkey@android.com> Save timezone when setting data cycle reset date.

Instead of cycle reset at midnight UTC, use midnight of timezone
active when user last set cycle reset date. Tests to verify, and
also to test leap year behavior.

Bug: 5938567
Change-Id: Ie06f7f0fa242d23110f9586a3f4f7037af87b31b
/frameworks/base/core/java/android/net/NetworkPolicy.java
0e2e5f8b564bebd5798c9fa387fbff96429ab5d2 03-Feb-2012 Jeff Sharkey <jsharkey@android.com> Support snoozing of data warning notification.

Introduce second snooze timestamp to support dismissal of data usage
warning notification. Also explicitly set notification "when" to
avoid fighting with other notifications, such as ongoing downloads.

Bug: 5443756, 5262414
Change-Id: I03342c25b0410b1b2db84de9a40884f04cb1d8ae
/frameworks/base/core/java/android/net/NetworkPolicy.java
f60d0afd1ef08a24121d015bb016df05265b6d07 01-Dec-2011 Jeff Sharkey <jsharkey@android.com> Restrict app data on metered networks.

This separates the definition of "metered network" and "network with
limit." For now, all mobile networks are considered metered.

Bug: 5571454
Change-Id: I394cd385bd33add75e53bfc9cf2fefd06a00208a
/frameworks/base/core/java/android/net/NetworkPolicy.java
50e7e51d68e3b01c3362fe9ab7b3448132e48b43 11-Oct-2011 Jeff Sharkey <jsharkey@android.com> Over-limit within handful of MTU's, update assets.

Consider a network over-limit when it's measured usage is within a
handful of MTU's, since kernel completely drops packets that trigger
limit alert.

Update notification drawables.

Bug: 5433359, 5224629
Change-Id: I10b19cc34c34b47775904229829a25208cd85d25
/frameworks/base/core/java/android/net/NetworkPolicy.java
41ff7ec82422a5b6d00892afdb3232bc0e53d851 26-Jul-2011 Jeff Sharkey <jsharkey@android.com> Revise data limit notifs, watch kernel alerts.

Teach NetworkPolicy limits to "snooze" when requested by user, and
notify with both dialog and notification. Register for network alerts
through NMS to trigger updates immediately instead of waiting for
next stats update.

Enforce that all NetworkPolicy are unique on a template basis, and
move SCREEN_ON/OFF broadcasts to background thread. Launch SystemUI
and Settings directly instead of using actions, and include full
NetworkTemplate in extras.

Tests to verify notification and snooze behavior.

Bug: 5057979, 5023579, 4723336, 5045721
Change-Id: I03724beff94a7c0547cb5220431ba8d4cd44d077
/frameworks/base/core/java/android/net/NetworkPolicy.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/NetworkPolicy.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/NetworkPolicy.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/core/java/android/net/NetworkPolicy.java