diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2012-04-16 11:22:22 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-16 11:22:22 -0700 |
| commit | 7bf8fba6f0e0fe8072201a0b174727b905437990 (patch) | |
| tree | 7b38d7d9bc0b8aa73d5fc472152ff4966cf0ba14 /services/java/com/android/server/net/NetworkPolicyManagerService.java | |
| parent | a5d552fc2bad6aea2087f56e88fb1ce836a79571 (diff) | |
| parent | 9f7cbf0e50bcb7e9163b23524814003ba8784732 (diff) | |
| download | frameworks_base-7bf8fba6f0e0fe8072201a0b174727b905437990.zip frameworks_base-7bf8fba6f0e0fe8072201a0b174727b905437990.tar.gz frameworks_base-7bf8fba6f0e0fe8072201a0b174727b905437990.tar.bz2 | |
Merge "API to report if active network is metered."
Diffstat (limited to 'services/java/com/android/server/net/NetworkPolicyManagerService.java')
| -rw-r--r-- | services/java/com/android/server/net/NetworkPolicyManagerService.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java index 5408c42..1e17067 100644 --- a/services/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java @@ -1391,6 +1391,22 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { } @Override + public boolean isNetworkMetered(NetworkState state) { + final NetworkIdentity ident = NetworkIdentity.buildNetworkIdentity(mContext, state); + + final NetworkPolicy policy; + synchronized (mRulesLock) { + policy = findPolicyForNetworkLocked(ident); + } + + if (policy != null) { + return policy.metered; + } else { + return false; + } + } + + @Override protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) { mContext.enforceCallingOrSelfPermission(DUMP, TAG); @@ -1814,11 +1830,6 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { mHandler.getLooper().getQueue().addIdleHandler(handler); } - public static boolean isAirplaneModeOn(Context context) { - return Settings.System.getInt( - context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; - } - private static void collectKeys(SparseIntArray source, SparseBooleanArray target) { final int size = source.size(); for (int i = 0; i < size; i++) { |
