Skip to content

[WIP][DONTMERGE] Record logcat messages with a recording and list them per frame - #236

Open
todi1856 wants to merge 10 commits into
masterfrom
recording-logcat
Open

todi1856 wants to merge 10 commits into
masterfrom
recording-logcat

Conversation

@todi1856

@todi1856 todi1856 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Yamato CI

Purpose of PR

Type of change: Improvement to Video Capture

https://www.youtube.com/watch?v=yzMFgU90A94&feature=youtu.be

A recording can now also save the logcat messages logged while it runs, and when it plays back, the messages are listed under the video frame by frame. Stepping through a recording shows what the device logged at each moment.

Highlights

  • Include Logcat Messages
    • Start Recording gets a dropdown arrow with Include Logcat Messages, off by default. It's remembered, and applies from the next recording.
    • The recording runs its own logcat, filtered as the Android Logcat window is when recording starts (package, priority, tags, filter text). The Logcat window doesn't need to be open.
  • Messages lined up with frames
    • The server now sends the device's wall clock with every frame, and the recording's logcat runs with -v epoch -v usec, so frames and messages share one clock, to the microsecond.
    • Each message belongs to the first frame at or after it, so frame N lists exactly what was logged after frame N-1, up to frame N. Messages from before the recording are dropped, and ones after the last frame go on the last frame.
    • On a still screen, where no frame arrives during the recording, the live view's last frame before recording places them.
  • Saved in the recording's .json, as a logs list on each entry of frameChanges. LogcatEntry is reused for this, and is now serializable, saving its time as timeUs.
  • Panel under the video
    • Looks like the Android Logcat window: its column header, row stripes, priority icons, message font and colours, and its column widths and visibility.
    • A Video column first, with the range of the video each message was logged in, from the previous frame to its own, as the player shows times.
    • The shown frame's messages are highlighted with the Logcat window's selection, and later ones are dimmed.
    • Follows the video as it plays or steps. Click a message to go to its frame. Drag the divider to resize the panel.
  • Protocol version 3: the frame header grows from 32 to 40 bytes for the wall clock. A server jar from before this reports a version mismatch, with a button to rebuild it.
  • AndroidLogcatScreenshotInfo is renamed to AndroidLogcatCaptureInfo, since it describes recordings too. Existing .json files load as before.
  • The sample project's DebugMethods shows and logs typed characters, for testing keyboard input and logcat recording from the live view.

Testing

  • New LogsLandOnTheFrameTheyWereLoggedBeforeAndSurviveSaving in the recorder tests: placement of messages before, during and after the recording, and a JSON round trip.
  • AndroidLogcatGeneralTests checks the new setting is off by default and after Reset.
  • Manual: record with Include Logcat Messages while typing on the sample app, then step through the recording and check each Typed: message lands on the frame where the text changes.

🤖 Generated with Claude Code

todi1856 and others added 6 commits November 13, 2026 16:30
Each frame header now carries realtimeUs, the device's wall clock at capture,
which is the clock logcat stamps messages with. The frame header grows from
32 to 40 bytes, so the protocol version goes to 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Start Recording gets a dropdown with Include Logcat Messages, off by default.
When enabled, the recording runs its own logcat, filtered as the Android
Logcat window is when recording starts, with '-v epoch -v usec' so messages
can be placed among the frames using the frame's device wall clock. Each
message is saved in the recording's .json, on the frame it was logged before,
reusing LogcatEntry, now serializable.

When the recording plays, a resizable panel under the video lists the
messages with the video time of their frame, highlights the shown frame's,
dims later ones, follows the video, and goes to a message's frame on click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DebugMethods displays what is typed on screen and logs each change, for
testing keyboard input and logcat recording from the live view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The details file describes recordings too, with what changed while they ran,
so the name says capture rather than screenshot. JsonUtility doesn't store the
class name, so existing .json files load as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The panel under the video now uses the Logcat window's column header, row
stripes, selection highlight for the shown frame, priority icons, and the
message font and colors from Preferences. The shared columns follow the
Logcat window's column widths and visibility, with the video time first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Saved by a newer Editor, with the DebugMethods object that shows typed characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

The change integrates log collection, persistence, and playback, but recorded messages can be lost or assigned incorrectly in reachable recording scenarios.

Reviewed commit f7baf48

🤖 Helpful? 👍/👎

todi1856 and others added 4 commits November 13, 2026 16:49
The Video column shows the range from the previous frame to the message's
frame, and a message now goes to the first frame at or after it, so frame N
lists exactly what was logged after frame N-1, up to frame N.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Read the recording's logcat from the device time of the frame recording
  started on (-T <seconds>), so messages logged while adb starts aren't missed.
- Drop messages logged before the recording by their unrounded time, so one
  just before the start no longer lands on the first frame.
- Place messages by sorting them by frame and merging them into the frame
  changes in one pass, instead of searching the changes for each message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every 3 seconds DebugMethods logs the time, and the screen shows the time
updated every frame, to compare a recording's frames with its logcat panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProjectVersion.txt and ProjectSettings.asset as saved by the Editor the
project is now opened with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@todi1856

Copy link
Copy Markdown
Member Author

/review

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Harness Review

Needs changes

The change connects independent log capture to recording metadata and playback, with remaining issues affecting how reliably the saved logs can be inspected.

Reviewed commit 6d65f30

🤖 Helpful? 👍/👎

out.writeLong((captureNs - firstFrameNs) / 1000L);
// The clock logcat stamps messages with, so the Editor can place them among
// the frames. Taken back by the frame's age, as it was captured a moment ago.
out.writeLong(System.currentTimeMillis() * 1000L - (System.nanoTime() - captureNs) / 1000L);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1

At 1 FPS, a log emitted during the throttle wait can be attached to an image captured before that log. ScreenStreamer.onImageAvailable acquires the image before sleeping, then passes a fresh System.nanoTime() as captureNs after sleeping. writeFrame therefore stamps the image with the end of the wait rather than its capture time. PlaceLogs can assign messages emitted during that wait to the earlier image. Derive both frame timestamps from the image's capture time. Keep throttling timestamps separate.

🤖 Helpful? 👍/👎


void DoRowsGUI(Rect list, int first, int end, Action<double> seek)
{
var content = new Rect(0, 0, list.width - kScrollbarWidth, m_Entries.Length * m_RowHeight);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2

With default columns, a preview narrower than 450 pixels hides every message's text. DoHeaderGUI assigns 450 pixels to columns before Message and clamps the remaining message width to zero. The capture list permits previews as narrow as 100 pixels. DoRowsGUI keeps its content narrower than the viewport, so horizontal scrolling cannot reveal the missing column. Give Message a minimum width. Size the scroll content to accommodate all columns. Scroll the header with the rows.

🤖 Helpful? 👍/👎

@todi1856 todi1856 changed the title Record logcat messages with a recording and list them per frame [WIP][DONTMERGE] Record logcat messages with a recording and list them per frame Nov 17, 2026
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