summaryrefslogtreecommitdiff
path: root/tests/common/java/android/net/apf/ApfCapabilitiesTest.java
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <reminv@google.com>2021-04-23 15:39:02 +0900
committerRemi NGUYEN VAN <reminv@google.com>2021-05-13 14:40:10 +0000
commit0aa7a4747ff202020d4395fe6ba29c53513180f6 (patch)
tree7e00c6d1e20fb37948617d235ea96f2fdb72eaac /tests/common/java/android/net/apf/ApfCapabilitiesTest.java
parentbf29bd345742e7f89efcabb52432043616fcb2ee (diff)
Move config_apf* resources to NetworkStack
The resources are only read by NetworkStack through their respective ApfCapabilities SystemApi methods. As the resources are being migrated out of frameworks/base resources anyway, move them directly to NetworkStack instead of moving them to ServiceConnectivityResources. Also test that the framework resources are not overlaid or modified. This should avoid OEM integration errors where the overlays are kept as in R, without overlaying the resource in the NetworkStack package. Bug: 185850634 Test: atest CtsNetTestCases BYPASS_INCLUSIVE_LANGUAGE_REASON=Need to mention legacy APIs Change-Id: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
Diffstat (limited to 'tests/common/java/android/net/apf/ApfCapabilitiesTest.java')
-rw-r--r--tests/common/java/android/net/apf/ApfCapabilitiesTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/common/java/android/net/apf/ApfCapabilitiesTest.java b/tests/common/java/android/net/apf/ApfCapabilitiesTest.java
index d50406fd3a..88996d9252 100644
--- a/tests/common/java/android/net/apf/ApfCapabilitiesTest.java
+++ b/tests/common/java/android/net/apf/ApfCapabilitiesTest.java
@@ -18,6 +18,7 @@ package android.net.apf;
import static com.android.testutils.ParcelUtils.assertParcelSane;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -25,12 +26,17 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import android.content.Context;
+import android.os.Build;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
+import com.android.testutils.DevSdkIgnoreRule;
+import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
+
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -39,6 +45,9 @@ import java.util.Arrays;
@RunWith(AndroidJUnit4.class)
@SmallTest
public class ApfCapabilitiesTest {
+ @Rule
+ public final DevSdkIgnoreRule mIgnoreRule = new DevSdkIgnoreRule();
+
private Context mContext;
@Before
@@ -85,6 +94,17 @@ public class ApfCapabilitiesTest {
assertEquals(shouldDrop8023Frames, actual);
}
+ @Test @IgnoreUpTo(Build.VERSION_CODES.R)
+ public void testGetApfDrop8023Frames_S() {
+ // IpClient does not call getApfDrop8023Frames() since S, so any customization of the return
+ // value on S+ is a configuration error as it will not be used by IpClient.
+ assertTrue("android.R.bool.config_apfDrop802_3Frames has been modified to false, but "
+ + "starting from S its value is not used by IpClient. If the modification is "
+ + "intentional, use a runtime resource overlay for the NetworkStack package to "
+ + "overlay com.android.networkstack.R.bool.config_apfDrop802_3Frames instead.",
+ ApfCapabilities.getApfDrop8023Frames());
+ }
+
@Test
public void testGetApfEtherTypeBlackList() {
// Get com.android.internal.R.array.config_apfEthTypeBlackList. The test cannot directly
@@ -96,4 +116,17 @@ public class ApfCapabilitiesTest {
assertNotNull(actual);
assertTrue(Arrays.equals(blacklistedEtherTypeArray, actual));
}
+
+ @Test @IgnoreUpTo(Build.VERSION_CODES.R)
+ public void testGetApfEtherTypeBlackList_S() {
+ // IpClient does not call getApfEtherTypeBlackList() since S, so any customization of the
+ // return value on S+ is a configuration error as it will not be used by IpClient.
+ assertArrayEquals("android.R.array.config_apfEthTypeBlackList has been modified, but "
+ + "starting from S its value is not used by IpClient. If the modification "
+ + "is intentional, use a runtime resource overlay for the NetworkStack "
+ + "package to overlay "
+ + "com.android.networkstack.R.array.config_apfEthTypeDenyList instead.",
+ new int[] { 0x88a2, 0x88a4, 0x88b8, 0x88cd, 0x88e3 },
+ ApfCapabilities.getApfEtherTypeBlackList());
+ }
}