diff options
| author | 2022-01-07 23:07:21 +0000 | |
|---|---|---|
| committer | 2022-01-07 23:07:21 +0000 | |
| commit | 6ca0ac41d5783cb72db71b11073a8da6ffbc3973 (patch) | |
| tree | 62510e2525a8c81424beab95439ed235ba921358 | |
| parent | dc271a75a90a5207d90dcd8fbd153ab265763f04 (diff) | |
| parent | 60ad179dffa8c40dfd059cb70c1582378498ded0 (diff) | |
Merge "Rename VcnUnderlyingNetworkPrioirty to VcnUnderlyingNetworkTemplate" am: 60ad179dff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1923190
Change-Id: Id342a2d1f94443765e97ea5a7c397bdbef6a72a8
11 files changed, 110 insertions, 110 deletions
diff --git a/core/java/android/net/vcn/VcnCellUnderlyingNetworkPriority.java b/core/java/android/net/vcn/VcnCellUnderlyingNetworkTemplate.java index b3f734524078..1ac3f0a6d7d1 100644 --- a/core/java/android/net/vcn/VcnCellUnderlyingNetworkPriority.java +++ b/core/java/android/net/vcn/VcnCellUnderlyingNetworkTemplate.java @@ -39,7 +39,7 @@ import java.util.Set; // TODO: Add documents /** @hide */ -public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetworkPriority { +public final class VcnCellUnderlyingNetworkTemplate extends VcnUnderlyingNetworkTemplate { private static final String ALLOWED_NETWORK_PLMN_IDS_KEY = "mAllowedNetworkPlmnIds"; @NonNull private final Set<String> mAllowedNetworkPlmnIds; private static final String ALLOWED_SPECIFIC_CARRIER_IDS_KEY = "mAllowedSpecificCarrierIds"; @@ -51,7 +51,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork private static final String REQUIRE_OPPORTUNISTIC_KEY = "mRequireOpportunistic"; private final boolean mRequireOpportunistic; - private VcnCellUnderlyingNetworkPriority( + private VcnCellUnderlyingNetworkTemplate( int networkQuality, boolean allowMetered, Set<String> allowedNetworkPlmnIds, @@ -92,7 +92,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork /** @hide */ @NonNull @VisibleForTesting(visibility = Visibility.PROTECTED) - public static VcnCellUnderlyingNetworkPriority fromPersistableBundle( + public static VcnCellUnderlyingNetworkTemplate fromPersistableBundle( @NonNull PersistableBundle in) { Objects.requireNonNull(in, "PersistableBundle is null"); @@ -117,7 +117,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork final boolean allowRoaming = in.getBoolean(ALLOW_ROAMING_KEY); final boolean requireOpportunistic = in.getBoolean(REQUIRE_OPPORTUNISTIC_KEY); - return new VcnCellUnderlyingNetworkPriority( + return new VcnCellUnderlyingNetworkTemplate( networkQuality, allowMetered, allowedNetworkPlmnIds, @@ -190,11 +190,11 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork return false; } - if (!(other instanceof VcnCellUnderlyingNetworkPriority)) { + if (!(other instanceof VcnCellUnderlyingNetworkTemplate)) { return false; } - final VcnCellUnderlyingNetworkPriority rhs = (VcnCellUnderlyingNetworkPriority) other; + final VcnCellUnderlyingNetworkTemplate rhs = (VcnCellUnderlyingNetworkTemplate) other; return Objects.equals(mAllowedNetworkPlmnIds, rhs.mAllowedNetworkPlmnIds) && Objects.equals(mAllowedSpecificCarrierIds, rhs.mAllowedSpecificCarrierIds) && mAllowRoaming == rhs.mAllowRoaming @@ -211,7 +211,7 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork } /** This class is used to incrementally build WifiNetworkPriority objects. */ - public static final class Builder extends VcnUnderlyingNetworkPriority.Builder<Builder> { + public static final class Builder extends VcnUnderlyingNetworkTemplate.Builder<Builder> { @NonNull private final Set<String> mAllowedNetworkPlmnIds = new ArraySet<>(); @NonNull private final Set<Integer> mAllowedSpecificCarrierIds = new ArraySet<>(); @@ -280,10 +280,10 @@ public final class VcnCellUnderlyingNetworkPriority extends VcnUnderlyingNetwork return this; } - /** Build the VcnCellUnderlyingNetworkPriority. */ + /** Build the VcnCellUnderlyingNetworkTemplate. */ @NonNull - public VcnCellUnderlyingNetworkPriority build() { - return new VcnCellUnderlyingNetworkPriority( + public VcnCellUnderlyingNetworkTemplate build() { + return new VcnCellUnderlyingNetworkTemplate( mNetworkQuality, mAllowMetered, mAllowedNetworkPlmnIds, diff --git a/core/java/android/net/vcn/VcnGatewayConnectionConfig.java b/core/java/android/net/vcn/VcnGatewayConnectionConfig.java index 55d3ecd2c92f..d07c24a6529c 100644 --- a/core/java/android/net/vcn/VcnGatewayConnectionConfig.java +++ b/core/java/android/net/vcn/VcnGatewayConnectionConfig.java @@ -16,7 +16,7 @@ package android.net.vcn; import static android.net.ipsec.ike.IkeSessionParams.IKE_OPTION_MOBIKE; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_OK; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_OK; import static com.android.internal.annotations.VisibleForTesting.Visibility; @@ -162,12 +162,12 @@ public final class VcnGatewayConnectionConfig { /** @hide */ @VisibleForTesting(visibility = Visibility.PRIVATE) - public static final LinkedHashSet<VcnUnderlyingNetworkPriority> + public static final LinkedHashSet<VcnUnderlyingNetworkTemplate> DEFAULT_UNDERLYING_NETWORK_PRIORITIES = new LinkedHashSet<>(); static { DEFAULT_UNDERLYING_NETWORK_PRIORITIES.add( - new VcnCellUnderlyingNetworkPriority.Builder() + new VcnCellUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .setAllowRoaming(true /* allowRoaming */) @@ -175,13 +175,13 @@ public final class VcnGatewayConnectionConfig { .build()); DEFAULT_UNDERLYING_NETWORK_PRIORITIES.add( - new VcnWifiUnderlyingNetworkPriority.Builder() + new VcnWifiUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .build()); DEFAULT_UNDERLYING_NETWORK_PRIORITIES.add( - new VcnCellUnderlyingNetworkPriority.Builder() + new VcnCellUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .setAllowRoaming(true /* allowRoaming */) @@ -202,7 +202,7 @@ public final class VcnGatewayConnectionConfig { @VisibleForTesting(visibility = Visibility.PRIVATE) public static final String UNDERLYING_NETWORK_PRIORITIES_KEY = "mUnderlyingNetworkPriorities"; - @NonNull private final LinkedHashSet<VcnUnderlyingNetworkPriority> mUnderlyingNetworkPriorities; + @NonNull private final LinkedHashSet<VcnUnderlyingNetworkTemplate> mUnderlyingNetworkPriorities; private static final String MAX_MTU_KEY = "mMaxMtu"; private final int mMaxMtu; @@ -215,7 +215,7 @@ public final class VcnGatewayConnectionConfig { @NonNull String gatewayConnectionName, @NonNull IkeTunnelConnectionParams tunnelConnectionParams, @NonNull Set<Integer> exposedCapabilities, - @NonNull LinkedHashSet<VcnUnderlyingNetworkPriority> underlyingNetworkPriorities, + @NonNull LinkedHashSet<VcnUnderlyingNetworkTemplate> underlyingNetworkPriorities, @NonNull long[] retryIntervalsMs, @IntRange(from = MIN_MTU_V6) int maxMtu) { mGatewayConnectionName = gatewayConnectionName; @@ -265,7 +265,7 @@ public final class VcnGatewayConnectionConfig { new LinkedHashSet<>( PersistableBundleUtils.toList( networkPrioritiesBundle, - VcnUnderlyingNetworkPriority::fromPersistableBundle)); + VcnUnderlyingNetworkTemplate::fromPersistableBundle)); } mRetryIntervalsMs = in.getLongArray(RETRY_INTERVAL_MS_KEY); @@ -368,14 +368,14 @@ public final class VcnGatewayConnectionConfig { } /** - * Retrieve the configured VcnUnderlyingNetworkPriority list, or a default list if it is not + * Retrieve the configured VcnUnderlyingNetworkTemplate list, or a default list if it is not * configured. * - * @see Builder#setVcnUnderlyingNetworkPriorities(LinkedHashSet<VcnUnderlyingNetworkPriority>) + * @see Builder#setVcnUnderlyingNetworkPriorities(LinkedHashSet<VcnUnderlyingNetworkTemplate>) * @hide */ @NonNull - public LinkedHashSet<VcnUnderlyingNetworkPriority> getVcnUnderlyingNetworkPriorities() { + public LinkedHashSet<VcnUnderlyingNetworkTemplate> getVcnUnderlyingNetworkPriorities() { return new LinkedHashSet<>(mUnderlyingNetworkPriorities); } @@ -418,7 +418,7 @@ public final class VcnGatewayConnectionConfig { final PersistableBundle networkPrioritiesBundle = PersistableBundleUtils.fromList( new ArrayList<>(mUnderlyingNetworkPriorities), - VcnUnderlyingNetworkPriority::toPersistableBundle); + VcnUnderlyingNetworkTemplate::toPersistableBundle); result.putString(GATEWAY_CONNECTION_NAME_KEY, mGatewayConnectionName); result.putPersistableBundle(TUNNEL_CONNECTION_PARAMS_KEY, tunnelConnectionParamsBundle); @@ -465,7 +465,7 @@ public final class VcnGatewayConnectionConfig { @NonNull private final Set<Integer> mExposedCapabilities = new ArraySet(); @NonNull - private final LinkedHashSet<VcnUnderlyingNetworkPriority> mUnderlyingNetworkPriorities = + private final LinkedHashSet<VcnUnderlyingNetworkTemplate> mUnderlyingNetworkPriorities = new LinkedHashSet<>(DEFAULT_UNDERLYING_NETWORK_PRIORITIES); @NonNull private long[] mRetryIntervalsMs = DEFAULT_RETRY_INTERVALS_MS; @@ -539,7 +539,7 @@ public final class VcnGatewayConnectionConfig { } /** - * Set the VcnUnderlyingNetworkPriority list. + * Set the VcnUnderlyingNetworkTemplate list. * * @param underlyingNetworkPriorities a list of unique VcnUnderlyingNetworkPriorities that * are ordered from most to least preferred, or an empty list to use the default @@ -550,7 +550,7 @@ public final class VcnGatewayConnectionConfig { /** @hide */ @NonNull public Builder setVcnUnderlyingNetworkPriorities( - @NonNull LinkedHashSet<VcnUnderlyingNetworkPriority> underlyingNetworkPriorities) { + @NonNull LinkedHashSet<VcnUnderlyingNetworkTemplate> underlyingNetworkPriorities) { Objects.requireNonNull( mUnderlyingNetworkPriorities, "underlyingNetworkPriorities is null"); diff --git a/core/java/android/net/vcn/VcnUnderlyingNetworkPriority.java b/core/java/android/net/vcn/VcnUnderlyingNetworkTemplate.java index 551f75772b9a..d306d5cb6826 100644 --- a/core/java/android/net/vcn/VcnUnderlyingNetworkPriority.java +++ b/core/java/android/net/vcn/VcnUnderlyingNetworkTemplate.java @@ -33,7 +33,7 @@ import java.util.Objects; // TODO: Add documents /** @hide */ -public abstract class VcnUnderlyingNetworkPriority { +public abstract class VcnUnderlyingNetworkTemplate { /** @hide */ protected static final int NETWORK_PRIORITY_TYPE_WIFI = 1; /** @hide */ @@ -68,7 +68,7 @@ public abstract class VcnUnderlyingNetworkPriority { private final boolean mAllowMetered; /** @hide */ - protected VcnUnderlyingNetworkPriority( + protected VcnUnderlyingNetworkTemplate( int networkPriorityType, int networkQuality, boolean allowMetered) { mNetworkPriorityType = networkPriorityType; mNetworkQuality = networkQuality; @@ -89,16 +89,16 @@ public abstract class VcnUnderlyingNetworkPriority { /** @hide */ @NonNull @VisibleForTesting(visibility = Visibility.PROTECTED) - public static VcnUnderlyingNetworkPriority fromPersistableBundle( + public static VcnUnderlyingNetworkTemplate fromPersistableBundle( @NonNull PersistableBundle in) { Objects.requireNonNull(in, "PersistableBundle is null"); final int networkPriorityType = in.getInt(NETWORK_PRIORITY_TYPE_KEY); switch (networkPriorityType) { case NETWORK_PRIORITY_TYPE_WIFI: - return VcnWifiUnderlyingNetworkPriority.fromPersistableBundle(in); + return VcnWifiUnderlyingNetworkTemplate.fromPersistableBundle(in); case NETWORK_PRIORITY_TYPE_CELL: - return VcnCellUnderlyingNetworkPriority.fromPersistableBundle(in); + return VcnCellUnderlyingNetworkTemplate.fromPersistableBundle(in); default: throw new IllegalArgumentException( "Invalid networkPriorityType:" + networkPriorityType); @@ -124,11 +124,11 @@ public abstract class VcnUnderlyingNetworkPriority { @Override public boolean equals(@Nullable Object other) { - if (!(other instanceof VcnUnderlyingNetworkPriority)) { + if (!(other instanceof VcnUnderlyingNetworkTemplate)) { return false; } - final VcnUnderlyingNetworkPriority rhs = (VcnUnderlyingNetworkPriority) other; + final VcnUnderlyingNetworkTemplate rhs = (VcnUnderlyingNetworkTemplate) other; return mNetworkPriorityType == rhs.mNetworkPriorityType && mNetworkQuality == rhs.mNetworkQuality && mAllowMetered == rhs.mAllowMetered; @@ -168,7 +168,7 @@ public abstract class VcnUnderlyingNetworkPriority { } /** - * This class is used to incrementally build VcnUnderlyingNetworkPriority objects. + * This class is used to incrementally build VcnUnderlyingNetworkTemplate objects. * * @param <T> The subclass to be built. */ diff --git a/core/java/android/net/vcn/VcnWifiUnderlyingNetworkPriority.java b/core/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.java index 85eb100779a2..6bbb2bfecda4 100644 --- a/core/java/android/net/vcn/VcnWifiUnderlyingNetworkPriority.java +++ b/core/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplate.java @@ -28,11 +28,11 @@ import java.util.Objects; // TODO: Add documents /** @hide */ -public final class VcnWifiUnderlyingNetworkPriority extends VcnUnderlyingNetworkPriority { +public final class VcnWifiUnderlyingNetworkTemplate extends VcnUnderlyingNetworkTemplate { private static final String SSID_KEY = "mSsid"; @Nullable private final String mSsid; - private VcnWifiUnderlyingNetworkPriority( + private VcnWifiUnderlyingNetworkTemplate( int networkQuality, boolean allowMetered, String ssid) { super(NETWORK_PRIORITY_TYPE_WIFI, networkQuality, allowMetered); mSsid = ssid; @@ -43,14 +43,14 @@ public final class VcnWifiUnderlyingNetworkPriority extends VcnUnderlyingNetwork /** @hide */ @NonNull @VisibleForTesting(visibility = Visibility.PROTECTED) - public static VcnWifiUnderlyingNetworkPriority fromPersistableBundle( + public static VcnWifiUnderlyingNetworkTemplate fromPersistableBundle( @NonNull PersistableBundle in) { Objects.requireNonNull(in, "PersistableBundle is null"); final int networkQuality = in.getInt(NETWORK_QUALITY_KEY); final boolean allowMetered = in.getBoolean(ALLOW_METERED_KEY); final String ssid = in.getString(SSID_KEY); - return new VcnWifiUnderlyingNetworkPriority(networkQuality, allowMetered, ssid); + return new VcnWifiUnderlyingNetworkTemplate(networkQuality, allowMetered, ssid); } /** @hide */ @@ -74,11 +74,11 @@ public final class VcnWifiUnderlyingNetworkPriority extends VcnUnderlyingNetwork return false; } - if (!(other instanceof VcnWifiUnderlyingNetworkPriority)) { + if (!(other instanceof VcnWifiUnderlyingNetworkTemplate)) { return false; } - final VcnWifiUnderlyingNetworkPriority rhs = (VcnWifiUnderlyingNetworkPriority) other; + final VcnWifiUnderlyingNetworkTemplate rhs = (VcnWifiUnderlyingNetworkTemplate) other; return mSsid.equals(rhs.mSsid); } @@ -94,8 +94,8 @@ public final class VcnWifiUnderlyingNetworkPriority extends VcnUnderlyingNetwork return mSsid; } - /** This class is used to incrementally build VcnWifiUnderlyingNetworkPriority objects. */ - public static class Builder extends VcnUnderlyingNetworkPriority.Builder<Builder> { + /** This class is used to incrementally build VcnWifiUnderlyingNetworkTemplate objects. */ + public static class Builder extends VcnUnderlyingNetworkTemplate.Builder<Builder> { @Nullable private String mSsid; /** Construct a Builder object. */ @@ -112,10 +112,10 @@ public final class VcnWifiUnderlyingNetworkPriority extends VcnUnderlyingNetwork return this; } - /** Build the VcnWifiUnderlyingNetworkPriority. */ + /** Build the VcnWifiUnderlyingNetworkTemplate. */ @NonNull - public VcnWifiUnderlyingNetworkPriority build() { - return new VcnWifiUnderlyingNetworkPriority(mNetworkQuality, mAllowMetered, mSsid); + public VcnWifiUnderlyingNetworkTemplate build() { + return new VcnWifiUnderlyingNetworkTemplate(mNetworkQuality, mAllowMetered, mSsid); } /** @hide */ diff --git a/services/core/java/com/android/server/vcn/routeselection/NetworkPriorityClassifier.java b/services/core/java/com/android/server/vcn/routeselection/NetworkPriorityClassifier.java index 45769575111f..bd8d13b87125 100644 --- a/services/core/java/com/android/server/vcn/routeselection/NetworkPriorityClassifier.java +++ b/services/core/java/com/android/server/vcn/routeselection/NetworkPriorityClassifier.java @@ -20,8 +20,8 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING; import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR; import static android.net.NetworkCapabilities.TRANSPORT_TEST; import static android.net.NetworkCapabilities.TRANSPORT_WIFI; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_ANY; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_OK; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_ANY; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_OK; import static com.android.server.VcnManagementService.LOCAL_LOG; @@ -29,10 +29,10 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.net.NetworkCapabilities; import android.net.TelephonyNetworkSpecifier; -import android.net.vcn.VcnCellUnderlyingNetworkPriority; +import android.net.vcn.VcnCellUnderlyingNetworkTemplate; import android.net.vcn.VcnManager; -import android.net.vcn.VcnUnderlyingNetworkPriority; -import android.net.vcn.VcnWifiUnderlyingNetworkPriority; +import android.net.vcn.VcnUnderlyingNetworkTemplate; +import android.net.vcn.VcnWifiUnderlyingNetworkTemplate; import android.os.ParcelUuid; import android.os.PersistableBundle; import android.telephony.SubscriptionManager; @@ -76,7 +76,7 @@ class NetworkPriorityClassifier { public static int calculatePriorityClass( VcnContext vcnContext, UnderlyingNetworkRecord networkRecord, - LinkedHashSet<VcnUnderlyingNetworkPriority> underlyingNetworkPriorities, + LinkedHashSet<VcnUnderlyingNetworkTemplate> underlyingNetworkPriorities, ParcelUuid subscriptionGroup, TelephonySubscriptionSnapshot snapshot, UnderlyingNetworkRecord currentlySelected, @@ -94,7 +94,7 @@ class NetworkPriorityClassifier { } int priorityIndex = 0; - for (VcnUnderlyingNetworkPriority nwPriority : underlyingNetworkPriorities) { + for (VcnUnderlyingNetworkTemplate nwPriority : underlyingNetworkPriorities) { if (checkMatchesPriorityRule( vcnContext, nwPriority, @@ -113,7 +113,7 @@ class NetworkPriorityClassifier { @VisibleForTesting(visibility = Visibility.PRIVATE) public static boolean checkMatchesPriorityRule( VcnContext vcnContext, - VcnUnderlyingNetworkPriority networkPriority, + VcnUnderlyingNetworkTemplate networkPriority, UnderlyingNetworkRecord networkRecord, ParcelUuid subscriptionGroup, TelephonySubscriptionSnapshot snapshot, @@ -130,32 +130,32 @@ class NetworkPriorityClassifier { return true; } - if (networkPriority instanceof VcnWifiUnderlyingNetworkPriority) { + if (networkPriority instanceof VcnWifiUnderlyingNetworkTemplate) { return checkMatchesWifiPriorityRule( - (VcnWifiUnderlyingNetworkPriority) networkPriority, + (VcnWifiUnderlyingNetworkTemplate) networkPriority, networkRecord, currentlySelected, carrierConfig); } - if (networkPriority instanceof VcnCellUnderlyingNetworkPriority) { + if (networkPriority instanceof VcnCellUnderlyingNetworkTemplate) { return checkMatchesCellPriorityRule( vcnContext, - (VcnCellUnderlyingNetworkPriority) networkPriority, + (VcnCellUnderlyingNetworkTemplate) networkPriority, networkRecord, subscriptionGroup, snapshot); } logWtf( - "Got unknown VcnUnderlyingNetworkPriority class: " + "Got unknown VcnUnderlyingNetworkTemplate class: " + networkPriority.getClass().getSimpleName()); return false; } @VisibleForTesting(visibility = Visibility.PRIVATE) public static boolean checkMatchesWifiPriorityRule( - VcnWifiUnderlyingNetworkPriority networkPriority, + VcnWifiUnderlyingNetworkTemplate networkPriority, UnderlyingNetworkRecord networkRecord, UnderlyingNetworkRecord currentlySelected, PersistableBundle carrierConfig) { @@ -202,7 +202,7 @@ class NetworkPriorityClassifier { @VisibleForTesting(visibility = Visibility.PRIVATE) public static boolean checkMatchesCellPriorityRule( VcnContext vcnContext, - VcnCellUnderlyingNetworkPriority networkPriority, + VcnCellUnderlyingNetworkTemplate networkPriority, UnderlyingNetworkRecord networkRecord, ParcelUuid subscriptionGroup, TelephonySubscriptionSnapshot snapshot) { diff --git a/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkController.java b/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkController.java index cd124ee6a9fa..ca2e449ffc25 100644 --- a/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkController.java +++ b/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkController.java @@ -33,7 +33,7 @@ import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.TelephonyNetworkSpecifier; import android.net.vcn.VcnGatewayConnectionConfig; -import android.net.vcn.VcnUnderlyingNetworkPriority; +import android.net.vcn.VcnUnderlyingNetworkTemplate; import android.os.Handler; import android.os.HandlerExecutor; import android.os.ParcelUuid; @@ -498,10 +498,10 @@ public class UnderlyingNetworkController { pw.println( "Currently selected: " + (mCurrentRecord == null ? null : mCurrentRecord.network)); - pw.println("VcnUnderlyingNetworkPriority list:"); + pw.println("VcnUnderlyingNetworkTemplate list:"); pw.increaseIndent(); int index = 0; - for (VcnUnderlyingNetworkPriority priority : + for (VcnUnderlyingNetworkTemplate priority : mConnectionConfig.getVcnUnderlyingNetworkPriorities()) { pw.println("Priority index: " + index); priority.dump(pw); diff --git a/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkRecord.java b/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkRecord.java index 27ba854ab197..df2f0d58565e 100644 --- a/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkRecord.java +++ b/services/core/java/com/android/server/vcn/routeselection/UnderlyingNetworkRecord.java @@ -21,7 +21,7 @@ import android.annotation.Nullable; import android.net.LinkProperties; import android.net.Network; import android.net.NetworkCapabilities; -import android.net.vcn.VcnUnderlyingNetworkPriority; +import android.net.vcn.VcnUnderlyingNetworkTemplate; import android.os.ParcelUuid; import android.os.PersistableBundle; @@ -77,7 +77,7 @@ public class UnderlyingNetworkRecord { static Comparator<UnderlyingNetworkRecord> getComparator( VcnContext vcnContext, - LinkedHashSet<VcnUnderlyingNetworkPriority> underlyingNetworkPriorities, + LinkedHashSet<VcnUnderlyingNetworkTemplate> underlyingNetworkPriorities, ParcelUuid subscriptionGroup, TelephonySubscriptionSnapshot snapshot, UnderlyingNetworkRecord currentlySelected, @@ -133,7 +133,7 @@ public class UnderlyingNetworkRecord { void dump( VcnContext vcnContext, IndentingPrintWriter pw, - LinkedHashSet<VcnUnderlyingNetworkPriority> underlyingNetworkPriorities, + LinkedHashSet<VcnUnderlyingNetworkTemplate> underlyingNetworkPriorities, ParcelUuid subscriptionGroup, TelephonySubscriptionSnapshot snapshot, UnderlyingNetworkRecord currentlySelected, diff --git a/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkPriorityTest.java b/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkTemplateTest.java index 476be44ee759..d03aee282ee1 100644 --- a/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkPriorityTest.java +++ b/tests/vcn/java/android/net/vcn/VcnCellUnderlyingNetworkTemplateTest.java @@ -15,8 +15,8 @@ */ package android.net.vcn; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_ANY; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_OK; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_ANY; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_OK; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -27,13 +27,13 @@ import org.junit.Test; import java.util.HashSet; import java.util.Set; -public class VcnCellUnderlyingNetworkPriorityTest { +public class VcnCellUnderlyingNetworkTemplateTest { private static final Set<String> ALLOWED_PLMN_IDS = new HashSet<>(); private static final Set<Integer> ALLOWED_CARRIER_IDS = new HashSet<>(); // Package private for use in VcnGatewayConnectionConfigTest - static VcnCellUnderlyingNetworkPriority getTestNetworkPriority() { - return new VcnCellUnderlyingNetworkPriority.Builder() + static VcnCellUnderlyingNetworkTemplate getTestNetworkPriority() { + return new VcnCellUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .setAllowedOperatorPlmnIds(ALLOWED_PLMN_IDS) @@ -45,7 +45,7 @@ public class VcnCellUnderlyingNetworkPriorityTest { @Test public void testBuilderAndGetters() { - final VcnCellUnderlyingNetworkPriority networkPriority = getTestNetworkPriority(); + final VcnCellUnderlyingNetworkTemplate networkPriority = getTestNetworkPriority(); assertEquals(NETWORK_QUALITY_OK, networkPriority.getNetworkQuality()); assertTrue(networkPriority.allowMetered()); assertEquals(ALLOWED_PLMN_IDS, networkPriority.getAllowedOperatorPlmnIds()); @@ -56,8 +56,8 @@ public class VcnCellUnderlyingNetworkPriorityTest { @Test public void testBuilderAndGettersForDefaultValues() { - final VcnCellUnderlyingNetworkPriority networkPriority = - new VcnCellUnderlyingNetworkPriority.Builder().build(); + final VcnCellUnderlyingNetworkTemplate networkPriority = + new VcnCellUnderlyingNetworkTemplate.Builder().build(); assertEquals(NETWORK_QUALITY_ANY, networkPriority.getNetworkQuality()); assertFalse(networkPriority.allowMetered()); assertEquals(new HashSet<String>(), networkPriority.getAllowedOperatorPlmnIds()); @@ -68,10 +68,10 @@ public class VcnCellUnderlyingNetworkPriorityTest { @Test public void testPersistableBundle() { - final VcnCellUnderlyingNetworkPriority networkPriority = getTestNetworkPriority(); + final VcnCellUnderlyingNetworkTemplate networkPriority = getTestNetworkPriority(); assertEquals( networkPriority, - VcnUnderlyingNetworkPriority.fromPersistableBundle( + VcnUnderlyingNetworkTemplate.fromPersistableBundle( networkPriority.toPersistableBundle())); } } diff --git a/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java b/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java index 377f526a9825..1f2905da08f4 100644 --- a/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java +++ b/tests/vcn/java/android/net/vcn/VcnGatewayConnectionConfigTest.java @@ -54,7 +54,7 @@ public class VcnGatewayConnectionConfigTest { }; public static final int[] UNDERLYING_CAPS = new int[] {NetworkCapabilities.NET_CAPABILITY_DUN}; - private static final LinkedHashSet<VcnUnderlyingNetworkPriority> UNDERLYING_NETWORK_PRIORITIES = + private static final LinkedHashSet<VcnUnderlyingNetworkTemplate> UNDERLYING_NETWORK_PRIORITIES = new LinkedHashSet(); static { @@ -62,9 +62,9 @@ public class VcnGatewayConnectionConfigTest { Arrays.sort(UNDERLYING_CAPS); UNDERLYING_NETWORK_PRIORITIES.add( - VcnCellUnderlyingNetworkPriorityTest.getTestNetworkPriority()); + VcnCellUnderlyingNetworkTemplateTest.getTestNetworkPriority()); UNDERLYING_NETWORK_PRIORITIES.add( - VcnWifiUnderlyingNetworkPriorityTest.getTestNetworkPriority()); + VcnWifiUnderlyingNetworkTemplateTest.getTestNetworkPriority()); } public static final long[] RETRY_INTERVALS_MS = @@ -286,7 +286,7 @@ public class VcnGatewayConnectionConfigTest { } private static VcnGatewayConnectionConfig buildTestConfigWithVcnUnderlyingNetworkPriorities( - LinkedHashSet<VcnUnderlyingNetworkPriority> networkPriorities) { + LinkedHashSet<VcnUnderlyingNetworkTemplate> networkPriorities) { return buildTestConfigWithExposedCaps( new VcnGatewayConnectionConfig.Builder( "buildTestConfigWithVcnUnderlyingNetworkPriorities", @@ -300,17 +300,17 @@ public class VcnGatewayConnectionConfigTest { final VcnGatewayConnectionConfig config = buildTestConfigWithVcnUnderlyingNetworkPriorities(UNDERLYING_NETWORK_PRIORITIES); - final LinkedHashSet<VcnUnderlyingNetworkPriority> networkPrioritiesEqual = + final LinkedHashSet<VcnUnderlyingNetworkTemplate> networkPrioritiesEqual = new LinkedHashSet(); - networkPrioritiesEqual.add(VcnCellUnderlyingNetworkPriorityTest.getTestNetworkPriority()); - networkPrioritiesEqual.add(VcnWifiUnderlyingNetworkPriorityTest.getTestNetworkPriority()); + networkPrioritiesEqual.add(VcnCellUnderlyingNetworkTemplateTest.getTestNetworkPriority()); + networkPrioritiesEqual.add(VcnWifiUnderlyingNetworkTemplateTest.getTestNetworkPriority()); final VcnGatewayConnectionConfig configEqual = buildTestConfigWithVcnUnderlyingNetworkPriorities(networkPrioritiesEqual); - final LinkedHashSet<VcnUnderlyingNetworkPriority> networkPrioritiesNotEqual = + final LinkedHashSet<VcnUnderlyingNetworkTemplate> networkPrioritiesNotEqual = new LinkedHashSet(); networkPrioritiesNotEqual.add( - VcnWifiUnderlyingNetworkPriorityTest.getTestNetworkPriority()); + VcnWifiUnderlyingNetworkTemplateTest.getTestNetworkPriority()); final VcnGatewayConnectionConfig configNotEqual = buildTestConfigWithVcnUnderlyingNetworkPriorities(networkPrioritiesNotEqual); diff --git a/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkPriorityTest.java b/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplateTest.java index dd272cb38596..652057fd48c7 100644 --- a/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkPriorityTest.java +++ b/tests/vcn/java/android/net/vcn/VcnWifiUnderlyingNetworkTemplateTest.java @@ -15,8 +15,8 @@ */ package android.net.vcn; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_ANY; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_OK; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_ANY; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_OK; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -26,13 +26,13 @@ import static org.junit.Assert.fail; import org.junit.Test; -public class VcnWifiUnderlyingNetworkPriorityTest { +public class VcnWifiUnderlyingNetworkTemplateTest { private static final String SSID = "TestWifi"; private static final int INVALID_NETWORK_QUALITY = -1; // Package private for use in VcnGatewayConnectionConfigTest - static VcnWifiUnderlyingNetworkPriority getTestNetworkPriority() { - return new VcnWifiUnderlyingNetworkPriority.Builder() + static VcnWifiUnderlyingNetworkTemplate getTestNetworkPriority() { + return new VcnWifiUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .setSsid(SSID) @@ -41,7 +41,7 @@ public class VcnWifiUnderlyingNetworkPriorityTest { @Test public void testBuilderAndGetters() { - final VcnWifiUnderlyingNetworkPriority networkPriority = getTestNetworkPriority(); + final VcnWifiUnderlyingNetworkTemplate networkPriority = getTestNetworkPriority(); assertEquals(NETWORK_QUALITY_OK, networkPriority.getNetworkQuality()); assertTrue(networkPriority.allowMetered()); assertEquals(SSID, networkPriority.getSsid()); @@ -49,8 +49,8 @@ public class VcnWifiUnderlyingNetworkPriorityTest { @Test public void testBuilderAndGettersForDefaultValues() { - final VcnWifiUnderlyingNetworkPriority networkPriority = - new VcnWifiUnderlyingNetworkPriority.Builder().build(); + final VcnWifiUnderlyingNetworkTemplate networkPriority = + new VcnWifiUnderlyingNetworkTemplate.Builder().build(); assertEquals(NETWORK_QUALITY_ANY, networkPriority.getNetworkQuality()); assertFalse(networkPriority.allowMetered()); assertNull(SSID, networkPriority.getSsid()); @@ -59,7 +59,7 @@ public class VcnWifiUnderlyingNetworkPriorityTest { @Test public void testBuildWithInvalidNetworkQuality() { try { - new VcnWifiUnderlyingNetworkPriority.Builder() + new VcnWifiUnderlyingNetworkTemplate.Builder() .setNetworkQuality(INVALID_NETWORK_QUALITY); fail("Expected to fail due to the invalid network quality"); } catch (Exception expected) { @@ -68,10 +68,10 @@ public class VcnWifiUnderlyingNetworkPriorityTest { @Test public void testPersistableBundle() { - final VcnWifiUnderlyingNetworkPriority networkPriority = getTestNetworkPriority(); + final VcnWifiUnderlyingNetworkTemplate networkPriority = getTestNetworkPriority(); assertEquals( networkPriority, - VcnUnderlyingNetworkPriority.fromPersistableBundle( + VcnUnderlyingNetworkTemplate.fromPersistableBundle( networkPriority.toPersistableBundle())); } } diff --git a/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java b/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java index 46a614f60ae7..f23d5bf67ebf 100644 --- a/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java +++ b/tests/vcn/java/com/android/server/vcn/routeselection/NetworkPriorityClassifierTest.java @@ -16,7 +16,7 @@ package com.android.server.vcn.routeselection; -import static android.net.vcn.VcnUnderlyingNetworkPriority.NETWORK_QUALITY_OK; +import static android.net.vcn.VcnUnderlyingNetworkTemplate.NETWORK_QUALITY_OK; import static com.android.server.vcn.VcnTestUtils.setupSystemService; import static com.android.server.vcn.routeselection.NetworkPriorityClassifier.PRIORITY_ANY; @@ -39,10 +39,10 @@ import android.net.LinkProperties; import android.net.Network; import android.net.NetworkCapabilities; import android.net.TelephonyNetworkSpecifier; -import android.net.vcn.VcnCellUnderlyingNetworkPriority; +import android.net.vcn.VcnCellUnderlyingNetworkTemplate; import android.net.vcn.VcnGatewayConnectionConfig; import android.net.vcn.VcnManager; -import android.net.vcn.VcnWifiUnderlyingNetworkPriority; +import android.net.vcn.VcnWifiUnderlyingNetworkTemplate; import android.os.ParcelUuid; import android.os.PersistableBundle; import android.os.test.TestLooper; @@ -142,8 +142,8 @@ public class NetworkPriorityClassifierTest { @Test public void testMatchWithoutNotMeteredBit() { - final VcnWifiUnderlyingNetworkPriority wifiNetworkPriority = - new VcnWifiUnderlyingNetworkPriority.Builder() + final VcnWifiUnderlyingNetworkTemplate wifiNetworkPriority = + new VcnWifiUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(false /* allowMetered */) .build(); @@ -161,8 +161,8 @@ public class NetworkPriorityClassifierTest { private void verifyMatchWifi( boolean isSelectedNetwork, PersistableBundle carrierConfig, boolean expectMatch) { - final VcnWifiUnderlyingNetworkPriority wifiNetworkPriority = - new VcnWifiUnderlyingNetworkPriority.Builder() + final VcnWifiUnderlyingNetworkTemplate wifiNetworkPriority = + new VcnWifiUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .build(); @@ -211,8 +211,8 @@ public class NetworkPriorityClassifierTest { private void verifyMatchWifiWithSsid(boolean useMatchedSsid, boolean expectMatch) { final String nwPrioritySsid = useMatchedSsid ? SSID : SSID_OTHER; - final VcnWifiUnderlyingNetworkPriority wifiNetworkPriority = - new VcnWifiUnderlyingNetworkPriority.Builder() + final VcnWifiUnderlyingNetworkTemplate wifiNetworkPriority = + new VcnWifiUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .setSsid(nwPrioritySsid) @@ -237,8 +237,8 @@ public class NetworkPriorityClassifierTest { verifyMatchWifiWithSsid(false /* useMatchedSsid */, false /* expectMatch */); } - private static VcnCellUnderlyingNetworkPriority.Builder getCellNetworkPriorityBuilder() { - return new VcnCellUnderlyingNetworkPriority.Builder() + private static VcnCellUnderlyingNetworkTemplate.Builder getCellNetworkPriorityBuilder() { + return new VcnCellUnderlyingNetworkTemplate.Builder() .setNetworkQuality(NETWORK_QUALITY_OK) .setAllowMetered(true /* allowMetered */) .setAllowRoaming(true /* allowRoaming */); @@ -257,7 +257,7 @@ public class NetworkPriorityClassifierTest { @Test public void testMatchOpportunisticCell() { - final VcnCellUnderlyingNetworkPriority opportunisticCellNetworkPriority = + final VcnCellUnderlyingNetworkTemplate opportunisticCellNetworkPriority = getCellNetworkPriorityBuilder() .setRequireOpportunistic(true /* requireOpportunistic */) .build(); @@ -277,7 +277,7 @@ public class NetworkPriorityClassifierTest { private void verifyMatchMacroCellWithAllowedPlmnIds( boolean useMatchedPlmnId, boolean expectMatch) { final String networkPriorityPlmnId = useMatchedPlmnId ? PLMN_ID : PLMN_ID_OTHER; - final VcnCellUnderlyingNetworkPriority networkPriority = + final VcnCellUnderlyingNetworkTemplate networkPriority = getCellNetworkPriorityBuilder() .setAllowedOperatorPlmnIds(Set.of(networkPriorityPlmnId)) .build(); @@ -306,7 +306,7 @@ public class NetworkPriorityClassifierTest { private void verifyMatchMacroCellWithAllowedSpecificCarrierIds( boolean useMatchedCarrierId, boolean expectMatch) { final int networkPriorityCarrierId = useMatchedCarrierId ? CARRIER_ID : CARRIER_ID_OTHER; - final VcnCellUnderlyingNetworkPriority networkPriority = + final VcnCellUnderlyingNetworkTemplate networkPriority = getCellNetworkPriorityBuilder() .setAllowedSpecificCarrierIds(Set.of(networkPriorityCarrierId)) .build(); @@ -335,7 +335,7 @@ public class NetworkPriorityClassifierTest { @Test public void testMatchWifiFailWithoutNotRoamingBit() { - final VcnCellUnderlyingNetworkPriority networkPriority = + final VcnCellUnderlyingNetworkTemplate networkPriority = getCellNetworkPriorityBuilder().setAllowRoaming(false /* allowRoaming */).build(); assertFalse( |