From b11ba415f6dfe0175c2040367300350c42c201cb Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Fri, 23 Apr 2021 15:39:02 +0900 Subject: [PATCH] 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 --- .../src/android/net/apf/ApfCapabilities.java | 30 +++-------------- .../res/values/config.xml | 16 --------- .../res/values/overlayable.xml | 2 -- .../android/net/apf/ApfCapabilitiesTest.java | 33 +++++++++++++++++++ 4 files changed, 37 insertions(+), 44 deletions(-) diff --git a/framework/src/android/net/apf/ApfCapabilities.java b/framework/src/android/net/apf/ApfCapabilities.java index 85b24713f2..663c1b3d2d 100644 --- a/framework/src/android/net/apf/ApfCapabilities.java +++ b/framework/src/android/net/apf/ApfCapabilities.java @@ -131,43 +131,21 @@ public final class ApfCapabilities implements Parcelable { * @return Whether the APF Filter in the device should filter out IEEE 802.3 Frames. */ public static boolean getApfDrop8023Frames() { - // TODO(b/183076074): remove reading resources from system resources + // TODO: deprecate/remove this method (now unused in the platform), as the resource was + // moved to NetworkStack. final Resources systemRes = Resources.getSystem(); final int id = systemRes.getIdentifier("config_apfDrop802_3Frames", "bool", "android"); return systemRes.getBoolean(id); } - /** - * @return Whether the APF Filter in the device should filter out IEEE 802.3 Frames. - * @hide - */ - public static boolean getApfDrop8023Frames(@NonNull Context context) { - final ConnectivityResources res = getResources(context); - // TODO(b/183076074): use R.bool.config_apfDrop802_3Frames directly - final int id = res.get().getIdentifier("config_apfDrop802_3Frames", "bool", - res.getResourcesContext().getPackageName()); - return res.get().getBoolean(id); - } - /** * @return An array of denylisted EtherType, packets with EtherTypes within it will be dropped. */ public static @NonNull int[] getApfEtherTypeBlackList() { - // TODO(b/183076074): remove reading resources from system resources + // TODO: deprecate/remove this method (now unused in the platform), as the resource was + // moved to NetworkStack. final Resources systemRes = Resources.getSystem(); final int id = systemRes.getIdentifier("config_apfEthTypeBlackList", "array", "android"); return systemRes.getIntArray(id); } - - /** - * @return An array of denylisted EtherType, packets with EtherTypes within it will be dropped. - * @hide - */ - public static @NonNull int[] getApfEtherTypeDenyList(@NonNull Context context) { - final ConnectivityResources res = getResources(context); - // TODO(b/183076074): use R.array.config_apfEthTypeDenyList directly - final int id = res.get().getIdentifier("config_apfEthTypeDenyList", "array", - res.getResourcesContext().getPackageName()); - return res.get().getIntArray(id); - } } diff --git a/service/ServiceConnectivityResources/res/values/config.xml b/service/ServiceConnectivityResources/res/values/config.xml index 9ff2a2209e..078a9eb582 100644 --- a/service/ServiceConnectivityResources/res/values/config.xml +++ b/service/ServiceConnectivityResources/res/values/config.xml @@ -52,22 +52,6 @@ 12,60000 - - true - - - - 0x88A2 - 0x88A4 - 0x88B8 - 0x88CD - 0x88E3 - -