summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorChalard Jean <jchalard@google.com>2018-01-10 21:19:32 +0900
committerChalard Jean <jchalard@google.com>2018-01-23 21:38:00 +0900
commitdda156ab0c5d66ad82bdcf76cda07cbc0a9c8a2e (patch)
tree337139f4421aaf2427905a0d6189463a87c1dde4 /core/java/android
parent918a68b3ca3d375335691230cc8fd7c974403717 (diff)
Let network requests see VPNs.
Test: runtest frameworks-net Test: also tested with VPN app Test: also cts passing Change-Id: I3b16caad7787c3c1f2921ca1583815c89efbadc5
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/net/NetworkCapabilities.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 6e80f024eeac..31516fd45782 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -895,6 +895,17 @@ public final class NetworkCapabilities implements Parcelable {
private Set<UidRange> mUids = null;
/**
+ * Convenience method to set the UIDs this network applies to to a single UID.
+ * @hide
+ */
+ public NetworkCapabilities setSingleUid(int uid) {
+ final ArraySet<UidRange> identity = new ArraySet<>(1);
+ identity.add(new UidRange(uid, uid));
+ setUids(identity);
+ return this;
+ }
+
+ /**
* Set the list of UIDs this network applies to.
* This makes a copy of the set so that callers can't modify it after the call.
* @hide