Skip to content

deps(ui-android): jni 0.22 with the code migration (from #9454) - #9476

Merged
proggeramlug merged 2 commits into
mainfrom
fix/9454-jni-022-migration
Sep 2, 2026
Merged

deps(ui-android): jni 0.22 with the code migration (from #9454)#9476
proggeramlug merged 2 commits into
mainfrom
fix/9454-jni-022-migration

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Lands dependabot's #9454 with the migration it was missing. The bump commit is dependabot's; the migration was done by a codex agent I ran with a working Android cross-check as its loop, and I verified the result independently.

Why the bump alone couldn't merge: jni 0.22 is a breaking release. Measured, not inferred — main passes the aarch64-linux-android cross-check in ~25s; the bump as filed fails with 1,601 errors (JValueGen removed, GlobalRef now generic). And the break would have been silent: the crate is #![cfg(target_os = "android")] (host checks pass vacuously) and build-cross is fail-fast: false, so it would present as a missing Android UI bundle, not a red job.

The migration, per the agent's report and my audit: JValueGen/GlobalRef reshapes, JObject::from_raw(env, raw), JNI_OnLoad over FFI-safe raw types, and compatibility push/pop_local_frame helpers over JNI v1.2's raw frame functions. Exported C/JNI ABI unchanged; no crate outside perry-ui-android touched.

What I verified myself, not from the report:

  • Frame discipline one-for-one: main has 233 pop_local_frame / 202 push_local_frame lines in the crate; the migrated tree has 234/204 — exactly the two new helper definitions. An over-released JNI local is a device-only use-after-free, so this was the audit's focus.
  • Android cross-check exit 0, zero errors, zero perry-ui-android warnings — re-run by me with the NDK recipe recorded on deps(deps): Bump jni from 0.21.1 to 0.22.4 #9454.
  • No baseline/allowlist/ratchet file in the diff; no other crate touched; fmt and file-size green.

Stated limit: runtime behaviour under ART is not verifiable off-device. The migration is compile-verified and structure-preserving; the first on-device exercise will be the real test, which is also true of every change to this crate.

Summary by CodeRabbit

  • Refactor
    • Updated Android integration to the latest JNI interface.
    • Improved management of Android runtime connections and temporary references.
    • Standardized handling of Java strings, method calls, signatures, and boolean values across Android features and widgets.
    • Preserved existing UI, media, networking, callback, and system behavior while improving compatibility with the updated Android bridge.

dependabot Bot and others added 2 commits September 2, 2026 02:54
Bumps [jni](https://github.com/jni-rs/jni-rs) from 0.21.1 to 0.22.4.
- [Release notes](https://github.com/jni-rs/jni-rs/releases)
- [Changelog](https://github.com/jni-rs/jni-rs/blob/master/CHANGELOG.md)
- [Commits](jni-rs/jni-rs@v0.21.1...v0.22.4)

---
updated-dependencies:
- dependency-name: jni
  dependency-version: 0.22.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Behaviour-preserving migration accompanying the dependabot bump: JValueGen
and generic GlobalRef reshapes, JObject::from_raw taking env, JNI_OnLoad on
FFI-safe raw types, and compatibility push/pop_local_frame helpers over JNI
v1.2's raw frame functions so every existing frame push capacity, pop
location and branch path stays one-for-one. Thread attachment remains
permanent with the former pending-exception policy.

Runtime behaviour under ART is not verifiable off-device; the migration is
compile-verified against aarch64-linux-android with -D warnings clean.
@proggeramlug
proggeramlug merged commit 0a1c137 into main Sep 2, 2026
19 of 20 checks passed
@proggeramlug
proggeramlug deleted the fix/9454-jni-022-migration branch September 2, 2026 04:35
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 1121929d-1297-4ed8-b5eb-3aba916dd904

📥 Commits

Reviewing files that changed from the base of the PR and between 605a26f and eef62ab.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (69)
  • crates/perry-ui-android/Cargo.toml
  • crates/perry-ui-android/src/app.rs
  • crates/perry-ui-android/src/audio.rs
  • crates/perry-ui-android/src/background.rs
  • crates/perry-ui-android/src/callback.rs
  • crates/perry-ui-android/src/camera.rs
  • crates/perry-ui-android/src/clipboard.rs
  • crates/perry-ui-android/src/deeplinks.rs
  • crates/perry-ui-android/src/dialog.rs
  • crates/perry-ui-android/src/drag_drop.rs
  • crates/perry-ui-android/src/fetch.rs
  • crates/perry-ui-android/src/ffi/embed_misc.rs
  • crates/perry-ui-android/src/ffi/system_api.rs
  • crates/perry-ui-android/src/ffi/tabbar_layout.rs
  • crates/perry-ui-android/src/file_dialog.rs
  • crates/perry-ui-android/src/geolocation.rs
  • crates/perry-ui-android/src/image_picker.rs
  • crates/perry-ui-android/src/jni_bridge.rs
  • crates/perry-ui-android/src/keyboard.rs
  • crates/perry-ui-android/src/lib.rs
  • crates/perry-ui-android/src/location.rs
  • crates/perry-ui-android/src/media_playback.rs
  • crates/perry-ui-android/src/menu.rs
  • crates/perry-ui-android/src/network.rs
  • crates/perry-ui-android/src/pointer.rs
  • crates/perry-ui-android/src/screenshot.rs
  • crates/perry-ui-android/src/sheet.rs
  • crates/perry-ui-android/src/system.rs
  • crates/perry-ui-android/src/toolbar.rs
  • crates/perry-ui-android/src/widgets/adbanner.rs
  • crates/perry-ui-android/src/widgets/attributed_text.rs
  • crates/perry-ui-android/src/widgets/bloomview.rs
  • crates/perry-ui-android/src/widgets/bottom_nav.rs
  • crates/perry-ui-android/src/widgets/button.rs
  • crates/perry-ui-android/src/widgets/calendar.rs
  • crates/perry-ui-android/src/widgets/canvas.rs
  • crates/perry-ui-android/src/widgets/chart.rs
  • crates/perry-ui-android/src/widgets/combobox.rs
  • crates/perry-ui-android/src/widgets/date_picker.rs
  • crates/perry-ui-android/src/widgets/divider.rs
  • crates/perry-ui-android/src/widgets/form.rs
  • crates/perry-ui-android/src/widgets/hstack.rs
  • crates/perry-ui-android/src/widgets/image.rs
  • crates/perry-ui-android/src/widgets/image_gallery.rs
  • crates/perry-ui-android/src/widgets/lazyvstack.rs
  • crates/perry-ui-android/src/widgets/map_view.rs
  • crates/perry-ui-android/src/widgets/mod.rs
  • crates/perry-ui-android/src/widgets/navstack.rs
  • crates/perry-ui-android/src/widgets/picker.rs
  • crates/perry-ui-android/src/widgets/progressview.rs
  • crates/perry-ui-android/src/widgets/qrcode.rs
  • crates/perry-ui-android/src/widgets/rich_text.rs
  • crates/perry-ui-android/src/widgets/rich_tooltip.rs
  • crates/perry-ui-android/src/widgets/scrollview.rs
  • crates/perry-ui-android/src/widgets/securefield.rs
  • crates/perry-ui-android/src/widgets/slider.rs
  • crates/perry-ui-android/src/widgets/spacer.rs
  • crates/perry-ui-android/src/widgets/tabbar.rs
  • crates/perry-ui-android/src/widgets/text.rs
  • crates/perry-ui-android/src/widgets/textarea.rs
  • crates/perry-ui-android/src/widgets/textfield.rs
  • crates/perry-ui-android/src/widgets/toast.rs
  • crates/perry-ui-android/src/widgets/toggle.rs
  • crates/perry-ui-android/src/widgets/tree_view.rs
  • crates/perry-ui-android/src/widgets/vstack.rs
  • crates/perry-ui-android/src/widgets/webview.rs
  • crates/perry-ui-android/src/widgets/wheel_picker.rs
  • crates/perry-ui-android/src/widgets/zstack.rs
  • crates/perry-ui-android/src/window.rs

📝 Walkthrough

Walkthrough

The Android UI crate was migrated from jni 0.21 to 0.22. JNI calls now use scoped environments, typed strings and signatures, updated reference handling, and EnvUnowned for exported callbacks. Existing UI, media, audio, and platform behavior remains unchanged.

Changes

Android JNI migration

Layer / File(s) Summary
JNI bridge and ABI foundation
crates/perry-ui-android/Cargo.toml, crates/perry-ui-android/src/jni_bridge.rs, crates/perry-ui-android/src/lib.rs
The crate now uses jni 0.22 types, scoped environment helpers, raw local-frame bindings, updated global references, and revised JNI entry-point representations.
Platform bridge calls and callbacks
crates/perry-ui-android/src/{app,audio,background,callback,camera,clipboard,deeplinks,dialog,drag_drop,fetch,geolocation,menu,network,pointer,sheet,system,toolbar}.rs, crates/perry-ui-android/src/ffi/*
Platform calls use with_env or with_unowned_env, typed JNI macros, updated string and array conversions, and bridge-managed local frames.
Audio, media, and screenshot flows
crates/perry-ui-android/src/{audio,media_playback,screenshot}.rs
Audio capture, media playback, and screenshot capture use the new environment and JNI object APIs.
Widget infrastructure and implementations
crates/perry-ui-android/src/widgets/*, crates/perry-ui-android/src/window.rs
Shared widget operations and widget implementations use scoped JNI access, typed method signatures, updated references, and explicit boolean values.

Estimated code review effort: 4 (Complex) | ~60 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/9454-jni-022-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant