Skip to content

Add options to hide system bars and turn screen on#54

Closed
xvello wants to merge 2 commits intobrownard:masterfrom
xvello:ScreenWaker
Closed

Add options to hide system bars and turn screen on#54
xvello wants to merge 2 commits intobrownard:masterfrom
xvello:ScreenWaker

Conversation

@xvello
Copy link
Copy Markdown
Contributor

@xvello xvello commented Feb 14, 2026

For use in a small-screen kiosk device such as the Echo Show, add two options:

  • hideSystemBars to increase available screen space
  • wakeScreen to allow the screen to dim on inactivity, then go bright during voice interactions and timer countdown

They intentionnaly only apply to the HomeScreen, so that they don't apply if the app is not in the foregroud (instead of using a screen WakeLock).

Do you want these exposed as esphome switches too??

@xvello xvello force-pushed the ScreenWaker branch 2 times, most recently from a779be0 to b12e11b Compare February 15, 2026 12:55
@brownard
Copy link
Copy Markdown
Owner

This looks like a nice addition.

Do you want these exposed as esphome switches too??

Ideally yes, but I think the switch entity handling might need a bit of a rework first. Currently they are created in the VoiceSatellite constructor, which is not only getting a bit unwieldly, but means the VoiceSatellite would need a dependency on the new settings which would otherwise be unnecessary. Instead all the entities should probably be passed into the VoiceSatellite constructor as an externally built list as none of them are referenced by the satellite directly.

You can either leave the switches for now and I'll rework it later, or if you want to refactor similar to the above then give it a go.

Comment on lines +18 to +35
fun WakeScreenOnInteraction(viewModel: ServiceViewModel = hiltViewModel()) {
val timers by viewModel.voiceTimers.collectAsStateWithLifecycle(emptyList())
val currentState by viewModel.satelliteState.collectAsStateWithLifecycle(null)
val wakingStates = setOf(Listening, Processing, Responding)

if (wakingStates.contains(currentState) || timers.any({ it !is VoiceTimer.Paused })) {
val window = LocalActivity.current?.window
if (window != null) {
DisposableEffect("WakeScreenOnInteraction") {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

onDispose {
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
}
}
} No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

If you collect the timers and state (and potentially the current window) in the caller and pass them in directly as parameters instead of the view model then you can make this a stateless composable which should avoid it being called altogether until those values change and save a few cycles (see state hoisting). As it stands I think the if check is called every frame.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@brownard sorry for the delay. I rebased and moved the state up, although I didn't go full stateless because I don't think it's worth it here. Happy to do it though if you think it's better.

Copy link
Copy Markdown
Contributor Author

@xvello xvello Feb 26, 2026

Choose a reason for hiding this comment

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

Edit: I updated my S9 to this lineage 23 ROM and WakeScreenOnInteraction is non functional. I am investigating why and will post here.

Seems like using a Composable for this won't work, because composition can be paused when the screen is off, leading to our logic never being executed.

@janstadt
Copy link
Copy Markdown

janstadt commented Feb 24, 2026

@xvello i see you mentioned an Echo Show. Have you had success running the app? I have a rooted echo show 8 (running lineageos/android 11) and am unable to get the device to connect to my HASS instance. I submitted an issue here: #63 Just curious if you had any issues? Sorry for highjacking this PR.

Edit: Scratch that.....I had a static IP reservation for this device and somehow it got overridden by some other client. Removed the reservation on my router and things are connecting just fine now.

@Mugl3
Copy link
Copy Markdown

Mugl3 commented Mar 4, 2026

Would be cool if the background shows a colour matching current state. In case I'm yelling at it from far away and cannot read the text :)

@xvello
Copy link
Copy Markdown
Contributor Author

xvello commented Mar 9, 2026

Closing in favour of #65, I'd rather pay 4$/device than figure out how to make that work on several Android versions. Anyone can feel free to reuse this branch and bring it forward, I'm kind of done with Android documentation.

@Mugl3 I plan on implementing a better visual feedback for the satellite state (probably with a microphone icon that changes colors when listening/thinking/error...). It will take the left half of the screen in landscape mode, timers will take the right half. But it's not happening on this branch.

@xvello xvello closed this Mar 9, 2026
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.

4 participants