diff options
Diffstat (limited to 'libnativebridge/native_bridge.cc')
-rw-r--r-- | libnativebridge/native_bridge.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc index 1a54ace2e0..b24d14ade2 100644 --- a/libnativebridge/native_bridge.cc +++ b/libnativebridge/native_bridge.cc @@ -103,6 +103,8 @@ enum NativeBridgeImplementationVersion { VENDOR_NAMESPACE_VERSION = 4, // The version with runtime namespaces RUNTIME_NAMESPACE_VERSION = 5, + // The version with pre-zygote-fork hook to support app-zygotes. + PRE_ZYGOTE_FORK_VERSION = 6, }; // Whether we had an error at some point. @@ -328,6 +330,17 @@ bool PreInitializeNativeBridge(const char* app_data_dir_in, const char* instruct return true; } +void PreZygoteForkNativeBridge() { + if (NativeBridgeInitialized()) { + if (isCompatibleWith(PRE_ZYGOTE_FORK_VERSION)) { + return callbacks->preZygoteFork(); + } else { + ALOGE("not compatible with version %d, preZygoteFork() isn't invoked", + PRE_ZYGOTE_FORK_VERSION); + } + } +} + static void SetCpuAbi(JNIEnv* env, jclass build_class, const char* field, const char* value) { if (value != nullptr) { jfieldID field_id = env->GetStaticFieldID(build_class, field, "Ljava/lang/String;"); |