[NETD-BPF#1] Move libnetdutils to framework/libs/net/...
libnetdutils is referenced by netd.c and TrafficController.cpp, which
are going to be mainlined. Therefore, move libnetdutils to a common
place where both mainline module and platform code (Netd) can refer to.
Bug: 202086915
Test: build; flash; cd system/netd; atest
No-Typo-Check: Clean code move with no other changes.
BYPASS_INCLUSIVE_LANGUAGE_REASON=Clean code move with no other changes.
Merged-In: I645bfe35f6543149c9a9f894cd4158d27a481abe
Change-Id: I645bfe35f6543149c9a9f894cd4158d27a481abe
diff --git a/staticlibs/netd/libnetdutils/Android.bp b/staticlibs/netd/libnetdutils/Android.bp
new file mode 100644
index 0000000..3bb6270
--- /dev/null
+++ b/staticlibs/netd/libnetdutils/Android.bp
@@ -0,0 +1,65 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library {
+ name: "libnetdutils",
+ srcs: [
+ "DumpWriter.cpp",
+ "Fd.cpp",
+ "InternetAddresses.cpp",
+ "Log.cpp",
+ "Netfilter.cpp",
+ "Netlink.cpp",
+ "Slice.cpp",
+ "Socket.cpp",
+ "SocketOption.cpp",
+ "Status.cpp",
+ "Syscalls.cpp",
+ "UniqueFd.cpp",
+ "UniqueFile.cpp",
+ ],
+ defaults: ["netd_defaults"],
+ cflags: ["-Wall", "-Werror"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ ],
+ export_shared_lib_headers: [
+ "libbase",
+ ],
+ export_include_dirs: ["include"],
+ sanitize: {
+ cfi: true,
+ },
+
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.resolv",
+ ],
+ min_sdk_version: "29",
+}
+
+cc_test {
+ name: "netdutils_test",
+ srcs: [
+ "BackoffSequenceTest.cpp",
+ "FdTest.cpp",
+ "InternetAddressesTest.cpp",
+ "LogTest.cpp",
+ "MemBlockTest.cpp",
+ "SliceTest.cpp",
+ "StatusTest.cpp",
+ "SyscallsTest.cpp",
+ "ThreadUtilTest.cpp",
+ ],
+ defaults: ["netd_defaults"],
+ test_suites: ["device-tests"],
+ static_libs: [
+ "libgmock",
+ "libnetdutils",
+ ],
+ shared_libs: [
+ "libbase",
+ ],
+}