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/native_bridge_lazy.cc b/libnativebridge/native_bridge_lazy.cc
index 94c8084..edc7848 100644
--- a/libnativebridge/native_bridge_lazy.cc
+++ b/libnativebridge/native_bridge_lazy.cc
@@ -60,6 +60,11 @@
return f(app_data_dir, instruction_set);
}
+void PreZygoteForkNativeBridge() {
+ static auto f = GET_FUNC_PTR(PreZygoteForkNativeBridge);
+ return f();
+}
+
bool InitializeNativeBridge(JNIEnv* env, const char* instruction_set) {
static auto f = GET_FUNC_PTR(InitializeNativeBridge);
return f(env, instruction_set);