Repository navigation
Done
Description
Follow-up to #2484 (slice S1 of the native Android host series on https://github.com/NeuralNomadsAI/rune; builds on S0).
Gap on dev (3e46617e5)
crates/rune/src/app.rs:1244:App::try_runhas no Android branch; it falls through to the winit path, which requires anAndroidApp.crates/rune/src/platform.rs:12-13:platform::embed(LayerHost) is Apple-only, and its surface cannot be detached and reattached across Android surface lifecycle changes.crates/rune/src/render/device.rs:239-241: an adapter whose only shortfall ismax_uniform_buffer_binding_size(16 KB on Android GLES drivers) is asked forwgpu::Limits::default()and fails device creation.
Slice (29 files, +1239 −40 over S0)
platform/android/: JNI entry points, pure lifecycle state machine with host tests, stdout/stderr forwarded to logcat.LayerHostaccepts anANativeWindowand supports detaching/reattaching its surface.- Kotlin
RuneActivity/RuneView(SurfaceView+Choreographer) incrates/rune/android/andrune::android_main!. - Density, system bars and display cutout mapped to
Cx::safe_area; soft keyboard as a raised bottom inset (adjustNothing); dark mode; Back mapped toEscapewhen something has focus. examples/android-hello,scripts/android-run.sh,ANDROID.md, and anapkCI job.winitis not used at runtime on Android andvendor/winitis untouched.
Checked
- Host: 9 lifecycle tests (surface loss/recreation, 20 background trips, rotation, keyboard inset without resize).
- CI: both Android checks and the APK build green on the fork.
- Emulator (x86_64 API 35, GLES):
hellorenders; same process survives 20 Home/return trips; rotation redraws; dark mode updates arrive; Back returns to launcher. - Also verified merged onto current
dev(3e46617e5) inandroid/next(03f8c0ff1). - Not checked in S1: physical device, Vulkan (emulator ran GLES), rotation mid-animation (Vulkan + Xiaomi 14 120 Hz checked in later slices).
Reference branch
- Isolated slice diff (over S0): NeuralNomadsAI/rune@android/s0-build...android/s1-shell (
25c71db52) - Full Android stack merged on
dev(3e46617e5): dev...NeuralNomadsAI:rune:android/next (03f8c0ff1)
Questions
winit's Android backend still links (itsNativeActivityglue requires anandroid_mainsymbol, which Rune defines as a stub). Would you rathercfgwinitout of the Android build entirely (~200 files naming winit types)?- Is
crates/rune/android/the right home for the Kotlin sources, andly.anoma.runethe package name you want? Runtime::set_safe_areacurrently carries the keyboard height as part of the bottom inset. Do you want a separate keyboard inset onCxinstead?
Metadata
Metadata
Assignees
Labels
No labels
Activity
opencodejr commentedon Nov 27, 2026
verified all three gaps on
dev(crates/rune/src/app.rs,crates/rune/src/platform.rs/platform/embed.rs, andcrates/rune/src/render/device.rs). this also builds on s0 (#2647), and all three questions need a maintainer call before s1 lands:winiton android:winitis referenced in 235 files undercrates/rune/src(includingpub use winit::raw_window_handleinlib.rs,window/, andoverlay/). keepingwinitlinked with a stubandroid_mainkeeps s1 small and avoids touching 200+ files untilwinitis decoupled more broadly (shared with iOS: an app starts withrune::runand draws in aRuneView(first slice of M6) #803 and Compile for wasm32-wasip2: wasm32 is treated as "browser", and winit has no WASI platform #911), at the cost of pullingwinit/android-activityinto android builds.dev.rune.*(credentials/secret_service.rs,tray.rs), whereasly.anoma.runedoes not appear anywhere in the repo.Cx::safe_areavs a separate inset:Cx::safe_area(runtime/cx.rs) also feedsEl::on_edge_drag(runtime/input/edge_drag.rs), so adding keyboard height tosafe_area[2]expands bottom edge-drag bands by the keyboard height and mixes hardware bars/cutouts with transient ime overlap. on web (platform/web/platform.js,platform/web/input.rs,runtime/selection/caret.rs), rune already keepssafe_areaseparate from the keyboard (visual_viewport_yfor automatic caret reveal). a separate keyboard inset onCxmatches androidWindowInsets(systemBars/displayCutoutvsime), ios (safeAreaInsetsvskeyboardLayoutGuide), and css (env(safe-area-inset-*)vsVirtualKeyboard), whereas folding it intosafe_area[2]lifts views that only pad byCx::safe_area.questions for maintainers:
winitlinked with a stubandroid_main(deferring the ~235-filecfgsplit), and should kotlin host sources live incrates/rune/android/underdev.runeorly.anoma.rune?Cx::safe_areabehind a separateCxkeyboard inset (matching web'ssafe_area/visual_viewport_ysplit and keepingon_edge_dragunaffected), or fold intosafe_area[2]?pascalandr commentedon Nov 27, 2026
winit: the fork keeps it linked and cfgs nothing out butrune::run;rune::android_main!exports the entryRuneViewcalls. No stubandroid_mainwas needed.ly.anoma.runehas no reason behind it.dev.runeis fine; the rename is mechanical (Kotlin package, JNI symbol names, the manifest meta-data key) and the fork will follow whatever is chosen.safe_area[2]and passes the band the keyboard leaves in sight throughset_visual_viewport_y, the web's hook, for the caret reveal. The edge-drag point is right, and a separate keyboard inset onCxis the better shape:safe_areawould be bars and cutout only, and an app that wants its last field to clear the keyboard pads by the keyboard inset too. The fork will move to it once it exists.Hona commentedon Nov 28, 2026
Shipped Android S1 native host in PR #2689 (commit
2f15e4a90).Design decisions
Cx::keyboard_inset()/Runtime::set_keyboard_inset()): Soft-keyboard overlap stays separate fromCx::safe_area()(hardware bars and display cutouts) soEl::on_edge_dragbands are unaffected, while views can pad bycx.safe_area()[2].max(cx.keyboard_inset())and focused text fields auto-scroll above the keyboard without resizing the layout viewport (adjustNothing).dev.rune(RuneActivityandRuneView) undercrates/rune/android/src/main/java/dev/rune/, using framework Android APIs (no AndroidX dependency).winitat runtime, keep linked for now:App::try_runroutes toplatform::android::runon Android while leavingvendor/winituntouched;rune::android_main!exportsJNI_OnLoadand bindsRuneViewmethods withRegisterNatives.LayerHost+ Android GLES limits: Extendedrune::embed::LayerHostto AndroidANativeWindowwithdetach_surface/attach_native_window, enabledwgpu/glesalongside Vulkan on Android, and fell back towgpu::Limits::downlevel_defaults()for adapters limited to 16 KiB uniform buffer bindings.Verification
cargo check -p rune -p android-hello,cargo check --target wasm32-unknown-unknown -p rune, 8 host lifecycle tests (platform::android::machine_testscovering surface loss/recreation, 20 Home/return trips, rotation, keyboard inset without resize, dark mode, Back, Choreographer deduplication),required_device_limitstest,keyboard_insetedge-drag isolation and caret-reveal tests, andandroid-hellounit test.android(aarch64-linux-android,x86_64-linux-android, and full NDK link + Kotlin compile + debug APK packaging ofexamples/android-hello),check, andsizeall passed.