Skip to content

Conversation

@PureWeen
Copy link
Member

@PureWeen PureWeen commented Aug 15, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

This pull request introduces a temporary workaround for Android 15 / API 36's removal of the legacy "edge-to-edge ignore" path, which previously helped prevent app content from being covered by system bars. The changes add a minimal WindowsListener class to several key Android handlers in MAUI, ensuring that content is properly inset and not obscured by system bars or display cutouts until a comprehensive edge-to-edge and system bar inset solution is implemented. This approach is intentionally minimal and will be replaced by a more robust solution in the future.

The reason for a temporary workaround is to fix this bug for now in the next NET10 release and then follow up back filling the SafeAreaEdges APIs (most likely RC2)

Edge-to-edge and system bar insets workaround:

  • Added a temporary WindowsListener class implementing IOnApplyWindowInsetsListener to multiple handlers (ShellFlyoutTemplatedContentRenderer, ShellSectionRenderer, FlyoutViewHandler, and WindowHandler) to adjust padding/margins and prevent content from being covered by system bars or display cutouts. [1] [2] [3] [4]

  • Integrated ViewCompat.SetOnApplyWindowInsetsListener calls in the relevant view setup methods to apply the new listener for managing insets in flyouts, app bars, root views, and other key UI elements. [1] [2] [3] [4]

Dependency updates:

  • Added missing AndroidX.Core.View and related using statements to ensure compatibility with the new window insets APIs. [1] [2] [3] [4]

Legacy system windows handling removal:

  • Removed legacy SetFitsSystemWindows(true) call from ShellRenderer to align with the new edge-to-edge handling.

Each of these changes is a targeted, minimal fix to prevent regressions in edge-to-edge layouts on the latest Android versions, while the team works on a comprehensive solution for system bar and safe area handling.

Issues Fixed

Fixes #29954
Fixes #26788
Fixes #24903

Copilot AI review requested due to automatic review settings August 15, 2025 20:07
@PureWeen PureWeen requested a review from a team as a code owner August 15, 2025 20:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a temporary workaround for Android 15 / API 36 edge-to-edge behavior changes by adding window insets handling to prevent content from being covered by system bars. The change addresses a regression where Android 15 removed the legacy opt-out path for edge-to-edge behavior, requiring manual inset management until a comprehensive solution is implemented.

  • Adds a WindowsListener class that implements IOnApplyWindowInsetsListener to handle window insets
  • Applies different padding strategies to AppBarLayout (top inset only) and root view (side and bottom insets)
  • Includes caching mechanism for AppBarLayout lookup optimization

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@PureWeen PureWeen added this to the .NET 10.0-rc1 milestone Aug 16, 2025
@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Aug 16, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Aug 16, 2025
// - Keep this minimal.
// - Will be replaced by the planned comprehensive window insets solution.
// - Do not extend; add new logic to the forthcoming implementation instead.
internal class WindowsListener : Java.Lang.Object, IOnApplyWindowInsetsListener
Copy link
Member

Choose a reason for hiding this comment

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

Can we have this class only once ?

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

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

IS it possible to UITEst this change?

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Aug 17, 2025
@PureWeen PureWeen moved this from Changes Requested to Ready To Review in MAUI SDK Ongoing Aug 17, 2025
@PureWeen
Copy link
Member Author

PureWeen commented Aug 17, 2025

IS it possible to UITEst this change?

This change is only relevant really for api36 and notches.

It'd be nice to add tests in ci for this in rc2 or the nearer future

So we can start getting that line of testing setup for api 36

Theoretically running the device tests again api 36 would somewhat validate these changes but we might have to account for other differences

Right now api36 is totally broken for users which is what this fixes.

@PureWeen
Copy link
Member Author

@rmarinho i ran this locally against API 36 and all the tests passed in our device tests

So I think we can be pretty confident these changes will restore expected behavior for api 36 devices

image

Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

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

We need to maybe create specific UITest for API36 since safe areas seems to be a wide feature set.

@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Aug 18, 2025
@rmarinho rmarinho merged commit 2d2ef85 into net10.0 Aug 18, 2025
130 checks passed
@rmarinho rmarinho deleted the fix-edge-to-edge branch August 18, 2025 11:12
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Aug 18, 2025
@PureWeen PureWeen added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Sep 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter p/0 Current heighest priority issues that we are targeting for a release.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants