Skip to content

Floating call: smoother card, no caption freeze or crash - #37

Merged
Tarquinen merged 9 commits into
devfrom
fix/floating-call-ux
Nov 11, 2026
Merged

Tarquinen merged 9 commits into
devfrom
fix/floating-call-ux

Conversation

@Tarquinen

Copy link
Copy Markdown
Member

What was wrong

A hands-on audit of the in-app floating call card on the emulator found these problems:

  • Freeze (ANR). The caption reveal loop read a value that was remembered at composition time. That value went stale, so the loop spun without suspending, and the card froze until Android raised "app isn't responding". The same stack shows up in the live build's dropbox.
  • Crash. A caption word wider than the line, such as a URL or a long path, was measured twice. That threw measure() may not be called multiple times.
  • System back. Back didn't close the card or sheet. It opened the drawer, or it left the app. Leaving the app with back finished the window, but the call's foreground service kept running with no card to come back to.
  • Drag. Every drag frame recomposed the whole surface. It also rebuilt the shape, re-placed and resized every child, and re-laid out the transcript at a new width, so the captions re-wrapped while you dragged.
  • Captions. Each new line made the block jump up a line at once. A revised line (a corrected dictation) blanked its words and revealed them again.
  • Smaller issues:
    • In landscape, the controls overlapped the orb.
    • At font scale 2.0, the header was clipped and the text overlapped.
    • End's press highlight was a grey square drawn outside the red circle.
    • The mute badge was clipped at the orb's edge.
    • The card drew two shadows.
    • The corner radii were iOS's device corners (36/38 dp).
    • TalkBack offered Expand on the full sheet, and read the duration as a clock time.

What changed (one commit each)

  1. Caption reveal loop: it reads the reveal state directly, so it can't spin. This is the same change as PR 31, so the merge is clean.
  2. Word flow: each word is measured once, and an over-wide word wraps inside its own row, as on iOS.
  3. System back: a PredictiveBackHandler steps the sheet down to the card, then the card down to the orb. The predictive gesture pulls the shape along as you swipe.
  4. Back with a live call: back moves the task to the background instead of finishing the window. The call, its orb and its card stay, and coming back finds them.
  5. Drag work moved to the draw phase.
    • Frame, shape outline, alpha, shadows, backing, bloom and content placement are read in layout {}, graphicsLayer {} and draw lambdas.
    • Composition only sees discrete flags, through derivedStateOf.
    • The transcript keeps the card's line width in every stage, so it never re-wraps while you drag.
  6. Captions.
    • The column glides up (0.3 s, in the draw phase) when it grows a line, instead of jumping. It doesn't glide under Reduce Motion.
    • A revised line keeps the words it has already shown, so they swap in place and don't blink.
  7. Fit for landscape and large text. The bloom shrinks and rises when the chrome below it doesn't fit. The header grows with the text, and each line sits below the one above it.
  8. Mute badge and press feedback. The badge sits in an unclipped layer, so it shows whole. The controls' ripples are clipped to their plates, so End no longer shows a grey square.
  9. Corners, shadow and TalkBack.
    • The radii are OpenCodeRadius.sheet, and the card has one shadow.
    • Expand is offered only below the sheet.
    • The duration is read as "1 minute, 5 seconds".

Parity rows in docs/parity/voice.md and docs/parity/app.md are updated in the same commits.

Before and after

These numbers come from the same emulator (FX_1, API 36, software rendering) with the same scripted gestures, 3 runs each, measured with gfxinfo framestats. The emulator renders the AGSL orb in software, so about 98% of frames count as janky both before and after. The total frame time p50 stays at about 145 ms. Read the numbers as relative changes on the UI thread, not as phone numbers.

UI-thread time per frame in ms (p50 / p90 / p99):

Gesture Before After p90 change
Slow drag up 21.0 / 60.5 / 70.3 18.8 / 47.1 / 58.0 −22%
Slow drag down 17.0 / 52.9 / 68.8 16.6 / 37.9 / 60.2 −28%
Fling up 15.6 / 51.4 / 69.9 15.8 / 33.7 / 62.6 −34%
Fling down 14.5 / 29.2 / 62.4 14.9 / 25.7 / 61.7 −12%

Passes per drag frame, from temporary counters (removed before committing):

Before After
FloatingCallSurface recompositions 0.22–0.44 0.05–0.08
Transcript and word-flow layouts 0.2–1.0 0

