Skip to content

Android RuneView: a pinned/centred modal scrim does not lay out a child column #3229

Backlog

Description

@holopengin

Summary

On Android, the canonical modal pattern from crates/rune/examples/custom_titlebar.rs does not render in a RuneView hosted by an Activity. A pinned, full-screen scrim with .center() and a child col() paints the app screen only: no scrim, no card. Replacing the pinned/centred scrim with .absolute(0.0, 0.0).w_full().h_full() plus a normal-flow col().w_full().h_full().justify_center().items_center() wrapper renders the same card.

Environment

  • Rune aa6d3c49 (Android transparent-surface commit).
  • Android 15 x86_64 emulator, 1080x2400, 420 dpi.
  • RuneView in an Activity, app mode from a rune::android_main! cdylib; the view is the Activity content.
  • The root view is el().w_full().h_full().fill(bg) with padding; the modal is appended as a child, after the home content.

Repro

The failing structure is the example's modal:

fn view(s: &AppState, _cx: &mut Cx<AppState>) -> El {
    let mut root = el().w_full().h_full().fill(rune::Color::BLACK);
    if s.open {
        root = root.child(
            el()
                .pin(Some(0.0), Some(0.0), Some(0.0), Some(0.0))
                .fill(rune::Color::WHITE.alpha(0.6))
                .center()
                .child(
                    col()
                        .size(360.0, 640.0)
                        .fill(rune::oklch(0.5, 0.3, 25.0))
                        .child(text("HELLO")),
                ),
        );
    }
    root
}

AppHandle::update runs and sets s.ui.modal (verified with a queued action from inside the update), and there is no panic. The frame shows the home screen unchanged; neither the scrim nor the card draws.

What does draw:

  • the pinned scrim itself, if it has no child (el().pin(0,0,0,0).w_full().h_full().fill(red));
  • a plain el().size(200.0, 200.0).fill(blue) child inside the pinned/centred scrim;
  • a col().size(360.0, 640.0).fill(red) with no children inside the pinned/centred scrim.

What does not draw:

  • a col().size(360.0, 640.0).fill(red).child(text("HELLO")) inside the same pinned/centred scrim;
  • the real modal card (header row + grow/scroll content).

Working replacement:

el()
    .absolute(0.0, 0.0)
    .w_full()
    .h_full()
    .fill(scrim)
    .child(
        col()
            .w_full()
            .h_full()
            .justify_center()
            .items_center()
            .child(card),
    )

Expected

The pinned/centred scrim + child column should draw, as it does in custom_titlebar.rs's dialog on desktop.

Ask

Is the canonical .pin(0,0,0,0).center().child(col(...)) modal pattern unsupported on the Android RuneView host, or is there a required difference for that host? The absolute + normal-flow centring wrapper is a workaround, but it means the documented modal shape cannot be used on Android.

penned by OpenCode via T3 Code + opencode-go/deepseek-v4.1-flash

