Merge changes from topics "rename-libbpfmapjni", "rename-libtetherutiljni"
* changes: Rename libbpfmapjni and include bpf common util library Rename tethering jni and get the jni by its package name
This commit is contained in:
@@ -43,6 +43,7 @@ java_defaults {
|
|||||||
"android.hardware.tetheroffload.control-V1.1-java",
|
"android.hardware.tetheroffload.control-V1.1-java",
|
||||||
"net-utils-framework-common",
|
"net-utils-framework-common",
|
||||||
"net-utils-device-common",
|
"net-utils-device-common",
|
||||||
|
"net-utils-device-common-bpf",
|
||||||
"net-utils-device-common-netlink",
|
"net-utils-device-common-netlink",
|
||||||
"netd-client",
|
"netd-client",
|
||||||
],
|
],
|
||||||
@@ -84,7 +85,7 @@ android_library {
|
|||||||
|
|
||||||
// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
|
// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libtetherutilsjni",
|
name: "libcom_android_networkstack_tethering_util_jni",
|
||||||
sdk_version: "30",
|
sdk_version: "30",
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"//apex_available:platform", // Used by InProcessTethering
|
"//apex_available:platform", // Used by InProcessTethering
|
||||||
@@ -103,7 +104,7 @@ cc_library {
|
|||||||
"libnativehelper_compat_libc++",
|
"libnativehelper_compat_libc++",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"libbpfmapjni",
|
"libnet_utils_device_common_bpfjni",
|
||||||
"libnetjniutils",
|
"libnetjniutils",
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ java_defaults {
|
|||||||
name: "TetheringAppDefaults",
|
name: "TetheringAppDefaults",
|
||||||
privileged: true,
|
privileged: true,
|
||||||
jni_libs: [
|
jni_libs: [
|
||||||
"libtetherutilsjni",
|
"libcom_android_networkstack_tethering_util_jni",
|
||||||
],
|
],
|
||||||
resource_dirs: [
|
resource_dirs: [
|
||||||
"res",
|
"res",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import static com.android.networkstack.tethering.BpfUtils.DOWNSTREAM;
|
|||||||
import static com.android.networkstack.tethering.BpfUtils.UPSTREAM;
|
import static com.android.networkstack.tethering.BpfUtils.UPSTREAM;
|
||||||
import static com.android.networkstack.tethering.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS;
|
import static com.android.networkstack.tethering.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS;
|
||||||
import static com.android.networkstack.tethering.UpstreamNetworkState.isVcnInterface;
|
import static com.android.networkstack.tethering.UpstreamNetworkState.isVcnInterface;
|
||||||
|
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||||
|
|
||||||
import android.app.usage.NetworkStatsManager;
|
import android.app.usage.NetworkStatsManager;
|
||||||
import android.net.INetd;
|
import android.net.INetd;
|
||||||
@@ -99,7 +100,7 @@ public class BpfCoordinator {
|
|||||||
// TetherService, but for tests it needs to be either loaded here or loaded by every test.
|
// TetherService, but for tests it needs to be either loaded here or loaded by every test.
|
||||||
// TODO: is there a better way?
|
// TODO: is there a better way?
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("tetherutilsjni");
|
System.loadLibrary(getTetheringJniLibraryName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String TAG = BpfCoordinator.class.getSimpleName();
|
private static final String TAG = BpfCoordinator.class.getSimpleName();
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.android.networkstack.tethering;
|
|||||||
import static android.system.OsConstants.ETH_P_IP;
|
import static android.system.OsConstants.ETH_P_IP;
|
||||||
import static android.system.OsConstants.ETH_P_IPV6;
|
import static android.system.OsConstants.ETH_P_IPV6;
|
||||||
|
|
||||||
|
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||||
|
|
||||||
import android.net.util.InterfaceParams;
|
import android.net.util.InterfaceParams;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -31,7 +33,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class BpfUtils {
|
public class BpfUtils {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("tetherutilsjni");
|
System.loadLibrary(getTetheringJniLibraryName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// For better code clarity when used for 'bool ingress' parameter.
|
// For better code clarity when used for 'bool ingress' parameter.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.android.net.module.util.JniUtil;
|
||||||
import com.android.networkstack.tethering.TetherStatsValue;
|
import com.android.networkstack.tethering.TetherStatsValue;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
@@ -37,13 +38,18 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
public class TetheringUtils {
|
public class TetheringUtils {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("tetherutilsjni");
|
System.loadLibrary(getTetheringJniLibraryName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final byte[] ALL_NODES = new byte[] {
|
public static final byte[] ALL_NODES = new byte[] {
|
||||||
(byte) 0xff, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
(byte) 0xff, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** The name should be com_android_networkstack_tethering_util_jni. */
|
||||||
|
public static String getTetheringJniLibraryName() {
|
||||||
|
return JniUtil.getJniLibraryName(TetheringUtils.class.getPackage());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures a socket for receiving and sending ICMPv6 neighbor advertisments.
|
* Configures a socket for receiving and sending ICMPv6 neighbor advertisments.
|
||||||
* @param fd the socket's {@link FileDescriptor}.
|
* @param fd the socket's {@link FileDescriptor}.
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ android_test {
|
|||||||
"libstaticjvmtiagent",
|
"libstaticjvmtiagent",
|
||||||
// For NetworkStackUtils included in NetworkStackBase
|
// For NetworkStackUtils included in NetworkStackBase
|
||||||
"libnetworkstackutilsjni",
|
"libnetworkstackutilsjni",
|
||||||
"libtetherutilsjni",
|
"libcom_android_networkstack_tethering_util_jni",
|
||||||
],
|
],
|
||||||
compile_multilib: "both",
|
compile_multilib: "both",
|
||||||
manifest: "AndroidManifest_coverage.xml",
|
manifest: "AndroidManifest_coverage.xml",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ java_defaults {
|
|||||||
jni_libs: [
|
jni_libs: [
|
||||||
"libdexmakerjvmtiagent",
|
"libdexmakerjvmtiagent",
|
||||||
"libstaticjvmtiagent",
|
"libstaticjvmtiagent",
|
||||||
"libtetherutilsjni",
|
"libcom_android_networkstack_tethering_util_jni",
|
||||||
],
|
],
|
||||||
jni_uses_sdk_apis: true,
|
jni_uses_sdk_apis: true,
|
||||||
jarjar_rules: ":TetheringTestsJarJarRules",
|
jarjar_rules: ":TetheringTestsJarJarRules",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static android.system.OsConstants.IPPROTO_ICMPV6;
|
|||||||
|
|
||||||
import static com.android.net.module.util.IpUtils.icmpv6Checksum;
|
import static com.android.net.module.util.IpUtils.icmpv6Checksum;
|
||||||
import static com.android.net.module.util.NetworkStackConstants.ETHER_SRC_ADDR_OFFSET;
|
import static com.android.net.module.util.NetworkStackConstants.ETHER_SRC_ADDR_OFFSET;
|
||||||
|
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@@ -80,7 +81,7 @@ public class DadProxyTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupOnce() {
|
public static void setupOnce() {
|
||||||
System.loadLibrary("tetherutilsjni");
|
System.loadLibrary(getTetheringJniLibraryName());
|
||||||
|
|
||||||
final Instrumentation inst = InstrumentationRegistry.getInstrumentation();
|
final Instrumentation inst = InstrumentationRegistry.getInstrumentation();
|
||||||
final IBinder netdIBinder =
|
final IBinder netdIBinder =
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ package com.android.networkstack.tethering;
|
|||||||
|
|
||||||
import static android.system.OsConstants.ETH_P_IPV6;
|
import static android.system.OsConstants.ETH_P_IPV6;
|
||||||
|
|
||||||
|
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@@ -59,7 +61,7 @@ public final class BpfMapTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupOnce() {
|
public static void setupOnce() {
|
||||||
System.loadLibrary("tetherutilsjni");
|
System.loadLibrary(getTetheringJniLibraryName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ java_defaults {
|
|||||||
// For mockito extended
|
// For mockito extended
|
||||||
"libdexmakerjvmtiagent",
|
"libdexmakerjvmtiagent",
|
||||||
"libstaticjvmtiagent",
|
"libstaticjvmtiagent",
|
||||||
"libtetherutilsjni",
|
"libcom_android_networkstack_tethering_util_jni",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ android_test {
|
|||||||
"libstaticjvmtiagent",
|
"libstaticjvmtiagent",
|
||||||
// For NetworkStackUtils included in NetworkStackBase
|
// For NetworkStackUtils included in NetworkStackBase
|
||||||
"libnetworkstackutilsjni",
|
"libnetworkstackutilsjni",
|
||||||
"libtetherutilsjni",
|
"libcom_android_networkstack_tethering_util_jni",
|
||||||
// For framework tests
|
// For framework tests
|
||||||
"libservice-connectivity",
|
"libservice-connectivity",
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user