Skip to content

fix(subtitles): recenter cues after aspect mode changes - #127

Merged
RXWatcher merged 20 commits into
mainfrom
fix/subtitle-aspect-recenter
Jul 28, 2026
Merged

RXWatcher merged 20 commits into
mainfrom
fix/subtitle-aspect-recenter

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • recenter the shared subtitle canvas when phone or TV switches between Fit, Zoom, and Fill/Stretch
  • preserve authored ASS/SSA/PGS cue positioning while translating the visible player viewport into the subtitle parent coordinate space
  • reconcile geometry after layout with lifecycle-owned, coalesced pre-draw handling
  • stabilize subtitle-track restoration when resuming playback
  • use a smaller phone subtitle presentation without changing TV sizing
  • leave phone playback brightness under Android system/adaptive control; the former left-edge brightness drag is now reserved while volume and dismiss gestures are preserved

Verification

  • ./gradlew testDebugUnitTest --max-workers=2 --no-daemon
  • uncached shared/phone/TV subtitle gate: 118 tasks executed, BUILD SUCCESSFUL
  • SubtitleManagerAppearanceTest: 26/26 green
  • mutation check: disabling coalescing fails with expected 1 reconciliation vs 5 observed
  • focused player gesture, pinch-gravity, lifecycle, subtitle startup, and aspect-routing tests: green
  • ./scripts/test-check-build-supply-chain.sh
  • ./scripts/check-build-supply-chain.sh
  • phone + TV release assemblies completed successfully with repository-supported debug release signing
  • independent whole-branch and focused brightness reviews: no remaining actionable findings

Manual validation

  • Physical Pixel 58211FDCQ000CU upgraded in place with matching signer; package 0.3.11/code 14 launched resumed with a live process and no immediate crash/ANR
  • subtitle aspect/sizing and startup restoration were validated interactively on the Pixel
  • final system-brightness behavior is ready for interactive confirmation on the Pixel
  • Shield was not touched for the phone-only brightness change

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@RXWatcher, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa8bee5f-cb77-4565-9381-680a79161d68

📥 Commits

Reviewing files that changed from the base of the PR and between 075fa0a and e989ad5.

📒 Files selected for processing (5)
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerGestureHandler.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerVerticalDragModeTest.kt
  • docs/superpowers/plans/2026-07-28-android-player-system-brightness.md
  • docs/superpowers/plans/2026-07-28-android-subtitle-aspect-reconciliation-and-phone-sizing.md
  • docs/superpowers/specs/2026-07-28-android-player-system-brightness-design.md
📝 Walkthrough

Walkthrough

Subtitle rendering now selects bounds by resize mode, applies presentation-specific sizing, and performs bounded post-layout reconciliation. Mobile subtitle mounts require repeated snapshot evidence before failure. Tests cover geometry, lifecycle, wiring, and settlement behavior.

Changes

Subtitle aspect-mode reconciliation

Layer / File(s) Summary
Resize-aware bounds and lifecycle reconciliation
android-shared/src/androidMain/kotlin/.../SubtitleManager.kt, docs/superpowers/...
Subtitle rectangles now use resize-aware canvas selection, generation-bound pre-draw reconciliation, and disposal-safe observer cleanup.
Geometry and lifecycle regression coverage
android-shared/src/androidUnitTest/kotlin/.../SubtitleManagerAppearanceTest.kt
Robolectric tests cover phone/TV sizing, stale frames, aspect transitions, repeated synchronization, and detachment.
Phone and TV presentation and synchronization wiring
androidApp/src/androidMain/kotlin/..., androidTvApp/src/androidMain/kotlin/..., androidApp/src/androidUnitTest/kotlin/..., androidTvApp/src/androidUnitTest/kotlin/...
DI selects phone or television presentation, while source-contract tests verify resize or fill-mode updates precede subtitle synchronization.
Mobile subtitle-mount miss stabilization
androidApp/src/androidMain/kotlin/..., androidApp/src/androidUnitTest/kotlin/...
Local mount failure is deferred until the same settled snapshot key is reported repeatedly, and pending player-screen mounts remain unsettled until track evidence.
Reconciliation and settlement design documentation
docs/superpowers/plans/..., docs/superpowers/specs/...
Plans and specifications document geometry selection, reconciliation, sizing, settlement, wiring, and validation requirements.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

  • Silo-Server/silo-android#32 — Addresses the same subtitle rectangle selection and bounds synchronization objectives for different video resize modes.

