Merge "Retain subscription IDs on restricted test networks"

This commit is contained in:
Yan Yan
2023-03-31 03:44:15 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 3 deletions

View File

@@ -1134,14 +1134,16 @@ public final class NetworkCapabilities implements Parcelable {
mTransportTypes =
(originalTransportTypes & UNRESTRICTED_TEST_NETWORKS_ALLOWED_TRANSPORTS)
| (1 << TRANSPORT_TEST);
// SubIds are only allowed for Test Networks that only declare TRANSPORT_TEST.
setSubscriptionIds(originalSubIds);
} else {
// If the test network is restricted, then it may declare any transport.
mTransportTypes = (originalTransportTypes | (1 << TRANSPORT_TEST));
}
if (hasSingleTransport(TRANSPORT_TEST)) {
// SubIds are only allowed for Test Networks that only declare TRANSPORT_TEST.
setSubscriptionIds(originalSubIds);
}
mNetworkCapabilities = originalCapabilities & TEST_NETWORKS_ALLOWED_CAPABILITIES;
if (!hasTransport(TRANSPORT_CELLULAR)) {
mNetworkCapabilities |=

View File

@@ -1387,6 +1387,9 @@ public class NetworkCapabilitiesTest {
// If the test network is restricted, then the network may declare any transport, and
// appended with TRANSPORT_TEST.
expectedNcBuilder.addTransportType(TRANSPORT_CELLULAR);
} else {
// If the test network only has TRANSPORT_TEST, then it can keep the subscription IDs.
expectedNcBuilder.setSubscriptionIds(Set.of(TEST_SUBID1));
}
expectedNcBuilder.addTransportType(TRANSPORT_TEST);