diff options
author | Jeff Sharkey <jsharkey@android.com> | 2011-06-07 12:26:43 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2011-06-10 19:35:20 -0700 |
commit | 21c9c45e5caf62b935354b74392fb40c4bf18529 (patch) | |
tree | 70af9e90ead6bbb5608cae836b14f98b055b5ded /core/java/android/net/NetworkPolicyManager.java | |
parent | b505074e8273887fbcd1e933738a42e770085fb8 (diff) | |
download | frameworks_base-21c9c45e5caf62b935354b74392fb40c4bf18529.zip frameworks_base-21c9c45e5caf62b935354b74392fb40c4bf18529.tar.gz frameworks_base-21c9c45e5caf62b935354b74392fb40c4bf18529.tar.bz2 |
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
Diffstat (limited to 'core/java/android/net/NetworkPolicyManager.java')
-rw-r--r-- | core/java/android/net/NetworkPolicyManager.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java index dd7c1b0..0f4dc9a 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -51,6 +51,23 @@ public class NetworkPolicyManager { return (NetworkPolicyManager) context.getSystemService(Context.NETWORK_POLICY_SERVICE); } + /** {@hide} */ + public void setNetworkPolicy(int networkType, String subscriberId, NetworkPolicy policy) { + try { + mService.setNetworkPolicy(networkType, subscriberId, policy); + } catch (RemoteException e) { + } + } + + /** {@hide} */ + public NetworkPolicy getNetworkPolicy(int networkType, String subscriberId) { + try { + return mService.getNetworkPolicy(networkType, subscriberId); + } catch (RemoteException e) { + return null; + } + } + /** * Set policy flags for specific UID. * |