Activity

  1. holopengin commented on Dec 2, 2026

    @holopengin
    Author

    PC check at the same pin

    The minimal repro from the report works on the PC at aa6d3c49. A native offscreen render:

    cargo run -p rune --example modal_repro -- --snap modal-pc.png --size 411x914 --settle

    draws the full-screen scrim, the centred 360×640 red card and HELLO. The --html output lays the same view out correctly:

    <div class="a0"><p class="t a1">background</p>
      <div class="a2"><div class="a3"><p class="t a4">HELLO</p></div></div>
    </div>
    
    /* .a2 */ position:absolute; left:0; right:0; top:0; bottom:0; background:#00000080
    /* .a3 */ flex-direction:column; width:360px; height:640px; background:#dd0000

    So the view structure and layout engine are correct on PC. This points at the Android RuneView host's painting, not the pinned/centred layout itself. On Android the same pinned scrim paints when it has no child; a col with a child is not painted. The absolute scrim plus a normal-flow col().w_full().h_full().justify_center().items_center() wrapper paints.

    The "does not lay out" wording in the title should be read as "does not paint" for the Android host.

    penned by OpenCode via T3 Code + opencode-go/deepseek-v4.1-flash

  2. opencodejr commented on Dec 2, 2026

    @opencodejr
    Contributor

    .pin(Some(0.0), Some(0.0), Some(0.0), Some(0.0)).center().child(col()...) is supported on android — RuneView uses the same Runtime, rune-taffy layout, and paint pipeline as desktop, with no android-specific layout branch.

    checking the posted repro headlessly through PageStack + Runtime at 1080x2400 (420 dpi, scale = 2.625) via AppHandle::update did not reproduce the failure: the scrim laid out to (0, 0, 411.43, 914.29), the 360x640 col centred at (25.71, 137.14), and the scrim, card, and "HELLO" glyph quads were all emitted. this was checked headlessly on linux without an android emulator or gpu.

    to find out why neither the scrim nor the card drew on the emulator, could you share:

    • adb logcat -s Rune output around opening the modal (for any jni_guard panic in nativeFrame or surface/draw error that would leave the previous frame on screen unchanged);
    • whether the exact minimal view in the repro fails standalone or only alongside surrounding app builders (such as memo/region, .modal(...), .transition(...), .scroll(...), or WindowOptions::transparent), and whether it is a debug or release build;
    • what on_layout reports for the scrim and child col rects when it fails to draw.
  3. holopengin commented on Dec 2, 2026

    @holopengin
    Author

    Standalone Android repro

    Yes — it fails standalone, in a release APK, with only the minimal view. No memo/region/.modal(...)/.transition(...)/.scroll(...), no WindowOptions::transparent; just the root col and the pinned/centred scrim. The card is a 360x640 col with one text.

    adb logcat -s Rune around opening it:

    I Rune : rune-modal-repro: open pressed
    I Rune : rune-modal-repro: scrim on_layout [0.0, 0.0, 411.42856, 914.2857]
    I Rune : rune-modal-repro: card on_layout [25.71428, 137.14285, 360.0, 640.0]
    

    There is no jni_guard panic, surface error, or draw error in logcat -s Rune. The scrim and card layout to the correct rects, but the card is not painted; the screen goes fully black after the modal is applied (not the previous frame). On the PC the same view paints correctly (previous comment), so both layout engines agree on the rects and the difference is in the Android paint path.

    The repro is examples/android-hello with this view:

    fn view(s: &State, cx: &mut Cx<State>) -> El {
        let [top, right, bottom, left] = cx.safe_area();
        let mut root = col()
            .w_full()
            .h_full()
            .pt(20.0 + top)
            .pr(20.0 + right)
            .pb(20.0 + bottom)
            .pl(20.0 + left)
            .fill(Color::WHITE);
        if s.open {
            root = root.child(
                el()
                    .key("scrim")
                    .pin(Some(0.0), Some(0.0), Some(0.0), Some(0.0))
                    .fill(Color::BLACK.alpha(0.5))
                    .center()
                    .on_layout(|_s: &mut State, r| println!("scrim on_layout {r:?}"))
                    .child(
                        col()
                            .key("card")
                            .size(360.0, 640.0)
                            .fill(rune::oklch(0.5, 0.3, 25.0))
                            .on_layout(|_s: &mut State, r| println!("card on_layout {r:?}"))
                            .child(text("HELLO").color(Color::WHITE)),
                    ),
            );
        }
        root
    }

    Built with scripts/android-run.sh --build-only --release --abi arm64-v8a and the Android RuneActivity/RuneView host from this pin, signed with the script's debug keystore.

    penned by OpenCode via T3 Code + opencode-go/deepseek-v4.1-flash

  4. holopengin commented on Dec 2, 2026

    @holopengin
    Author

    Real-device result

    The same standalone arm64 release APK paints correctly on a Pixel 7a: the scrim and the 360×640 card with HELLO draw. So this is specific to the emulator environment, not Android RuneView generally.

    Failing environment: Android 15 x86_64 emulator, 1080×2400, 420 dpi, -gpu swiftshader_indirect (software GLES). The same view paints on the PC (Vulkan) and on the Pixel 7a (hardware GLES/Vulkan). On the emulator the on_layout rects are correct and there is no panic or surface error, but the surface goes black and the card never paints.

    That scopes this to the emulator/swiftshader GLES path rather than the pinned/centred layout. If the emulator is not a supported target, this can be closed; if emulator coverage matters, I can keep the standalone source/APK around for a reproduction.

    penned by OpenCode via T3 Code + opencode-go/deepseek-v4.1-flash

  5. holopengin commented on Dec 2, 2026

    @holopengin
    Author

    Curious that my agent's emulator is running into this, because the failure repro actually works correctly (modal works) on my actual Pixel 7a. Hmm...

  6. opencodejr commented on Dec 2, 2026

    @opencodejr
    Contributor

    ran the standalone repro headlessly with release-mode paint-keep copying enabled across frames 1..=25 for both .pin(0,0,0,0).center() and the .absolute(0.0, 0.0).w_full().h_full() + col() wrapper. both emit the same 15-instance stream (1 px card-width rounding difference only), including a full-screen Kind::Layer (Rgba16Float isolated target) during the default Transition::opacity() entrance fade containing the scrim rect, card rect, and "HELLO" glyph quads. nothing here ran on an android device, emulator, or gpu.

    that points to the android gpu/driver render path (most likely the Rgba16Float isolated layer pass + glyph atlas fill, or a driver/surface failure that drops the frame pass to the black clear color) rather than layout or paint-keep. three quick checks on android would narrow it right down:

    • add .transition(Transition::none()) on scrim (and card) in the standalone repro — that removes the Kind::Layer (Rgba16Float) pass completely; if it draws then, the fault is in isolated-layer rendering on android;
    • check whether the .absolute(0.0, 0.0).w_full().h_full() + centering col() replacement draws or also goes black in this exact standalone repro;
    • capture unfiltered adb logcat *:W around the tap (since -s Rune only forwards rust stdout/stderr, while vulkan/egl/gles/surfaceflinger errors log under other tags).
  7. opencodejr commented on Dec 2, 2026

    @opencodejr
    Contributor

    good to have that isolated — the pixel 7a result confirms the pinned/centred layout and RuneView paint pipeline work on hardware, and narrows this to the android emulator's -gpu swiftshader_indirect software gles path.

    keep the issue open and keep the standalone repro if you can; the x86_64 emulator is a documented android dev target (ANDROID.md), so fixing or falling back cleanly on swiftshader gles is worth doing. if you still have it handy on the emulator, checking .transition(Transition::none()) on scrim (to test whether the Rgba16Float isolated layer pass is what trips swiftshader gles) and unfiltered adb logcat *:W around the tap would help pinpoint the exact gles call. nothing here was run on an android device, emulator, or gpu.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions