From a628730d0aae5a2daf462c618624ff035ad6a9c1 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Wed, 23 Jan 2019 23:11:12 +0900 Subject: [PATCH] Add SocketUtils for NetworkStack These utilities can only be used for privileged apps. The underlying implementation cannot be @SystemApi. Test: m Bug: 112869080 Change-Id: Idfa90561102e5b03ab2b79486d3ad46457128bf8 --- core/java/android/net/apf/ApfCapabilities.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/java/android/net/apf/ApfCapabilities.java b/core/java/android/net/apf/ApfCapabilities.java index 73cf94b785..baf5585589 100644 --- a/core/java/android/net/apf/ApfCapabilities.java +++ b/core/java/android/net/apf/ApfCapabilities.java @@ -18,6 +18,9 @@ package android.net.apf; import android.annotation.SystemApi; import android.annotation.TestApi; +import android.content.Context; + +import com.android.internal.R; /** * APF program support capabilities. @@ -74,4 +77,18 @@ public class ApfCapabilities { public boolean hasDataAccess() { return apfVersionSupported >= 4; } + + /** + * @return Whether the APF Filter in the device should filter out IEEE 802.3 Frames. + */ + public boolean getApfDrop8023Frames(Context context) { + return context.getResources().getBoolean(R.bool.config_apfDrop802_3Frames); + } + + /** + * @return An array of blacklisted EtherType, packets with EtherTypes within it will be dropped. + */ + public int[] getApfEthTypeBlackList(Context context) { + return context.getResources().getIntArray(R.array.config_apfEthTypeBlackList); + } }