nativebridge: Add PreZygoteFork callback

It's required to clean-up the emulated enviroment (e.g. close file
descriptors) after emulated execution in doPreload() in app-zygote.

Test: NativeBridge6PreZygoteFork_test
Test: CtsSeccompHostTestCases
android.seccomp.cts.SeccompHostJUnit4DeviceTest
testAppZygoteSyscalls
both for Q.sdk_gphone_x86_arm.armeabi-v7a
Bug: 146904103

Change-Id: Id192a1647c2f405570bf196daf65b3f2a9faca42
diff --git a/libnativebridge/tests/Android.bp b/libnativebridge/tests/Android.bp
index 9211634..4ccf35e 100644
--- a/libnativebridge/tests/Android.bp
+++ b/libnativebridge/tests/Android.bp
@@ -54,6 +54,22 @@
     defaults: ["libnativebridge-dummy-defaults"],
 }
 
+cc_library_shared {
+    name: "libnativebridge6-dummy",
+    srcs: ["DummyNativeBridge6.cpp"],
+    defaults: ["libnativebridge-dummy-defaults"],
+    shared_libs: [
+        "libnativebridge6prezygotefork",
+    ],
+}
+
+// A helper library to produce dummy side effect of PreZygoteForkNativeBridge.
+cc_library_shared {
+    name: "libnativebridge6prezygotefork",
+    srcs: ["NativeBridge6PreZygoteFork_lib.cpp"],
+    defaults: ["libnativebridge-dummy-defaults"],
+}
+
 // Build the unit tests.
 cc_defaults {
     name: "libnativebridge-tests-defaults",
@@ -96,11 +112,13 @@
         "NativeBridge3InitAnonymousNamespace_test.cpp",
         "NativeBridge3CreateNamespace_test.cpp",
         "NativeBridge3LoadLibraryExt_test.cpp",
+        "NativeBridge6PreZygoteFork_test.cpp",
     ],
 
     shared_libs: [
         "liblog",
         "libnativebridge-dummy",
+        "libnativebridge6prezygotefork",
     ],
     header_libs: ["libbase_headers"],
 }