INNER CODE UNIT · Rust

pick

jub0t/Concat · src/crates/concat-android/src/lib.rs:151

    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,
                None => {
                    let loaded = load_class(env, &activity)?;
                    let _ = CLASS.set(loaded);
                    CLASS.get().expect("set just above")
                }
            };
            env.call_static_method(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…