Testing

  • scripts/check.sh :feature:voice :feature:session :app passes.
  • New tests:
    • captionsAfterAPauseAreRevealedWithoutHanging: hangs on the old loop, passes in 0.3 s.
    • aWordWiderThanTheLineWrapsInItsOwnRow: threw on the old code.
    • aRevisedLineSwapsItsShownWordsInPlace
    • The ported radii test now checks the design-system radius.
  • On the emulator, with the debug voice lab demo call (setprop debug.opencode.voice_demo 1, voice_continuous 1, then the session lab):
    • back at the sheet, the card and the orb
    • leaving and coming back
    • slow drags, flings, a cancelled drag, and grabbing the card mid-flight
    • captions streaming while dragging
    • landscape, and font scale 1.3 and 2.0
    • dark and light mode
    • mute, the badge, and End's press
    • ending from the card and during a drag
    • a TalkBack node dump

Left alone on purpose

  • Tap outside the card. iOS dims and steps back only on the full sheet, and Android already matches that.
  • Pause, Camera and Add. They stay as disabled placeholders, as on iOS.
  • Haptics. They already match iOS (tap, threshold, snap; minimize and step back stay quiet).
  • The orb renderer. It costs about 14 ms of CPU per animation frame (WispOrbRenderer), which sets the floor in the table above. It's out of scope here.
  • A window destroyed by the system with a call live. Back no longer finishes the window. Swiping the app away already stops the service through onTaskRemoved.
  • Font scale 2.0. The header title touches the top of the bloom slightly. iOS has no cap on large text sizes either.
  • PR 31. The floating call files merge cleanly with feat/assistant. Only an import line in MainActivity.kt and the docs/parity/voice.md rows will need resolving by hand.

The transcript's reveal loop read `latestReveal`, a rememberUpdatedState
copy that only refreshes on recomposition. When words arrived after a
pause, every word was due at once, so the loop revealed without ever
suspending; the copy never changed, `nextRevealDelay` never returned null,
and the main thread spun until Android raised an ANR. The live build's
ANR reports show the same loop.

The loop now reads `reveal` itself. Same edit as feat/assistant (PR 31)
makes, so the two merge cleanly.

Verified: FloatingCallTranscriptTests.captionsAfterAPauseAreRevealedWithoutHanging
passes in 0.3 s, and hangs (killed after 240 s) with the old loop restored.
The caption word flow measured a word with no width limit, then measured
it again capped at the line when it was too wide. Compose forbids measuring
the same child twice, so a word wider than the line (a long path or link
read out by the agent) threw "measure() may not be called multiple times"
and crashed the app when the card opened.

Each word is now measured once with the line width as its limit, so a word
that fits is unchanged and an overlong one wraps within its own row.

Verified: FloatingCallTranscriptTests.aWordWiderThanTheLineWrapsInItsOwnRow
passes, and fails with that IllegalStateException on the old flow.
Back did nothing to the grown call: it went to whatever was under it
(the drawer, then out of the app) with the card still up. A
PredictiveBackHandler on the surface now steps one stage down, as
TalkBack's dismiss does (full -> card -> orb); a predictive back pulls
the shape down up to 56 dp as the gesture moves and springs back if it's
cancelled. At the orb back goes to the app as before. feature/voice now
depends on activity-compose (already in the catalog) for the handler.

Verified on the emulator (FX_1, scripted demo call): full -> back ->
card -> back -> orb -> back opens the drawer.
Back out of the app with a call live finished the activity: the root
store closed, but the call's foreground service kept running with no orb
or card on return, only the notification could end it, and a second call
could be started beside it. With a call live, a back the app doesn't
handle itself now moves the task to the back instead (as Home does); the
callback is added before the content, so the app's own back handling
(card, drawer, sheets) still comes first.

Verified on the emulator: back from the drawer with a call live goes to
the launcher; relaunching shows the same call's orb.
Dragging the card or sheet recomposed the whole floating call surface on
every frame: the frame, a new RoundedCornerShape, shadow, backing, the
bloom's config copy and the stage content's size were all read in
composition, and every child was placed with offset + size. Past the
card the content was laid out on the visible part of the sheet, so the
transcript re-measured and re-wrapped every word each frame.

Now the per-frame values live in FloatingCallSurfaceLook and are read
only while laying out and drawing: Modifier.placed { } lambdas, one
Shape whose outline reads the frame, dropShadow/graphicsLayer/drawBehind
lambdas, LivingOrbView(bloom = { }) read in its frame loop, and
FloatingCallStageContent takes its layout as a lambda measured by a
custom Layout. Composition reads only derived flags (content mounted,
interactive, face/bloom hidden, touch kind). The transcript keeps the
card's line width in both stages, so it never re-wraps while dragging.
A drag the system cancels (or whose pointer goes away) now still
settles on a stage instead of leaving the card where it was.

