Switch previous and new code path in addNaughtyApp

addNaughtyApp was updated to use Java BpfMap class instead of native JNI
functions in aosp/2138295.
But it is better to verify this refactoring by the experiment.
So this commit update addNaughtyApp to switch previous code path(JNI)
and new code path(Java) based on the flag.

Also this commit removes @GuardedBy("sUidOwnerMap") from
native_addNaughtyApp.
This was needed to avoid JNI and Java code modify the UidOwnerMap
concurrently when some API uses previous code path (JNI) and other APIs
use new code path (Java BpfMap class).
But, after this topic, it will not be needed because all the APIs will use JNI
"or" all the APIs will use Java BpfMap class to update UidOwnerMap.

Bug: 217624062
Test: atest BpfNetMapsTest HostsideRestrictBackgroundNetworkTests
Change-Id: If18c26b805081182153d1dc67bb08f1966fa4990
diff --git a/service/src/com/android/server/BpfNetMaps.java b/service/src/com/android/server/BpfNetMaps.java
index 10509bf..2a0d67f 100644
--- a/service/src/com/android/server/BpfNetMaps.java
+++ b/service/src/com/android/server/BpfNetMaps.java
@@ -365,7 +365,13 @@
      */
     public void addNaughtyApp(final int uid) {
         throwIfPreT("addNaughtyApp is not available on pre-T devices");
-        addRule(uid, PENALTY_BOX_MATCH, "addNaughtyApp");
+
+        if (sEnableJavaBpfMap) {
+            addRule(uid, PENALTY_BOX_MATCH, "addNaughtyApp");
+        } else {
+            final int err = native_addNaughtyApp(uid);
+            maybeThrow(err, "Unable to add naughty app");
+        }
     }
 
     /**
@@ -658,7 +664,6 @@
     }
 
     private static native void native_init();
-    @GuardedBy("sUidOwnerMap")
     private native int native_addNaughtyApp(int uid);
     private native int native_removeNaughtyApp(int uid);
     @GuardedBy("sUidOwnerMap")