Merge "Retain subscription IDs on restricted test networks" am: 51db40f5e5

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2506442

Change-Id: If98b45cbbd181ab18c7c7be9a33851b8a5ea0e6b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yan Yan
2023-03-31 04:16:38 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 3 deletions

View File

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

View File

@@ -1387,6 +1387,9 @@ public class NetworkCapabilitiesTest {
// If the test network is restricted, then the network may declare any transport, and // If the test network is restricted, then the network may declare any transport, and
// appended with TRANSPORT_TEST. // appended with TRANSPORT_TEST.
expectedNcBuilder.addTransportType(TRANSPORT_CELLULAR); 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); expectedNcBuilder.addTransportType(TRANSPORT_TEST);