Serve Android's scrolling screenshot from the chat timeline - #492
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ScrollCaptureBridgeview answers the system'sScrollCaptureCallbackfor 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 withPixelCopyinto the capture session's surface.ChatViewgains 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-androidgains aScrollCaptureRequesthost event, a process-level callback andafter_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. newscrolling_capture_moves_the_timeline_within_its_content_and_restores_it)cargo clippy -p tcode-ui --all-targets -- -D warningscargo ndk -t arm64-v8a clippy -p tcode-android(only the pre-existingi18n.rsthread_local warning on this target)androidTestcompile; newScrollCaptureBridgeTestcovers tile geometryiOS has no public API for this and is unchanged.