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

Commit 5926d20e authored by Cody Kesting's avatar Cody Kesting
Browse files

Expose API for identifying GatewayConnections.

This CL exposes the updated APIs for identifying GatewayConnections via
a user-configured String set in VcnGatewayConnectionConfig.Builder, as
requested by the API Council.

Bug: 182345902
Bug: 180522464
Test: atest FrameworksVcnTests
Change-Id: I10afd074906bc0f3831157dcee1da813b4cfce78
parent 52265aab
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -25702,12 +25702,13 @@ package android.net.vcn {
  public final class VcnGatewayConnectionConfig {
    method @NonNull public int[] getExposedCapabilities();
    method @NonNull public String getGatewayConnectionName();
    method @IntRange(from=android.net.vcn.VcnGatewayConnectionConfig.MIN_MTU_V6) public int getMaxMtu();
    method @NonNull public long[] getRetryInterval();
  }
  public static final class VcnGatewayConnectionConfig.Builder {
    ctor public VcnGatewayConnectionConfig.Builder(@NonNull android.net.vcn.VcnControlPlaneConfig);
    ctor public VcnGatewayConnectionConfig.Builder(@NonNull String, @NonNull android.net.vcn.VcnControlPlaneConfig);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder addExposedCapability(int);
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig build();
    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder removeExposedCapability(int);
@@ -25731,7 +25732,7 @@ package android.net.vcn {
  public abstract static class VcnManager.VcnStatusCallback {
    ctor public VcnManager.VcnStatusCallback();
    method public abstract void onGatewayConnectionError(@NonNull int[], int, @Nullable Throwable);
    method public abstract void onGatewayConnectionError(@NonNull String, int, @Nullable Throwable);
    method public abstract void onStatusChanged(int);
  }
+0 −12
Original line number Diff line number Diff line
@@ -255,7 +255,6 @@ public final class VcnGatewayConnectionConfig {
     * the identifier in VcnStatusCallback invocations.
     *
     * @see VcnManager.VcnStatusCallback#onGatewayConnectionError
     * @hide
     */
    @NonNull
    public String getGatewayConnectionName() {
@@ -434,16 +433,6 @@ public final class VcnGatewayConnectionConfig {
        //       Consider the case where the VCN might only expose MMS on WiFi, but defer to MMS
        //       when on Cell.

        /**
         * Construct a Builder object.
         *
         * @param ctrlPlaneConfig the control plane configuration
         * @see VcnControlPlaneConfig
         */
        public Builder(@NonNull VcnControlPlaneConfig ctrlPlaneConfig) {
            this("" /* gatewayConnectionName */, ctrlPlaneConfig);
        }

        /**
         * Construct a Builder object.
         *
@@ -455,7 +444,6 @@ public final class VcnGatewayConnectionConfig {
         * @param ctrlPlaneConfig the control plane configuration
         * @see VcnControlPlaneConfig
         * @see VcnManager.VcnStatusCallback#onGatewayConnectionError
         * @hide
         */
        public Builder(
                @NonNull String gatewayConnectionName,
+6 −8
Original line number Diff line number Diff line
@@ -445,18 +445,16 @@ public class VcnManager {
         * Invoked when a VCN Gateway Connection corresponding to this callback's subscription group
         * encounters an error.
         *
         * @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#getExposedCapabilities()} for one of the {@link
         *     VcnGatewayConnectionConfig}s set in the {@link VcnConfig} for this subscription
         *     group.
         * @param gatewayConnectionName the String GatewayConnection name for the GatewayConnection
         *     encountering an error. This will match the name for exactly one {@link
         *     VcnGatewayConnectionConfig} for the {@link VcnConfig} configured for this callback's
         *     subscription group
         * @param errorCode the code to indicate the error that occurred
         * @param detail Throwable to provide additional information about the error, or {@code
         *     null} if none
         */
        public abstract void onGatewayConnectionError(
                @NonNull int[] networkCapabilities,
                @NonNull String gatewayConnectionName,
                @VcnErrorCode int errorCode,
                @Nullable Throwable detail);
    }
@@ -597,7 +595,7 @@ public class VcnManager {
                            mExecutor.execute(
                                    () ->
                                            mCallback.onGatewayConnectionError(
                                                    new int[0], errorCode, cause)));
                                                    gatewayConnectionName, errorCode, cause)));
        }

        private static Throwable createThrowableByClassName(
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ public class VcnManagerTest {
                "exception_message");
        verify(mMockStatusCallback)
                .onGatewayConnectionError(
                        any(int[].class),
                        eq(GATEWAY_CONNECTION_NAME),
                        eq(VcnManager.VCN_ERROR_CODE_NETWORK_ERROR),
                        any(UnknownHostException.class));
    }