Skip to content

fix: respect device screen timeout; keep screen on only during playback#294

Merged
ProdigyV21 merged 1 commit into
ProdigyV21:mainfrom
chillpill244:fix/screen-timeout-respect-device-setting
Jun 3, 2026
Merged

fix: respect device screen timeout; keep screen on only during playback#294
ProdigyV21 merged 1 commit into
ProdigyV21:mainfrom
chillpill244:fix/screen-timeout-respect-device-setting

Conversation

@chillpill244
Copy link
Copy Markdown
Contributor

Summary

  • MainActivity was calling window.addFlags(FLAG_KEEP_SCREEN_ON) unconditionally at app launch and never clearing it, so the device screen timeout was completely ignored app-wide
  • Introduced a KeepScreenOn(active: Boolean) composable that uses DisposableEffect to add/clear the window flag reactively
  • Applied it to every playback surface so the screen stays on exactly when something is playing and not otherwise

Affected screens

Screen Condition
PlayerScreen Always (screen is a full video player)
TvScreen playingChannelId != null
LiveTvScreen playingChannelId != null
DetailsScreen showTrailerPlayer == true

PiP is also covered — PlayerScreen stays in composition during PiP, so the flag remains set while video plays in the PiP window.

Test plan

  • Open the app and leave it idle on Home/Search/Details — screen should time out per device setting
  • Start playback in PlayerScreen — screen should stay on indefinitely
  • Enter/exit PiP — screen should stay on while PiP video is playing
  • Open a live TV channel in TvScreen / LiveTvScreen — screen stays on; navigating away releases the flag
  • Open a trailer on a Details screen — screen stays on while trailer is open, times out after closing it

🤖 Generated with Claude Code

Removed the unconditional FLAG_KEEP_SCREEN_ON set at app launch which
prevented the screen from ever timing out. Introduced a KeepScreenOn
composable that holds the flag only while media is active — player
screen (always), live TV/TV screen (while a channel is playing), and
details screen (while the trailer overlay is open). PiP is covered
since PlayerScreen stays in composition during PiP.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ProdigyV21 ProdigyV21 merged commit f20001a into ProdigyV21:main Jun 3, 2026
1 check passed
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.

2 participants