Verified on the VM emulator (FX_1, same gesture script, 3 runs each of
slow and fling drags up and down): temporary counters showed surface
recompositions per drag frame drop from 0.22-0.44 to 0.05-0.08, and
transcript recompositions and word-flow layouts from 0.2-1.0 to 0;
UI-thread p90 per frame fell 20-35% (e.g. slow-up 60.5 -> 47.1 ms,
fling-up 51.4 -> 33.7 ms, software renderer). Screenshots and a screen
recording show the card, sheet, mid-drag text at a stable width,
grabbing the card mid-flight, minimise and reopen.
scripts/check.sh :feature:voice :feature:session passes.
The transcript column hangs from the bottom, so each wrapped word or new
line moved everything above it up a whole line in one frame. It now
starts where it was and eases up over 0.3 s while the word fades in
(iOS: "the column glides when it wraps"). The rise is a draw-phase
translation read from the reveal's frame clock, so it adds no
recomposition; it's off under Reduce Motion and never glides a trim.

A line revised under its own ID (a delegator progress step, a
correction) used to un-reveal every changed word, blinking them out and
typing them again. It now keeps each shown word's slot and swaps the
text in place. Lines that settle under a new ID keep iOS's
unchanged-prefix rule (settlingUnderANewIDInheritsByPosition).

Verified: scripts/check.sh :feature:voice (new
aRevisedLineSwapsItsShownWordsInPlace); screen recording of the lab
demo call on the emulator shows the block rising over several frames
instead of jumping.
In landscape the card is shorter than its bloom plus the chrome below it,
so the controls overlapped the orb and the status was cut off. The card's
and sheet's blooms are now fitted to the height on screen: shrunk and
raised when the status, transcript and controls wouldn't fit below.

At font scale 2.0 the header was measured at a fixed 48 dp, which clipped
the session title, and the status and transcript sat at fixed offsets.
The header now grows for large text, and the details, status and
transcript each sit below the measured line above them. Normal font sizes
lay out exactly as before.

Verified on the emulator (FX_1): landscape card and sheet no longer
overlap (Z-R01, Z-R02); font scale 2.0 sheet and card show the full
title row and stacked status and transcript (Z-F02, Z-F03).
The mute badge sits over the orb's top-trailing rim, as on iOS, but the
shape's clip cut off its outer half. The shape's own layers (backing,
bloom, face, card content, rim) are now clipped in their own layer, and
the orb's controls and the call button's look ride above it, unclipped,
like iOS's controls layer. Gestures stay on the shape.

The card's controls drew their ripple across the whole share of the
row, so End showed a grey square around its red plate. The press now
shows on the plate only, and the capsule End's on its circle; the touch
target is unchanged.

Verified on the emulator (FX_1): muted orb shows the whole badge
(Z-C01-zoom); a held End press shows no square highlight (Z-E01-zoom);
the orb still drags to an edge and opens the card from there (Z-C02,
Z-C03).
- The card and sheet used iOS's device-corner radii (36 and 38 dp); they
  now take the design system's sheet radius (OpenCodeRadius.sheet, 16 dp).
  The ported radii test checks the new value.
- The card wore two shadows: the orb's elevation shadow and the card's
  drop shadow. The elevation now fades out as the drop shadow comes in,
  so each stage has one shadow, like iOS's single .shadow.
- TalkBack offered "Expand" on the full sheet, where it does nothing; it
  is now offered only below the sheet. The duration's state was the raw
  "1:05", which TalkBack reads as a time of day; it now says "1 minute,
  5 seconds".

Haptics were checked against iOS's FloatingCallStageFeature and already
match (tap, threshold, snap; minimize and step back stay quiet), so they
are unchanged.

Verified: scripts/check.sh :feature:voice passes; emulator (FX_1) card,
sheet and light-mode orb (Z-S-strip).
@Tarquinen
Tarquinen merged commit e8bbcd6 into dev Nov 11, 2026
3 checks passed
Tarquinen added a commit that referenced this pull request Nov 11, 2026
Conflicts: MainActivity imports (kept both sides) and the
FloatingCallStageContent parity row (took dev's, which already
describes the reveal-loop fix this branch also carried, so that fix
drops out of this PR's diff).
@Tarquinen Tarquinen mentioned this pull request Nov 12, 2026

This branch was previously deployed

1 inactive deployment
release — bd1d9a03 Deployed Nov 11, 2026 by Tarquinen via check #115
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