Skip to content

Serve Android's scrolling screenshot from the chat timeline - #492

Merged
Tryanks merged 1 commit into
mainfrom
android-scroll-capture
Sep 21, 2026
Merged

Tryanks merged 1 commit into
mainfrom
android-scroll-capture

Conversation

@Tryanks

@Tryanks Tryanks commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Android 12+ long screenshots ("scrolling capture") now work on the chat timeline. A transparent ScrollCaptureBridge view answers the system's ScrollCaptureCallback for the GPUI window: Rust reports the timeline's rectangle, scrolls it to each requested tile, and replies once a presented frame is settled; the activity copies that frame with PixelCopy into the capture session's surface.
  • ChatView gains a capture session: tail following, history paging and the reservation scroll-back are paused, the origin is a row anchor (rows measured for the first time move every pixel count above them), tiles are clamped to measured content and never enter the history reservation, and the anchor is restored at the end.
  • gpui-android gains a ScrollCaptureRequest host event, a process-level callback and after_next_frame; the host crate drives the settle loop (re-scroll after each frame until nothing moves and no Markdown build is pending, bounded to 12 frames).

Test plan

  • cargo test -p tcode-ui (300 passed, incl. new scrolling_capture_moves_the_timeline_within_its_content_and_restores_it)
  • cargo clippy -p tcode-ui --all-targets -- -D warnings
  • cargo ndk -t arm64-v8a clippy -p tcode-android (only the pre-existing i18n.rs thread_local warning on this target)
  • Gradle: main sources and androidTest compile; new ScrollCaptureBridgeTest covers tile geometry
  • Not verified on a device: take a long screenshot on Android 12+ with a thread open

iOS has no public API for this and is unchanged.

Android 12's screenshot tool extends a capture by asking the app which
view scrolls and then for the pixels above and below the viewport, one
tile at a time. GPUI paints the whole window into one surface, so the
framework finds no scrolling view, and its wgpu surface cannot be read
back. A transparent view covering the window answers for the timeline:
Rust reports the list's rectangle, scrolls it to each tile relative to a
row anchored at the start (rows measured for the first time move every
pixel count above them), and replies once a presented frame is settled;
the activity copies that frame out of the window with PixelCopy. Tail
following, history paging and the reservation scroll-back are paused for
the capture and the anchor is restored afterwards.
@Tryanks
Tryanks merged commit 3991164 into main Sep 21, 2026
7 checks passed
@Tryanks
Tryanks deleted the android-scroll-capture branch September 21, 2026 02:29
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