Merge "Fix NetworkCapabilities MTS on S, CTS on S+module"

This commit is contained in:
Remi NGUYEN VAN
2021-08-17 02:34:44 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 1 deletions

View File

@@ -813,6 +813,19 @@ public final class NetworkCapabilities implements Parcelable {
}
}
/**
* @see #restrictCapabilitiesForTestNetwork(int)
* @deprecated Use {@link #restrictCapabilitiesForTestNetwork(int)} (without the typo) instead.
* @hide
*/
@Deprecated
public void restrictCapabilitesForTestNetwork(int creatorUid) {
// Do not remove without careful consideration: this method has a typo in its name but is
// called by the first S CTS releases, therefore it cannot be removed from the connectivity
// module as long as such CTS releases are valid for testing S devices.
restrictCapabilitiesForTestNetwork(creatorUid);
}
/**
* Test networks have strong restrictions on what capabilities they can have. Enforce these
* restrictions.

View File

@@ -75,6 +75,7 @@ import android.util.Range;
import androidx.test.runner.AndroidJUnit4;
import com.android.testutils.CompatUtil;
import com.android.testutils.ConnectivityModuleTest;
import com.android.testutils.DevSdkIgnoreRule;
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
@@ -1168,7 +1169,7 @@ public class NetworkCapabilitiesTest {
assertEquals(0, nc.getCapabilities().length);
}
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
@Test @IgnoreUpTo(Build.VERSION_CODES.R) @ConnectivityModuleTest
public void testRestrictCapabilitiesForTestNetwork() {
final int ownerUid = 1234;
final int[] administratorUids = {1001, ownerUid};