INNER CODE UNIT · Rust
Some
jub0t/Concat · src/crates/concat-android/src/lib.rs:144
if let Some(pending) = PENDING.lock().ok().and_then(|mut slot| slot.take()) {
pending(Vec::new());
}
}
}));
}
fn pick(app: &AndroidApp) -> jni::errors::Result<()> {
// SAFETY: the pointer is the activity's JavaVM, live for the
// process; `from_raw` also seeds `JavaVM::singleton`, which the
// native callback below reaches for.
let vm = unsafe { JavaVM::from_raw(app.vm_as_ptr().cast()) };
vm.attach_current_thread(|env| {
// SAFETY: the activity pointer is a live reference the app
// holds for as long as it runs; it is only read here.
let activity = unsafe { JObject::from_raw(env, app.activity_as_ptr().cast()) };
let class = match CLASS.get() {
Some(class) => class,