Builder
class Builder
kotlin.Any | |
↳ | android.net.vcn.VcnGatewayConnectionConfig.Builder |
This class is used to incrementally build VcnGatewayConnectionConfig
objects.
Summary
Public constructors | |
---|---|
Builder(gatewayConnectionName: String, tunnelConnectionParams: IkeTunnelConnectionParams) Construct a Builder object. |
Public methods | |
---|---|
VcnGatewayConnectionConfig.Builder |
addExposedCapability(exposedCapability: Int) Add a capability that this VCN Gateway Connection will support. |
VcnGatewayConnectionConfig.Builder |
addGatewayOption(option: Int) Enables the specified VCN gateway option. |
VcnGatewayConnectionConfig |
build() Builds and validates the VcnGatewayConnectionConfig. |
VcnGatewayConnectionConfig.Builder |
removeExposedCapability(exposedCapability: Int) Remove a capability that this VCN Gateway Connection will support. |
VcnGatewayConnectionConfig.Builder |
removeGatewayOption(option: Int) Resets (disables) the specified VCN gateway option. |
VcnGatewayConnectionConfig.Builder |
Sets the maximum MTU allowed for this VCN Gateway Connection. |
VcnGatewayConnectionConfig.Builder |
setMinUdpPort4500NatTimeoutSeconds(minUdpPort4500NatTimeoutSeconds: Int) Sets the maximum supported IKEv2/IPsec NATT keepalive timeout. |
VcnGatewayConnectionConfig.Builder |
setRetryIntervalsMillis(retryIntervalsMs: LongArray) Set the retry interval between VCN establishment attempts upon successive failures. |
VcnGatewayConnectionConfig.Builder |
setSafeModeEnabled(enabled: Boolean) Enable/disable safe mode |
VcnGatewayConnectionConfig.Builder |
setVcnUnderlyingNetworkPriorities(underlyingNetworkTemplates: MutableList<VcnUnderlyingNetworkTemplate!>) Set the list of templates to match underlying networks against, in high-to-low priority order. |
Public constructors
Builder
Builder(
gatewayConnectionName: String,
tunnelConnectionParams: IkeTunnelConnectionParams)
Construct a Builder object.
Parameters | |
---|---|
gatewayConnectionName |
String: the String GatewayConnection name for this VcnGatewayConnectionConfig. Each VcnGatewayConnectionConfig within a VcnConfig must be given a unique name. This name is used by the caller to distinguish between VcnGatewayConnectionConfigs configured on a single VcnConfig . This will be used as the identifier in VcnStatusCallback invocations. This value cannot be null . |
tunnelConnectionParams |
IkeTunnelConnectionParams: the IKE tunnel connection configuration This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided IkeTunnelConnectionParams is not configured to support MOBIKE |
Public methods
addExposedCapability
fun addExposedCapability(exposedCapability: Int): VcnGatewayConnectionConfig.Builder
Add a capability that this VCN Gateway Connection will support.
Parameters | |
---|---|
exposedCapability |
Int: the app-facing capability to be exposed by this VCN Gateway Connection (i.e., the capabilities that this VCN Gateway Connection will support). Value is android.net.NetworkCapabilities#NET_CAPABILITY_MMS , android.net.NetworkCapabilities#NET_CAPABILITY_SUPL , android.net.NetworkCapabilities#NET_CAPABILITY_DUN , android.net.NetworkCapabilities#NET_CAPABILITY_FOTA , android.net.NetworkCapabilities#NET_CAPABILITY_IMS , android.net.NetworkCapabilities#NET_CAPABILITY_CBS , android.net.NetworkCapabilities#NET_CAPABILITY_IA , android.net.NetworkCapabilities#NET_CAPABILITY_RCS , android.net.NetworkCapabilities#NET_CAPABILITY_XCAP , android.net.NetworkCapabilities#NET_CAPABILITY_EIMS , android.net.NetworkCapabilities#NET_CAPABILITY_INTERNET , or android.net.NetworkCapabilities#NET_CAPABILITY_MCX |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
addGatewayOption
fun addGatewayOption(option: Int): VcnGatewayConnectionConfig.Builder
Enables the specified VCN gateway option.
Parameters | |
---|---|
option |
Int: the option to be enabled Value is android.net.vcn.VcnGatewayConnectionConfig#VCN_GATEWAY_OPTION_ENABLE_DATA_STALL_RECOVERY_WITH_MOBILITY |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided option is invalid |
build
fun build(): VcnGatewayConnectionConfig
Builds and validates the VcnGatewayConnectionConfig.
Return | |
---|---|
VcnGatewayConnectionConfig |
an immutable VcnGatewayConnectionConfig instance This value cannot be null . |
removeExposedCapability
fun removeExposedCapability(exposedCapability: Int): VcnGatewayConnectionConfig.Builder
Remove a capability that this VCN Gateway Connection will support.
Parameters | |
---|---|
exposedCapability |
Int: the app-facing capability to not be exposed by this VCN Gateway Connection (i.e., the capabilities that this VCN Gateway Connection will support) Value is android.net.NetworkCapabilities#NET_CAPABILITY_MMS , android.net.NetworkCapabilities#NET_CAPABILITY_SUPL , android.net.NetworkCapabilities#NET_CAPABILITY_DUN , android.net.NetworkCapabilities#NET_CAPABILITY_FOTA , android.net.NetworkCapabilities#NET_CAPABILITY_IMS , android.net.NetworkCapabilities#NET_CAPABILITY_CBS , android.net.NetworkCapabilities#NET_CAPABILITY_IA , android.net.NetworkCapabilities#NET_CAPABILITY_RCS , android.net.NetworkCapabilities#NET_CAPABILITY_XCAP , android.net.NetworkCapabilities#NET_CAPABILITY_EIMS , android.net.NetworkCapabilities#NET_CAPABILITY_INTERNET , or android.net.NetworkCapabilities#NET_CAPABILITY_MCX |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
removeGatewayOption
fun removeGatewayOption(option: Int): VcnGatewayConnectionConfig.Builder
Resets (disables) the specified VCN gateway option.
Parameters | |
---|---|
option |
Int: the option to be disabled Value is android.net.vcn.VcnGatewayConnectionConfig#VCN_GATEWAY_OPTION_ENABLE_DATA_STALL_RECOVERY_WITH_MOBILITY |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the provided option is invalid |
setMaxMtu
fun setMaxMtu(maxMtu: Int): VcnGatewayConnectionConfig.Builder
Sets the maximum MTU allowed for this VCN Gateway Connection.
This MTU is applied to the VCN Gateway Connection exposed Networks, and represents the MTU of the virtualized network.
The system may reduce the MTU below the maximum specified based on signals such as the MTU of the underlying networks (and adjusted for Gateway Connection overhead).
Parameters | |
---|---|
maxMtu |
Int: the maximum MTU allowed for this Gateway Connection. Must be greater than the IPv6 minimum MTU of 1280. Defaults to 1500. Value is MIN_MTU_V6 or greater |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
setMinUdpPort4500NatTimeoutSeconds
fun setMinUdpPort4500NatTimeoutSeconds(minUdpPort4500NatTimeoutSeconds: Int): VcnGatewayConnectionConfig.Builder
Sets the maximum supported IKEv2/IPsec NATT keepalive timeout.
This is used as a power-optimization hint for other IKEv2/IPsec use cases (e.g. VPNs, or IWLAN) to reduce the necessary keepalive frequency, thus conserving power and data.
Parameters | |
---|---|
minUdpPort4500NatTimeoutSeconds |
Int: the maximum keepalive timeout supported by the VCN Gateway Connection, generally the minimum duration a NAT mapping is cached on the VCN Gateway. Value is MIN_UDP_PORT_4500_NAT_TIMEOUT_SECONDS or greater |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
setRetryIntervalsMillis
fun setRetryIntervalsMillis(retryIntervalsMs: LongArray): VcnGatewayConnectionConfig.Builder
Set the retry interval between VCN establishment attempts upon successive failures.
The last retry interval will be repeated until safe mode is entered, or a connection is successfully established, at which point the retry timers will be reset. For power reasons, the last (repeated) retry interval MUST be at least 15 minutes.
Retry intervals MAY be subject to system power saving modes. That is to say that if the system enters a power saving mode, the retry may not occur until the device leaves the specified power saving mode. Intervals are sequential, and intervals will NOT be skipped if system power saving results in delaying retries (even if it exceed multiple retry intervals).
Each Gateway Connection will retry according to the retry intervals configured, but if safe mode is enabled, all Gateway Connection(s) will be disabled.
Parameters | |
---|---|
retryIntervalsMs |
LongArray: an array of between 1 and 10 millisecond intervals after which the VCN will attempt to retry a session initiation. The last (repeating) retry interval must be at least 15 minutes. Defaults to: [1s, 2s, 5s, 30s, 1m, 5m, 15m] This value cannot be null . |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |
See Also
setSafeModeEnabled
fun setSafeModeEnabled(enabled: Boolean): VcnGatewayConnectionConfig.Builder
Enable/disable safe mode
If a VCN fails to provide connectivity within a system-provided timeout, it will enter safe mode. In safe mode, the VCN Network will be torn down and the system will restore connectivity by allowing underlying cellular or WiFi networks to be used as default. At the same time, VCN will continue to retry until it succeeds.
When safe mode is disabled and VCN connection fails to provide connectivity, end users might not have connectivity, and may not have access to carrier-owned underlying networks.
Parameters | |
---|---|
enabled |
Boolean: whether safe mode should be enabled. Defaults to true |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
This value cannot be null . |
setVcnUnderlyingNetworkPriorities
fun setVcnUnderlyingNetworkPriorities(underlyingNetworkTemplates: MutableList<VcnUnderlyingNetworkTemplate!>): VcnGatewayConnectionConfig.Builder
Set the list of templates to match underlying networks against, in high-to-low priority order.
To select the VCN underlying network, the VCN connection will go through all the network candidates and return a network matching the highest priority rule.
If multiple networks match the same rule, the VCN will prefer an already-selected network as opposed to a new/unselected network. However, if both are new/unselected networks, a network will be chosen arbitrarily amongst the networks matching the highest priority rule.
If all networks fail to match the rules provided, a carrier-owned underlying network will still be selected (if available, at random if necessary).
Parameters | |
---|---|
underlyingNetworkTemplates |
MutableList<VcnUnderlyingNetworkTemplate!>: a list of unique VcnUnderlyingNetworkTemplates that are ordered from most to least preferred, or an empty list to use the default prioritization. The default network prioritization order is Opportunistic cellular, Carrier WiFi and then Macro cellular. This value cannot be null . |
Return | |
---|---|
VcnGatewayConnectionConfig.Builder |
this Builder instance, for chaining This value cannot be null . |