[NETD-TC#14] Add traffic controller JNI to tethering module

This CL provides native methods to access BPF maps via a native library.

Bug: 202086915
Test: m; flash; boot;
Change-Id: I2e5d03d0c2e31ba11996d1b28ead9b552397fe29
This commit is contained in:
Wayne Ma
2022-01-13 10:35:05 +08:00
parent 320b95dd6d
commit 790c83e387
5 changed files with 346 additions and 1 deletions

View File

@@ -28,6 +28,11 @@ import android.util.Log;
public class BpfNetMaps {
private static final String TAG = "BpfNetMaps";
static {
System.loadLibrary("traffic_controller_jni");
native_init();
}
/**
* Add naughty app bandwidth rule for specific app
*
@@ -239,6 +244,7 @@ public class BpfNetMaps {
return -err;
}
private static native void native_init();
private native int native_addNaughtyApp(int uid);
private native int native_removeNaughtyApp(int uid);
private native int native_addNiceApp(int uid);