-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Remove edge to edge from top level container #31193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
WindowsListenerclass that implementsIOnApplyWindowInsetsListenerto 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.
| // - 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 |
There was a problem hiding this comment.
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 ?
rmarinho
left a comment
There was a problem hiding this 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?
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. |
|
@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
|
rmarinho
left a comment
There was a problem hiding this 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.

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
WindowsListenerclass 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
WindowsListenerclass implementingIOnApplyWindowInsetsListenerto multiple handlers (ShellFlyoutTemplatedContentRenderer,ShellSectionRenderer,FlyoutViewHandler, andWindowHandler) to adjust padding/margins and prevent content from being covered by system bars or display cutouts. [1] [2] [3] [4]Integrated
ViewCompat.SetOnApplyWindowInsetsListenercalls 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:
AndroidX.Core.Viewand related using statements to ensure compatibility with the new window insets APIs. [1] [2] [3] [4]Legacy system windows handling removal:
SetFitsSystemWindows(true)call fromShellRendererto 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