Skip to content

fix(tv): release the screen while playback is paused - #189

Merged
RXWatcher merged 1 commit into
Silo-Server:mainfrom
RXWatcher:fix/tv-release-screen-while-paused
Aug 6, 2026
Merged

fix(tv): release the screen while playback is paused#189
RXWatcher merged 1 commit into
Silo-Server:mainfrom
RXWatcher:fix/tv-release-screen-while-paused

Conversation

@RXWatcher

@RXWatcher RXWatcher commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Problem

A paused player held the display awake indefinitely — the system screensaver never fired, leaving a static frame parked on the panel for as long as the viewer was away. Reported against a Shield; on an OLED this is exactly what burn-in protection exists to prevent.

Root cause — two unconditional holders

  1. TvPlayerScreen added FLAG_KEEP_SCREEN_ON in a DisposableEffect(context) — set at mount, cleared at dispose, blind to playback state.
  2. tv_player_view.xml hardcoded android:keepScreenOn="true" on the PlayerView. A view-level keepScreenOn propagates to the same window flag and never releases — which is why gating the effect alone changed nothing when verified on device.

Fix

The window flag is now gated on !isPaused && (isPlaying || isBuffering) — the same rule the phone player already adopted for its own version of this report (Pixel 8 Pro / S25 Ultra), so both form factors now behave identically: pause long enough and the screensaver takes over; resume and the screen is held again. Buffering counts as playing so a rebuffer at a scene boundary cannot blank the screen mid-watch.

The XML attribute is removed; the gated effect is the flag's single owner.

Verification

On a Google TV Streamer, reading the window flags from dumpsys window at each transition:

PLAYING : isPlaying=True   keepScreenOn=1
PAUSED  : isPlaying=False  keepScreenOn=0
RESUMED : isPlaying=True   keepScreenOn=1
PAUSED-2: isPlaying=False  keepScreenOn=0

androidTvApp unit suite green.

Scope

TV only — the phone already has this gate. The TV audiobook player never held the flag, so audio-only playback is unaffected (the screensaver firing over a paused audiobook cover is already the intended behaviour).

Summary by CodeRabbit

  • Bug Fixes
    • The TV display now stays awake during playback and buffering.
    • The display automatically turns off its keep-awake behavior when playback is paused or inactive.
    • Screen-awake behavior now updates reliably whenever playback status changes.

A paused player held the display awake indefinitely: the screensaver
never fired, leaving a static frame parked on the panel for as long as
the viewer was away — precisely what burn-in protection exists to
prevent, and reported against a Shield driving an OLED.

Two holders, both unconditional:

- TvPlayerScreen added FLAG_KEEP_SCREEN_ON in a DisposableEffect keyed
  only on context — set at mount, cleared at dispose, blind to playback
  state. Now gated on !isPaused && (isPlaying || isBuffering), the same
  rule the phone player adopted for its own version of this report
  (Pixel 8 Pro / S25 Ultra). Buffering counts as playing so a rebuffer
  cannot blank the screen mid-watch.
- tv_player_view.xml hardcoded android:keepScreenOn="true" on the
  PlayerView. A view-level keepScreenOn propagates to the same window
  flag and never lets go, so the gate alone changed nothing. Removed;
  the gated effect is the flag's single owner.

Verified on a Google TV Streamer via dumpsys window across
play → pause → resume → pause: the flag is present exactly while
isPlaying and gone within a beat of each pause.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N7bPXi6NaUecM18rfWKAmP
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a59c2303-b815-43cb-bf14-2130524635dd

📥 Commits

Reviewing files that changed from the base of the PR and between 5e8c2a2 and e8d8133.

📒 Files selected for processing (2)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt
  • androidTvApp/src/androidMain/res/layout/tv_player_view.xml
💤 Files with no reviewable changes (1)
  • androidTvApp/src/androidMain/res/layout/tv_player_view.xml

📝 Walkthrough

Walkthrough

The TV player now keeps the display awake only while playback is active or buffering. It clears the flag when playback is paused, inactive, or disposed. The layout no longer sets the flag for the screen lifetime.

Changes

TV screen-awake behavior

Layer / File(s) Summary
Playback-state screen-awake control
androidTvApp/src/androidMain/kotlin/.../TvPlayerScreen.kt, androidTvApp/src/androidMain/res/layout/tv_player_view.xml
The player updates FLAG_KEEP_SCREEN_ON when playback state changes. The flag remains set while playing or buffering and is cleared when paused, inactive, or disposed. The layout removes its static android:keepScreenOn setting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: quick104

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: allowing the TV screen to turn off while playback is paused.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@RXWatcher
RXWatcher merged commit 4ae38ab into Silo-Server:main Aug 6, 2026
1 check passed
@RXWatcher
RXWatcher deleted the fix/tv-release-screen-while-paused branch August 6, 2026 22:07
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