Hide required underlying caps APIs

VCN underlying network capabilities should be transport-dependent in
order to allow using anything other than the INTERNET capability for
VCN types that support wifi offload. Specifically, if underlying
network capabilities are not transport-dependent, and Wifi only ever
supports the INTERNET capability, the VCN is unable to utilize wifi
offload together with requiring NET_CAPABILITY_IMS or
NET_CAPABILITY_CBS, since the IMS or CBS capability would be required
for both cellular and wifi underlying networks.

Until such time as a per-transport capability set is allowed, hide
the exposedCapability pieces, and document that all underlying networks
MUST have INTERNET capability in order to be used.

Bug: 182219992
Test: atest FrameworksVcnTests
Test: atest CtsVcnTestCases
Change-Id: I50d7f1be42e0e001f1413a3d5fe8aa4b7afec223
This commit is contained in:
Benedict Wong
2021-03-12 16:12:58 -08:00
parent 3a95fb9b50
commit 226af1dbfd
4 changed files with 11 additions and 26 deletions

View File

@@ -52,13 +52,12 @@ import java.util.concurrent.TimeUnit;
* Network}s.
*
* <p>A VCN connection based on this configuration will be brought up dynamically based on device
* settings, and filed NetworkRequests. Underlying networks will be selected based on the services
* required by this configuration (as represented by network capabilities), and must be part of the
* subscription group under which this configuration is registered (see {@link
* settings, and filed NetworkRequests. Underlying Networks must provide INTERNET connectivity, and
* must be part of the subscription group under which this configuration is registered (see {@link
* VcnManager#setVcnConfig}).
*
* <p>As an abstraction of a cellular network, services that can be provided by a VCN network, or
* required for underlying networks are limited to services provided by cellular networks:
* <p>As an abstraction of a cellular network, services that can be provided by a VCN network are
* limited to services provided by cellular networks:
*
* <ul>
* <li>{@link NetworkCapabilities#NET_CAPABILITY_MMS}
@@ -214,13 +213,6 @@ public final class VcnGatewayConnectionConfig {
checkValidCapability(cap);
}
Preconditions.checkArgument(
mUnderlyingCapabilities != null && !mUnderlyingCapabilities.isEmpty(),
"underlyingCapabilities was null or empty");
for (Integer cap : getAllUnderlyingCapabilities()) {
checkValidCapability(cap);
}
Objects.requireNonNull(mRetryIntervalsMs, "retryIntervalsMs was null");
validateRetryInterval(mRetryIntervalsMs);
@@ -295,7 +287,9 @@ public final class VcnGatewayConnectionConfig {
*
* @see Builder#addRequiredUnderlyingCapability(int)
* @see Builder#removeRequiredUnderlyingCapability(int)
* @hide
*/
// TODO(b/182219992): Remove, and add when per-transport capabilities are supported
@NonNull
public int[] getRequiredUnderlyingCapabilities() {
// Sorted set guarantees ordering
@@ -470,7 +464,9 @@ public final class VcnGatewayConnectionConfig {
* @return this {@link Builder} instance, for chaining
* @see VcnGatewayConnectionConfig for a list of capabilities may be required of underlying
* networks
* @hide
*/
// TODO(b/182219992): Remove, and add when per-transport capabilities are supported
@NonNull
public Builder addRequiredUnderlyingCapability(
@VcnSupportedCapability int underlyingCapability) {
@@ -492,7 +488,9 @@ public final class VcnGatewayConnectionConfig {
* @return this {@link Builder} instance, for chaining
* @see VcnGatewayConnectionConfig for a list of capabilities may be required of underlying
* networks
* @hide
*/
// TODO(b/182219992): Remove, and add when per-transport capabilities are supported
@NonNull
@SuppressLint("BuilderSetStyle") // For consistency with NetCaps.Builder add/removeCap
public Builder removeRequiredUnderlyingCapability(

View File

@@ -448,7 +448,7 @@ public class VcnManager {
* @param networkCapabilities an array of NetworkCapabilities.NET_CAPABILITY_* capabilities
* for the Gateway Connection that encountered the error, for identification purposes.
* These will be a sorted list with no duplicates and will match {@link
* VcnGatewayConnectionConfig#getRequiredUnderlyingCapabilities()} for one of the {@link
* VcnGatewayConnectionConfig#getExposedCapabilities()} for one of the {@link
* VcnGatewayConnectionConfig}s set in the {@link VcnConfig} for this subscription
* group.
* @param errorCode the code to indicate the error that occurred