summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorlucaslin <lucaslin@google.com>2021-03-22 15:07:41 +0800
committerLorenzo Colitti <lorenzo@google.com>2021-03-23 09:01:40 +0900
commitff456d0fc0ba62602a7913694ec4a9b7c9ae0ba8 (patch)
treeb39ab37dbd8caf053523d4ccaae5875a739aa9db /packages
parentab638c1edcce10d47b24aa1f848502c8d8b1cd22 (diff)
Have a new method in NetworkAgentConfig.Builder to set allowBypass
Have a new method in NetworkAgentConfig.Builder for Vpn to set allowBypass. Bug: 182963397 Test: m Change-Id: I3f244464438325ee7f8a1b953d3fb28186293628
Diffstat (limited to 'packages')
-rw-r--r--packages/Connectivity/framework/api/module-lib-current.txt2
-rw-r--r--packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java23
2 files changed, 25 insertions, 0 deletions
diff --git a/packages/Connectivity/framework/api/module-lib-current.txt b/packages/Connectivity/framework/api/module-lib-current.txt
index f32f08daf7c0..23a71798d7c6 100644
--- a/packages/Connectivity/framework/api/module-lib-current.txt
+++ b/packages/Connectivity/framework/api/module-lib-current.txt
@@ -31,9 +31,11 @@ package android.net {
public final class NetworkAgentConfig implements android.os.Parcelable {
method @Nullable public String getSubscriberId();
+ method public boolean isBypassableVpn();
}
public static final class NetworkAgentConfig.Builder {
+ method @NonNull public android.net.NetworkAgentConfig.Builder setBypassableVpn(boolean);
method @NonNull public android.net.NetworkAgentConfig.Builder setSubscriberId(@Nullable String);
}
diff --git a/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java b/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java
index 5e50a6404acb..0bd2371bfca8 100644
--- a/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java
+++ b/packages/Connectivity/framework/src/android/net/NetworkAgentConfig.java
@@ -64,6 +64,16 @@ public final class NetworkAgentConfig implements Parcelable {
}
/**
+ * @return whether this VPN connection can be bypassed by the apps.
+ *
+ * @hide
+ */
+ @SystemApi(client = MODULE_LIBRARIES)
+ public boolean isBypassableVpn() {
+ return allowBypass;
+ }
+
+ /**
* Set if the user desires to use this network even if it is unvalidated. This field has meaning
* only if {@link explicitlySelected} is true. If it is, this field must also be set to the
* appropriate value based on previous user choice.
@@ -347,6 +357,19 @@ public final class NetworkAgentConfig implements Parcelable {
}
/**
+ * Sets whether the apps can bypass the VPN connection.
+ *
+ * @return this builder, to facilitate chaining.
+ * @hide
+ */
+ @NonNull
+ @SystemApi(client = MODULE_LIBRARIES)
+ public Builder setBypassableVpn(boolean allowBypass) {
+ mConfig.allowBypass = allowBypass;
+ return this;
+ }
+
+ /**
* Returns the constructed {@link NetworkAgentConfig} object.
*/
@NonNull