Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4b7104f authored by Benedict Wong's avatar Benedict Wong Committed by Gerrit Code Review
Browse files

Merge "Hide required underlying caps APIs"

parents 677f4420 226af1db
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -25690,17 +25690,14 @@ package android.net.vcn {
  public final class VcnGatewayConnectionConfig {
    method @NonNull public int[] getExposedCapabilities();
    method @IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) public int getMaxMtu();
    method @NonNull public int[] getRequiredUnderlyingCapabilities();
    method @NonNull public long[] getRetryInterval();
  }
  public static final class VcnGatewayConnectionConfig.Builder {
    ctor public VcnGatewayConnectionConfig.Builder(@NonNull android.net.vcn.VcnControlPlaneConfig);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder addExposedCapability(int);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder addRequiredUnderlyingCapability(int);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig build();
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder removeExposedCapability(int);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder removeRequiredUnderlyingCapability(int);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setMaxMtu(@IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) int);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setRetryInterval(@NonNull long[]);
  }
+10 −12
Original line number Diff line number Diff line
@@ -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(
+1 −1
Original line number Diff line number Diff line
@@ -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
+0 −10
Original line number Diff line number Diff line
@@ -108,16 +108,6 @@ public class VcnGatewayConnectionConfigTest {
        }
    }

    @Test
    public void testBuilderRequiresNonEmptyUnderlyingCaps() {
        try {
            newBuilder().addExposedCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build();

            fail("Expected exception due to invalid required underlying capabilities");
        } catch (IllegalArgumentException e) {
        }
    }

    @Test
    public void testBuilderRequiresNonNullRetryInterval() {
        try {