Rename libnetdbpf to libnetworkstats

Two reason for renaming:
1. Avoid module name collision in sc-mainline-prod branch.
2. The libnetdbpf was misnamed before.

Bug: 202086915
Test: atest libnetworkstats_test FrameworksNetTests
      ConnectivityCoverageTests FrameworksNetSmokeTests
      CtsAppOpsTestCases
Change-Id: I87fcf4b1a9d58780a45743a9aa91b9b936e54266
diff --git a/service-t/native/libs/libnetdbpf/Android.bp b/service-t/native/libs/libnetworkstats/Android.bp
similarity index 66%
rename from service-t/native/libs/libnetdbpf/Android.bp
rename to service-t/native/libs/libnetworkstats/Android.bp
index d586d68..bceeefa 100644
--- a/service-t/native/libs/libnetdbpf/Android.bp
+++ b/service-t/native/libs/libnetworkstats/Android.bp
@@ -15,16 +15,11 @@
 //
 
 package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_netd_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_netd_license"],
+    default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
 cc_library {
-    name: "libnetdbpf",
+    name: "libnetworkstats",
     vendor_available: false,
     host_supported: false,
     header_libs: ["bpf_connectivity_headers"],
@@ -34,30 +29,43 @@
     shared_libs: [
         "libbase",
         "liblog",
-        "libnetdutils",
     ],
     export_include_dirs: ["include"],
-    defaults: ["netd_defaults"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-Wthread-safety",
+    ],
     sanitize: {
         cfi: true,
     },
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.tethering",
+    ],
+    min_sdk_version: "30",
 }
 
 cc_test {
-    name: "libnetdbpf_test",
-    test_suites: ["device-tests"],
-    require_root: true,
+    name: "libnetworkstats_test",
+    test_suites: ["general-tests"],
+    require_root: true,  // required by setrlimitForTest()
     header_libs: ["bpf_connectivity_headers"],
     srcs: [
         "BpfNetworkStatsTest.cpp",
     ],
-    defaults: ["netd_defaults"],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-Wthread-safety",
+    ],
     static_libs: ["libgmock"],
     shared_libs: [
         "libbase",
         "liblog",
-        "libnetdbpf",
-        "libnetdutils",
+        "libnetworkstats",
         "libutils",
     ],
 }
diff --git a/service-t/native/libs/libnetdbpf/BpfNetworkStats.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
similarity index 100%
rename from service-t/native/libs/libnetdbpf/BpfNetworkStats.cpp
rename to service-t/native/libs/libnetworkstats/BpfNetworkStats.cpp
diff --git a/service-t/native/libs/libnetdbpf/BpfNetworkStatsTest.cpp b/service-t/native/libs/libnetworkstats/BpfNetworkStatsTest.cpp
similarity index 99%
rename from service-t/native/libs/libnetdbpf/BpfNetworkStatsTest.cpp
rename to service-t/native/libs/libnetworkstats/BpfNetworkStatsTest.cpp
index fb8f0ec..03e6016 100644
--- a/service-t/native/libs/libnetdbpf/BpfNetworkStatsTest.cpp
+++ b/service-t/native/libs/libnetworkstats/BpfNetworkStatsTest.cpp
@@ -33,7 +33,6 @@
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
 
-#include <netdutils/MockSyscalls.h>
 #include "bpf/BpfMap.h"
 #include "bpf/BpfUtils.h"
 #include "netdbpf/BpfNetworkStats.h"
diff --git a/service-t/native/libs/libnetdbpf/include/netdbpf/BpfNetworkStats.h b/service-t/native/libs/libnetworkstats/include/netdbpf/BpfNetworkStats.h
similarity index 100%
rename from service-t/native/libs/libnetdbpf/include/netdbpf/BpfNetworkStats.h
rename to service-t/native/libs/libnetworkstats/include/netdbpf/BpfNetworkStats.h