Rename tethering jni and get the jni by its package name
tetherutiljni is renamed to com_android_networkstack_tethering_jni_util
Bug: 205088391
Test: atest TetheringTests
atest CtsTetheringTest
atest TetheringPrivilegedTests
Change-Id: Ifd1f4473625e33d3ebe190c9f8a2b5d54aa1ff49
This commit is contained in:
@@ -84,7 +84,7 @@ android_library {
|
||||
|
||||
// Due to b/143733063, APK can't access a jni lib that is in APEX (but not in the APK).
|
||||
cc_library {
|
||||
name: "libtetherutilsjni",
|
||||
name: "libcom_android_networkstack_tethering_util_jni",
|
||||
sdk_version: "30",
|
||||
apex_available: [
|
||||
"//apex_available:platform", // Used by InProcessTethering
|
||||
@@ -133,7 +133,7 @@ java_defaults {
|
||||
name: "TetheringAppDefaults",
|
||||
privileged: true,
|
||||
jni_libs: [
|
||||
"libtetherutilsjni",
|
||||
"libcom_android_networkstack_tethering_util_jni",
|
||||
],
|
||||
resource_dirs: [
|
||||
"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.TetheringConfiguration.DEFAULT_TETHER_OFFLOAD_POLL_INTERVAL_MS;
|
||||
import static com.android.networkstack.tethering.UpstreamNetworkState.isVcnInterface;
|
||||
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||
|
||||
import android.app.usage.NetworkStatsManager;
|
||||
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.
|
||||
// TODO: is there a better way?
|
||||
static {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
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_IPV6;
|
||||
|
||||
import static com.android.networkstack.tethering.util.TetheringUtils.getTetheringJniLibraryName;
|
||||
|
||||
import android.net.util.InterfaceParams;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -31,7 +33,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public class BpfUtils {
|
||||
static {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
// For better code clarity when used for 'bool ingress' parameter.
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.net.module.util.JniUtil;
|
||||
import com.android.networkstack.tethering.TetherStatsValue;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@@ -37,13 +38,18 @@ import java.util.Objects;
|
||||
*/
|
||||
public class TetheringUtils {
|
||||
static {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
/** 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.
|
||||
* @param fd the socket's {@link FileDescriptor}.
|
||||
|
||||
@@ -142,7 +142,7 @@ android_test {
|
||||
"libstaticjvmtiagent",
|
||||
// For NetworkStackUtils included in NetworkStackBase
|
||||
"libnetworkstackutilsjni",
|
||||
"libtetherutilsjni",
|
||||
"libcom_android_networkstack_tethering_util_jni",
|
||||
],
|
||||
compile_multilib: "both",
|
||||
manifest: "AndroidManifest_coverage.xml",
|
||||
|
||||
@@ -23,7 +23,7 @@ java_defaults {
|
||||
jni_libs: [
|
||||
"libdexmakerjvmtiagent",
|
||||
"libstaticjvmtiagent",
|
||||
"libtetherutilsjni",
|
||||
"libcom_android_networkstack_tethering_util_jni",
|
||||
],
|
||||
jni_uses_sdk_apis: true,
|
||||
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.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.assertNotNull;
|
||||
@@ -80,7 +81,7 @@ public class DadProxyTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupOnce() {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
|
||||
final Instrumentation inst = InstrumentationRegistry.getInstrumentation();
|
||||
final IBinder netdIBinder =
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.android.networkstack.tethering;
|
||||
|
||||
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.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -59,7 +61,7 @@ public final class BpfMapTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupOnce() {
|
||||
System.loadLibrary("tetherutilsjni");
|
||||
System.loadLibrary(getTetheringJniLibraryName());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
||||
@@ -75,7 +75,7 @@ java_defaults {
|
||||
// For mockito extended
|
||||
"libdexmakerjvmtiagent",
|
||||
"libstaticjvmtiagent",
|
||||
"libtetherutilsjni",
|
||||
"libcom_android_networkstack_tethering_util_jni",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ android_test {
|
||||
"libstaticjvmtiagent",
|
||||
// For NetworkStackUtils included in NetworkStackBase
|
||||
"libnetworkstackutilsjni",
|
||||
"libtetherutilsjni",
|
||||
"libcom_android_networkstack_tethering_util_jni",
|
||||
// For framework tests
|
||||
"libservice-connectivity",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user