Merge changes from topic "dscp_policies"

* changes:
  Don't enable DscpPolicyTracker on pre-T devices.
  Allow service JNI in FrameworksNetIntegrationTests.
  Don't manually load the JNI library in DscpPolicyTracker.
  Process DSCP QoS events for policies
  Allow using BpfMap and TcUtils in unit tests.
diff --git a/Tethering/apex/Android.bp b/Tethering/apex/Android.bp
index 6f0689c..53a14ad 100644
--- a/Tethering/apex/Android.bp
+++ b/Tethering/apex/Android.bp
@@ -31,6 +31,7 @@
     // package names and keys, so that apex will be unused anyway.
     apps: ["TetheringNext"], // Replace to "Tethering" if ConnectivityNextEnableDefaults is false.
 }
+enable_tethering_next_apex = true
 // This is a placeholder comment to avoid merge conflicts
 // as the above target may have different "enabled" values
 // depending on the branch
@@ -142,6 +143,7 @@
     name: "com.android.tethering.inprocess",
     base: "com.android.tethering",
     package_name: "com.android.tethering.inprocess",
+    enabled: enable_tethering_next_apex,
     apps: [
         "ServiceConnectivityResources",
         "InProcessTethering",
diff --git a/service/Android.bp b/service/Android.bp
index 306bd42..33d4b66 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -111,7 +111,7 @@
         "networkstack-client",
         "PlatformProperties",
         "service-connectivity-protos",
-        "NetworkStackApiStableShims",
+        "NetworkStackApiCurrentShims",
     ],
     apex_available: [
         "com.android.tethering",
diff --git a/service/native/Android.bp b/service/native/Android.bp
index 5816318..b49457d 100644
--- a/service/native/Android.bp
+++ b/service/native/Android.bp
@@ -14,6 +14,10 @@
  * limitations under the License.
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_library {
     name: "libtraffic_controller",
     defaults: ["netd_defaults"],
diff --git a/service/src/com/android/server/BpfNetMaps.java b/service/src/com/android/server/BpfNetMaps.java
index a6909c0..9d89788 100644
--- a/service/src/com/android/server/BpfNetMaps.java
+++ b/service/src/com/android/server/BpfNetMaps.java
@@ -43,8 +43,8 @@
     public void addNaughtyApp(final int uid) {
         final int err = native_addNaughtyApp(uid);
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to add naughty app: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to add naughty app: "
+                            + Os.strerror(err));
         }
     }
 
@@ -58,8 +58,8 @@
     public void removeNaughtyApp(final int uid) {
         final int err = native_removeNaughtyApp(uid);
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to remove naughty app: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to remove naughty app: "
+                            + Os.strerror(err));
         }
     }
 
@@ -73,8 +73,8 @@
     public void addNiceApp(final int uid) {
         final int err = native_addNiceApp(uid);
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to add nice app: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to add nice app: "
+                            + Os.strerror(err));
         }
     }
 
@@ -88,8 +88,8 @@
     public void removeNiceApp(final int uid) {
         final int err = native_removeNiceApp(uid);
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to remove nice app: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to remove nice app: "
+                            + Os.strerror(err));
         }
     }
 
@@ -168,8 +168,8 @@
     public void addUidInterfaceRules(final String ifName, final int[] uids) {
         final int err = native_addUidInterfaceRules(ifName, uids);
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to add uid interface rules: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to add uid interface rules: "
+                            + Os.strerror(err));
         }
     }
 
@@ -186,8 +186,8 @@
     public void removeUidInterfaceRules(final int[] uids) {
         final int err = native_removeUidInterfaceRules(uids);
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to remove uid interface rules: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to remove uid interface rules: "
+                            + Os.strerror(err));
         }
     }
 
@@ -199,8 +199,8 @@
     public void swapActiveStatsMap() {
         final int err = native_swapActiveStatsMap();
         if (err != 0) {
-            throw new ServiceSpecificException(-err, "Unable to swap active stats map: "
-                            + Os.strerror(-err));
+            throw new ServiceSpecificException(err, "Unable to swap active stats map: "
+                            + Os.strerror(err));
         }
     }