VcnGatewayConnectionConfig.Builder


public static final class VcnGatewayConnectionConfig.Builder
extends Object

java.lang.Object
   ↳ android.net.vcn.VcnGatewayConnectionConfig.Builder


This class is used to incrementally build VcnGatewayConnectionConfig objects.

Summary

Public constructors

Builder(String gatewayConnectionName, IkeTunnelConnectionParams tunnelConnectionParams)

Construct a Builder object.

Public methods

VcnGatewayConnectionConfig.Builder addExposedCapability(int exposedCapability)

Add a capability that this VCN Gateway Connection will support.

VcnGatewayConnectionConfig.Builder addGatewayOption(int option)

Enables the specified VCN gateway option.

VcnGatewayConnectionConfig build()

Builds and validates the VcnGatewayConnectionConfig.

VcnGatewayConnectionConfig.Builder removeExposedCapability(int exposedCapability)

Remove a capability that this VCN Gateway Connection will support.

VcnGatewayConnectionConfig.Builder removeGatewayOption(int option)

Resets (disables) the specified VCN gateway option.

VcnGatewayConnectionConfig.Builder setMaxMtu(int maxMtu)

Sets the maximum MTU allowed for this VCN Gateway Connection.

VcnGatewayConnectionConfig.Builder setMinUdpPort4500NatTimeoutSeconds(int minUdpPort4500NatTimeoutSeconds)

Sets the maximum supported IKEv2/IPsec NATT keepalive timeout.

VcnGatewayConnectionConfig.Builder setRetryIntervalsMillis(long[] retryIntervalsMs)

Set the retry interval between VCN establishment attempts upon successive failures.

VcnGatewayConnectionConfig.Builder setSafeModeEnabled(boolean enabled)

Enable/disable safe mode

If a VCN fails to provide connectivity within a system-provided timeout, it will enter safe mode.

VcnGatewayConnectionConfig.Builder setVcnUnderlyingNetworkPriorities(List<VcnUnderlyingNetworkTemplate> underlyingNetworkTemplates)

Set the list of templates to match underlying networks against, in high-to-low priority order.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder (String gatewayConnectionName, 
                IkeTunnelConnectionParams tunnelConnectionParams)

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.

Throws
IllegalArgumentException if the provided IkeTunnelConnectionParams is not configured to support MOBIKE

Public methods

addExposedCapability

Added in API level 31
public VcnGatewayConnectionConfig.Builder addExposedCapability (int exposedCapability)

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 NetworkCapabilities.NET_CAPABILITY_MMS, NetworkCapabilities.NET_CAPABILITY_SUPL, NetworkCapabilities.NET_CAPABILITY_DUN, NetworkCapabilities.NET_CAPABILITY_FOTA, NetworkCapabilities.NET_CAPABILITY_IMS, NetworkCapabilities.NET_CAPABILITY_CBS, NetworkCapabilities.NET_CAPABILITY_IA, NetworkCapabilities.NET_CAPABILITY_RCS, NetworkCapabilities.NET_CAPABILITY_XCAP, NetworkCapabilities.NET_CAPABILITY_EIMS, NetworkCapabilities.NET_CAPABILITY_INTERNET, or NetworkCapabilities.NET_CAPABILITY_MCX

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

addGatewayOption

Added in API level 34
public VcnGatewayConnectionConfig.Builder addGatewayOption (int option)

Enables the specified VCN gateway option.

Parameters
option int: the option to be enabled Value is VcnGatewayConnectionConfig.VCN_GATEWAY_OPTION_ENABLE_DATA_STALL_RECOVERY_WITH_MOBILITY

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

Throws
IllegalArgumentException if the provided option is invalid

build

Added in API level 31
public VcnGatewayConnectionConfig build ()

Builds and validates the VcnGatewayConnectionConfig.

Returns
VcnGatewayConnectionConfig an immutable VcnGatewayConnectionConfig instance This value cannot be null.

removeExposedCapability

Added in API level 31
public VcnGatewayConnectionConfig.Builder removeExposedCapability (int exposedCapability)

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 NetworkCapabilities.NET_CAPABILITY_MMS, NetworkCapabilities.NET_CAPABILITY_SUPL, NetworkCapabilities.NET_CAPABILITY_DUN, NetworkCapabilities.NET_CAPABILITY_FOTA, NetworkCapabilities.NET_CAPABILITY_IMS, NetworkCapabilities.NET_CAPABILITY_CBS, NetworkCapabilities.NET_CAPABILITY_IA, NetworkCapabilities.NET_CAPABILITY_RCS, NetworkCapabilities.NET_CAPABILITY_XCAP, NetworkCapabilities.NET_CAPABILITY_EIMS, NetworkCapabilities.NET_CAPABILITY_INTERNET, or NetworkCapabilities.NET_CAPABILITY_MCX

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

removeGatewayOption

Added in API level 34
public VcnGatewayConnectionConfig.Builder removeGatewayOption (int option)

Resets (disables) the specified VCN gateway option.

Parameters
option int: the option to be disabled Value is VcnGatewayConnectionConfig.VCN_GATEWAY_OPTION_ENABLE_DATA_STALL_RECOVERY_WITH_MOBILITY

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

Throws
IllegalArgumentException if the provided option is invalid

setMaxMtu

Added in API level 31
public VcnGatewayConnectionConfig.Builder setMaxMtu (int maxMtu)

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

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

setMinUdpPort4500NatTimeoutSeconds

Added in API level 34
public VcnGatewayConnectionConfig.Builder setMinUdpPort4500NatTimeoutSeconds (int minUdpPort4500NatTimeoutSeconds)

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; or ERROR(/MIN_UDP_PORT_4500_NAT_TIMEOUT_UNSET) to clear this value. Value is MIN_UDP_PORT_4500_NAT_TIMEOUT_SECONDS or greater

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

setRetryIntervalsMillis

Added in API level 31
public VcnGatewayConnectionConfig.Builder setRetryIntervalsMillis (long[] retryIntervalsMs)

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 long: 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.

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.

setSafeModeEnabled

Added in API level 35
public VcnGatewayConnectionConfig.Builder setSafeModeEnabled (boolean enabled)

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

Returns
VcnGatewayConnectionConfig.Builder This value cannot be null.

setVcnUnderlyingNetworkPriorities

Added in API level 33
public VcnGatewayConnectionConfig.Builder setVcnUnderlyingNetworkPriorities (List<VcnUnderlyingNetworkTemplate> underlyingNetworkTemplates)

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 List: 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.

Returns
VcnGatewayConnectionConfig.Builder this Builder instance, for chaining This value cannot be null.