Repository navigation
Conversation
- Configure layoutInDisplayCutoutMode = SHORT_EDGES in FullscreenEffect - Remove artificial status bar overlay in SafeHAWebView - Report real top safe area insets to frontend via pxToDp - Obsolete frontend#29125 guardrail: modern Lovelace properly handles env(safe-area-inset-top) in CSS, eliminating the need for a native top letterbox strip while preserving drawer contrast in standard mode. Fixes home-assistant#7554
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
There was a problem hiding this comment.
🟡 Changes recommended
Legacy frontends receive neither the removed native top guardrail nor CSS safe-area insets, leaving content beneath the status bar.
1 open finding
What changed in this PR
Fixes fullscreen display-cutout letterboxing while forwarding the actual top safe-area inset to compatible frontends.
Changes:
- Configures cutout layout mode with fullscreen state.
- Removes the fixed top overlay and reports the real top inset.
| File | Description |
|---|---|
LaunchActivity.kt |
Updates display-cutout mode during fullscreen changes. |
FrontendScreen.kt |
Removes the top overlay and reports the top safe-area inset. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| val statusBarColor = contentState?.statusBarColor ?: fallbackColor | ||
| val backgroundColor = contentState?.backgroundColor ?: fallbackColor | ||
|
|
||
| Column(modifier = Modifier.fillMaxSize()) { |
TimoPtr
left a comment
There was a problem hiding this comment.
I'm not confident merging this.
| val backgroundColor = contentState?.backgroundColor ?: fallbackColor | ||
|
|
||
| Column(modifier = Modifier.fillMaxSize()) { | ||
| // The top is never drawn edge-to-edge: we always reserve and color the status bar strip. |
There was a problem hiding this comment.
You cannot simply remove it like this. We need to keep it for old servers with issues at the top. Also we did enable it at some point but doing so breaks on some screen not only on the drawer. It could be on apps for instance like Music Assistant that takes over the UI. We cannot remove it until we have a way to ensure that the frontend is not drawing a color that would hide the content of the status bar and today it's not guaranteed.
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { | ||
| window.attributes = window.attributes.apply { | ||
| layoutInDisplayCutoutMode = if (isFullScreen) { | ||
| WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES |
There was a problem hiding this comment.
Could you share a screenshot of the difference between the two?
|
@jpelgrom it seems that it is enabled on iOS now with the issue and no complains so far (we might be over protective here?), but I still have some concerned that it might break at any moment of time. Also this PR needs to be adjusted for old server. |
Restore statusBarColor.Overlay on the top window insets when serverHandleInsets is false. This ensures legacy Home Assistant servers that do not consume raw insets continue to have their top status bar protected, matching the behavior already in place for the left and right window insets. Modern servers (> 2026.2) continue reporting real insets via ReportSafeAreaInsetsEffect.
|
@TimoPtr Updated. Restored Here is the cutout comparison tested on a Pixel 9 Pro XL:
Fullscreen Immersive View
Card Dashboard View
|
Yes, that very well could be true. Edge to edge with all Android versions + fullscreen is just hard to get 100% correct.
|
|
|
@jpelgrom Tested Music Assistant on the Pixel 9 Pro XL as well: safe areas and layout hold up cleanly in fullscreen. Top header controls and bottom player bar remain fully accessible with no cutout collisions.
|
| .padding(insets.only(WindowInsetsSides.Horizontal).asPaddingValues()), | ||
| ) | ||
| // The top status bar guardrail is retained for legacy servers (< 2026.2) where the frontend does not handle safe areas. | ||
| if (!serverHandleInsets) { |
There was a problem hiding this comment.
Unfortunately I think this is not enough from what I remember at the moment we've introduced this flag it was not working properly so we should enable this starting on the release you've tested, I know @bgoncal fixed a lot of issues in the frontend recently about safe area. I would gate this to 2026.10 to be safe @jpelgrom any opinion.
Testing this is always painful since we have so many screen on the frontend, I want this in the next beta so we can have feedbacks before a release in prod like we did last time (that led us to keep the top bar).













Summary
Fixes #7554
This PR allows the WebView canvas to extend behind the camera hole punch in fullscreen mode, and removes the old status bar overlay guardrail in
FrontendScreen.kt.What changed:
layoutInDisplayCutoutMode = SHORT_EDGESinLaunchActivitywhen fullscreen is toggled. Without this, Android defaults to letterboxing the window when system bars are hidden.statusBarColor.OverlayinFrontendScreen. This was originally added as a defensive measure forfrontend#29125and drawer contrast, but modern Lovelace already handles safe area padding cleanly via CSSenv(safe-area-inset-top).pxToDp(...)) toonSafeAreaInsetsChangedinstead of hardcoding0f.Impact:
Checklist
Select exactly one option that describes AI usage in this contribution:
Screenshots
Standard Mode (App bar & system status bar render untouched)
Fullscreen Mode (True edge-to-edge behind the hole punch)
Safe Area Positioning (Standard HA UX and header remain properly positioned below safe area)
Any other notes
Empirical testing details and side-by-side hardware behavior across alert banners were documented in the follow-up comment on issue #7554.