Skip to content

feat: add 'Keep screen awake' setting to prevent screen lock during streaming#1559

Open
aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
aliefe04:feat-keep-screen-awake-setting-1549
Open

feat: add 'Keep screen awake' setting to prevent screen lock during streaming#1559
aliefe04 wants to merge 1 commit intomoonlight-stream:masterfrom
aliefe04:feat-keep-screen-awake-setting-1549

Conversation

@aliefe04
Copy link
Copy Markdown

Resolves #1549

Summary

Adds a new preference option "Keep screen awake" in Basic Settings that prevents the Android screen from locking during streaming.

Problem

Users reported that their Android device screen would lock during streaming sessions, especially when using Moonlight as a remote desktop for extended periods without touch input (e.g., watching movies, using Bluetooth keyboard/mouse).

Solution

  • Added a new checkbox preference "Keep screen awake" in Settings > Basic Settings
  • Default: enabled (preserves current behavior)
  • When enabled: sets FLAG_KEEP_SCREEN_ON to prevent screen lock
  • When disabled: screen can lock based on system timeout settings

Changes

  • PreferenceConfiguration.java: Added preference constant, field, and reading logic
  • preferences.xml: Added CheckBoxPreference in Basic Settings category
  • strings.xml: Added title and summary strings
  • Game.java: Set FLAG_KEEP_SCREEN_ON in onCreate() based on preference

Testing

  • Setting appears in Settings > Basic Settings
  • Default is enabled (screen stays awake during streaming)
  • Disabling the setting allows screen to lock during streaming
  • No effect when streaming is not active

…treaming

Resolves moonlight-stream#1549

Adds a new preference option 'Keep screen awake' in Basic Settings
that prevents the Android screen from locking during streaming.

- Default: enabled (preserves current behavior)
- When disabled: screen can lock during streaming based on system timeout
- Setting appears in Settings > Basic Settings

Changes:
- Add preference constant, field, and reading in PreferenceConfiguration
- Add CheckBoxPreference in preferences.xml
- Add title and summary strings in strings.xml
- Set FLAG_KEEP_SCREEN_ON in Game.onCreate() based on preference
- Remove redundant addFlags call in connectionStarted()
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.

[Feature request]: Option to stop Android screen from locking

1 participant