MCPcopy Create free account
hub / github.com/Recordscript/recordscript / init_ndk_context

Function init_ndk_context

libs/scrap/src/android/ffi.rs:303–325  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

301}
302
303fn init_ndk_context() -> JniResult<()> {
304 let mut lock = NDK_CONTEXT_INITED.lock().unwrap();
305 if *lock {
306 unsafe {
307 ndk_context::release_android_context();
308 }
309 *lock = false;
310 }
311 if let (Some(jvm), Some(ctx)) = (
312 JVM.read().unwrap().as_ref(),
313 MAIN_SERVICE_CTX.read().unwrap().as_ref(),
314 ) {
315 unsafe {
316 ndk_context::initialize_android_context(
317 jvm.get_java_vm_pointer() as _,
318 ctx.as_obj().as_raw() as _,
319 );
320 }
321 *lock = true;
322 return Ok(());
323 }
324 Err(JniError::ThrowFailed(-1))
325}

Callers 1

Java_ffi_FFI_initFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected