Skip to content

UI: Respect system insets and refresh forced-scale projection geometry - #1211

Open
emotionbug wants to merge 3 commits into
andreknieriem:mainfrom
emotionbug:pr/android15-system-insets
Open

emotionbug wants to merge 3 commits into
andreknieriem:mainfrom
emotionbug:pr/android15-system-insets

Conversation

@emotionbug

@emotionbug emotionbug commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Normal screen mode on Android 15+

With target SDK 35+, Android 15 and newer enforce edge-to-edge layout. SystemUI previously 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.

@emotionbug
emotionbug force-pushed the pr/android15-system-insets branch from c7470ac to 275ef77 Compare October 28, 2026 09:57
@emotionbug
emotionbug marked this pull request as draft October 28, 2026 10:37
@emotionbug
emotionbug force-pushed the pr/android15-system-insets branch 2 times, most recently from a20e9ad to a8df06a Compare October 28, 2026 11:14
@emotionbug emotionbug changed the title Respect system insets in normal screen mode on Android 15+ UI: Respect system insets and refresh forced-scale projection geometry Oct 28, 2026
@emotionbug
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
emotionbug force-pushed the pr/android15-system-insets branch from db54e1d to 129e49f Compare October 28, 2026 16:12
@o-jcardenass o-jcardenass added the in review the code is complete, and assigned reviewers are actively evaluating it for quality and feedback label Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review the code is complete, and assigned reviewers are actively evaluating it for quality and feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants