fix: screen timeout ignored when dashboard has live camera stream#6388
Open
almirus wants to merge 1 commit intohome-assistant:mainfrom
Open
fix: screen timeout ignored when dashboard has live camera stream#6388almirus wants to merge 1 commit intohome-assistant:mainfrom
almirus wants to merge 1 commit intohome-assistant:mainfrom
Conversation
Member
|
I'm not sold on this 'fix'. For normal media usage, where you want to keep the screen on while watching a video automatically, this is a regression. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix device screen timeout when a dashboard streams a live camera and the app setting "Keep screen on" is turned off.
Motivation: With "Keep screen on" disabled, WebView/Chromium still keeps the screen on during video playback (fullscreen custom view and inline streams), so the system screen timeout never runs (#3953).
Changes (only in
WebViewActivity.kt):keepScreenOnrecursively on the custom fullscreen video view and its children so Chromium cannot keep the screen on.webView.keepScreenOn = falseafter clearing the window flag, and start a periodic task that clearswebView.keepScreenOnevery 5 seconds while the activity is in the foreground (to override Chromium for inline video). The task is cancelled in onPause and when the setting is enabled.Impact: With "Keep screen on" off, the device screen timeout works again even when the dashboard shows a live camera stream (fullscreen or inline). No change when "Keep screen on" is on.
Fixes #3953
Checklist
Screenshots
No UI changes.
Link to pull request in documentation repositories
User Documentation: home-assistant/companion.home-assistant#
Not applicable.
Developer Documentation: home-assistant/developers.home-assistant#
Not applicable.
Any other notes
app/src/main/kotlin/io/homeassistant/companion/android/webview/WebViewActivity.ktis modified.webView.keepScreenOnis a trade-off between fixing inline video and limiting extra wakeups; it can be adjusted viakeepScreenOnClearIntervalMsif needed.