Possibly related PRs

  • Silo-Server/silo-android#37 — Also updates SubtitleVideoRectSync.applyRect to select subtitle bounds from content-frame and displayed-video rectangles.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: recentering subtitle cues after aspect mode changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/subtitle-aspect-recenter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt (1)

19-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Make the source-contract tests fail closed when their target block changes.

Unanchored first-match slicing can silently pick the wrong block if the source is refactored. Anchor the parsing to the specific enclosing player AndroidView / PlayerView declaration and assert that both delimiter strings exist and are ordered before comparing contents.

  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt#L19-L20: scope parsing to the intended phone AndroidView update lambda.
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectModeWiringSourceTest.kt#L19-L20: scope parsing to the intended TV PlayerView update lambda.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt`
around lines 19 - 20, Update the source parsing in
androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt#L19-L20
and
androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectModeWiringSourceTest.kt#L19-L20
to first scope extraction to the intended enclosing phone AndroidView or TV
PlayerView update lambda, then assert both delimiter strings are present and
ordered before comparing contents; ensure the tests fail rather than silently
selecting an unrelated block when the source structure changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/plans/2026-07-28-subtitle-aspect-recenter.md`:
- Around line 123-161: Update the plan sections covering the mode-aware selector
and reconciliation flow to reflect the shipped SubtitleManager.kt behavior:
preserve matching content-frame coordinates instead of unconditionally selecting
displayedVideoRect for ZOOM/FILL, and describe the lifecycle-owned pre-draw
observer rather than postOnAnimation or postLayoutPending. Mark the superseded
implementation tasks as completed or revise their status and snippets so the
plan no longer directs future changes toward the replaced design.

---

Nitpick comments:
In
`@androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt`:
- Around line 19-20: Update the source parsing in
androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt#L19-L20
and
androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectModeWiringSourceTest.kt#L19-L20
to first scope extraction to the intended enclosing phone AndroidView or TV
PlayerView update lambda, then assert both delimiter strings are present and
ordered before comparing contents; ensure the tests fail rather than silently
selecting an unrelated block when the source structure changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6698ae13-1fd0-4ffd-80ce-6e8c469c6f81

📥 Commits

Reviewing files that changed from the base of the PR and between 2fb5318 and 061327b.

📒 Files selected for processing (6)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SubtitleManagerAppearanceTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectModeWiringSourceTest.kt
  • docs/superpowers/plans/2026-07-28-subtitle-aspect-recenter.md
  • docs/superpowers/specs/2026-07-28-subtitle-aspect-recenter-design.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@docs/superpowers/plans/2026-07-28-android-subtitle-aspect-reconciliation-and-phone-sizing.md`:
- Around line 5-16: Resolve the phone subtitle-sizing contract consistently
across
docs/superpowers/plans/2026-07-28-android-subtitle-aspect-reconciliation-and-phone-sizing.md
lines 5-16 and
docs/superpowers/specs/2026-07-28-android-subtitle-aspect-reconciliation-and-phone-sizing-design.md
lines 70-80: use the authoritative 1.25× phone fractions (Small 25/720 through
XXLarge 60/720), update the goal and sizing table accordingly, and ensure the
specification, plan, and SubtitleManager implementation all describe the same
values while preserving the unchanged television fractions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fa03d598-c17b-4978-a545-dcb4c2d1fc46

📥 Commits

Reviewing files that changed from the base of the PR and between 061327b and 075fa0a.

📒 Files selected for processing (14)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SubtitleManagerAppearanceTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/di/AndroidModule.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileSubtitleTransactionAdapter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/MobileSubtitleTransactionAdapterTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectSyncWiringTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/di/AndroidTvModule.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectModeWiringSourceTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectSyncWiringTest.kt
  • docs/superpowers/plans/2026-07-28-android-subtitle-aspect-reconciliation-and-phone-sizing.md
  • docs/superpowers/plans/2026-07-28-subtitle-aspect-recenter.md
  • docs/superpowers/specs/2026-07-28-android-subtitle-aspect-reconciliation-and-phone-sizing-design.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/SubtitleAspectModeWiringSourceTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvSubtitleAspectModeWiringSourceTest.kt
  • docs/superpowers/plans/2026-07-28-subtitle-aspect-recenter.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/SubtitleManagerAppearanceTest.kt

@RXWatcher
RXWatcher merged commit bfc6ab5 into main Jul 28, 2026
2 checks passed
@RXWatcher
RXWatcher deleted the fix/subtitle-aspect-recenter branch July 28, 2026 17:47
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