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
This commit is contained in:
lucaslin
2021-03-22 15:07:41 +08:00
committed by Lorenzo Colitti
parent 3949d6ed96
commit c276e2bb77
2 changed files with 25 additions and 0 deletions

View File

@@ -63,6 +63,16 @@ public final class NetworkAgentConfig implements Parcelable {
return explicitlySelected;
}
/**
* @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
@@ -346,6 +356,19 @@ public final class NetworkAgentConfig implements Parcelable {
return this;
}
/**
* 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.
*/