INNER CODE UNIT · Rust
Err
jub0t/Concat · src/crates/concat-android/src/lib.rs:142
if let Err(error) = pick(&app) {
log::error!("could not show the document picker: {error}");
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()) };