Repository navigation
UI: Respect system insets and refresh forced-scale projection geometry - #1211
Open
emotionbug wants to merge 3 commits into
Open
emotionbug wants to merge 3 commits into
emotionbug wants to merge 3 commits into
Conversation
emotionbug
force-pushed
the
pr/android15-system-insets
branch
from
October 28, 2026 09:57
c7470ac to
275ef77
Compare
emotionbug
marked this pull request as draft
October 28, 2026 10:37
emotionbug
force-pushed
the
pr/android15-system-insets
branch
2 times, most recently
from
October 28, 2026 11:14
a20e9ad to
a8df06a
Compare
emotionbug
marked this pull request as ready for review
October 28, 2026 15:51
Handle fullscreen mode None explicitly when both the runtime and target SDK are at least 35. Enforced edge-to-edge layout no longer lets this mode rely on decor fitting alone, so the root owns its system padding instead of returning before applying the insets. Keep automatic fitting for older runtimes or targets and leave immersive and status-only selection unchanged. Fit the union of visible system bars, display cutouts and the keyboard. These sources can overlap on the same edge, so they are not added together. Apply each manual margin once on top of that union, report the same padding to HeadUnitScreenConfig, and consume the handled insets so descendants do not fit the same area again. Refresh the remembered projection canvas when bar or cutout insets change without changing the outer content bounds. Do not persist keyboard-reduced space as a new projection size. Preserve the existing canvas and legacy-fitting explanations, and add comments for the ownership and overlap rules.
Publish the current window canvas together with its insets before scale or margin callbacks can reenter screen initialization. A fullscreen override or visible-bar change can alter the drawable area without changing the stored settings or outer window bounds. Retire surface measurements belonging to the previous window geometry so forced-scale SurfaceView/FILL cannot restore an oversized view after the root reserves system-bar space. Restore the full canvas when leaving normal mode, while retaining valid surface precedence for an unchanged window and preserving the active session's negotiated video size. Remember which settings produced the reported insets. A scale callback initializing those same settings must keep the fresh system padding instead of replacing it with manual-only margins. Exclude side-docked as well as top/bottom keyboard space from permanent canvas measurements, and keep non-projection windows from publishing projection geometry. Explain the ownership boundaries in code.
Restrict global projection-inset updates to windows that own the projection canvas. Settings and other non-projection windows still apply their local padding and callbacks, but opening their keyboard cannot shrink a later projection measurement. Tag inset reports with the reporting window's effective orientation rather than the previously initialized canvas orientation. This preserves system bar insets delivered before the first screen initialization or before a new orientation is resolved, instead of replacing them with manual-only padding. Retain orientation-sensitive canvas invalidation and the existing handling of local fullscreen overrides, keyboard padding and forced-scale surfaces.
emotionbug
force-pushed
the
pr/android15-system-insets
branch
from
October 28, 2026 16:12
db54e1d to
129e49f
Compare
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.
Normal screen mode on Android 15+
With target SDK 35+, Android 15 and newer enforce edge-to-edge layout.
SystemUIpreviously relied on automatic window fitting for fullscreen mode None and returned before applying system insets, allowing content to sit behind the bars.For the enforced edge-to-edge case, fit the union of system bars, display cutout and keyboard insets explicitly, then add manual margins once. Keep the existing automatic fitting on older runtimes/targets and preserve immersive/status-only inset selection.
Projection geometry across inset changes
Publish the resulting projection canvas together with its insets before scale and margin callbacks run. A fullscreen override or visible-bar change can alter the drawable area without changing the stored settings or outer window bounds. Retire a surface measurement belonging to the previous window geometry so forced-scale SurfaceView/FILL cannot restore an oversized view. Returning to immersive mode restores the full drawable area without renegotiating the active video size; unchanged windows retain their valid surface measurements.
Preserve the insets already reported for the current settings when scaling reenters screen initialization. Tag that report with the reporting window’s effective orientation, so the first initialization or a newly resolved orientation does not erase bars that have already arrived.
Do not save keyboard-reduced space, including side-docked keyboards, as a permanent projection canvas. Non-projection windows apply their own padding without publishing either projection measurements or global projection insets. Opening the settings keyboard therefore cannot shrink the projection through a later layout callback.
Platform background: Android edge-to-edge and inset handling.