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

Commit 0838c8fb authored by Yan Yan's avatar Yan Yan
Browse files

Expose APIs to configure transports to be restricted by VCN

This commit exposes APIs to allow caller to configure transports that
willl be marked as restricted by VCN.

This API allows carriers to restrict the access to the carrier owned
networks and thus prevent apps from circumventing the VCN.

Bug: 239104955
Test: make update-api
CTS-Coverage-Bug: 262263040
Change-Id: I21aaab57e3d51f4f206c613c94c95ee02150b929
parent 9d9de6ec
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27285,6 +27285,7 @@ package android.net.vcn {
  public final class VcnConfig implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public java.util.Set<android.net.vcn.VcnGatewayConnectionConfig> getGatewayConnectionConfigs();
    method @NonNull public java.util.Set<java.lang.Integer> getRestrictedUnderlyingNetworkTransports();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.net.vcn.VcnConfig> CREATOR;
  }
@@ -27293,6 +27294,7 @@ package android.net.vcn {
    ctor public VcnConfig.Builder(@NonNull android.content.Context);
    method @NonNull public android.net.vcn.VcnConfig.Builder addGatewayConnectionConfig(@NonNull android.net.vcn.VcnGatewayConnectionConfig);
    method @NonNull public android.net.vcn.VcnConfig build();
    method @NonNull public android.net.vcn.VcnConfig.Builder setRestrictedUnderlyingNetworkTransports(@NonNull java.util.Set<java.lang.Integer>);
  }
  public final class VcnGatewayConnectionConfig {
+4 −5
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.server.vcn.util.PersistableBundleUtils.INTEGER_SERIALI
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.Parcel;
import android.os.Parcelable;
@@ -158,10 +159,9 @@ public final class VcnConfig implements Parcelable {
    }

    /**
     * Retrieve the transports that need to be restricted by VCN.
     * Retrieve the transports that will be restricted by the VCN.
     *
     * @see Builder#setRestrictedUnderlyingNetworkTransports(Set)
     * @hide
     */
    @NonNull
    public Set<Integer> getRestrictedUnderlyingNetworkTransports() {
@@ -306,16 +306,15 @@ public final class VcnConfig implements Parcelable {
        }

        /**
         * Sets transports that need to be restricted by VCN.
         * Sets transports that will be restricted by the VCN.
         *
         * @param transports transports that need to be restricted by VCN. Networks that include any
         * @param transports transports that will be restricted by VCN. Networks that include any
         *     of the transports will be marked as restricted. Only {@link
         *     NetworkCapabilities#TRANSPORT_WIFI} and {@link
         *     NetworkCapabilities#TRANSPORT_CELLULAR} are allowed. {@link
         *     NetworkCapabilities#TRANSPORT_WIFI} is marked restricted by default.
         * @return this {@link Builder} instance, for chaining
         * @throws IllegalArgumentException if the input contains unsupported transport types.
         * @hide
         */
        @NonNull
        public Builder setRestrictedUnderlyingNetworkTransports(@NonNull Set<Integer> transports) {