Repository navigation
[net11] Fix Android screenshot cropping using reported status bar height - #39545
Conversation
Use GetSystemBars() instead of fixed Android top-crop values while preserving explicit crop overrides. Document baseline recropping when the reported height differs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39545Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39545" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
|
1 similar comment
|
Bring PR dotnet#39545 up to date with dotnet/maui net11.0 without rewriting its existing commits. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reintroduce the exact changes from dotnet#36226, temporarily reverted by dotnet#39579, alongside the screenshot cropping fix and updated baselines in dotnet#39545. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // re-run. EnableEdgeToEdge does not manage icon appearance, so re-apply it explicitly here. | ||
| if (Window is not null) | ||
| { | ||
| Window.ConfigureTranslucentSystemBars(this); |
| @@ -26,7 +26,7 @@ protected override void OnCreate(Bundle? savedInstanceState) | |||
| : Resource.Style.Maui_MainTheme_NoActionBar); | |||
|
|
|||
| base.OnCreate(savedInstanceState); | |||
| WindowCompat.SetDecorFitsSystemWindows(Window, false); | |||
| WindowCompat.EnableEdgeToEdge(Window); | |||
Preserve the updated Shell gradient tab-bar baseline with the three-pixel top crop used by the screenshot cropping PR. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Resolved and pushed the conflict with the current The sole conflict was Validation: the managed Android UI-test assembly compiled with zero warnings/errors using |
| // Re-apply system bar icon colors on a theme (light/dark) change. The activity declares | ||
| // ConfigChanges.UiMode, so it is not recreated and OnCreate's EnableEdgeToEdge does not | ||
| // re-run. EnableEdgeToEdge does not manage icon appearance, so re-apply it explicitly here. | ||
| if (Window is not null) |
| // re-run. EnableEdgeToEdge does not manage icon appearance, so re-apply it explicitly here. | ||
| if (Window is not null) | ||
| { | ||
| Window.ConfigureTranslucentSystemBars(this); |
#39748) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Revert the native Android edge-to-edge implementation introduced in #36226 and reintroduced in #39545, as it changes previously working modal keyboard-resize behavior and causes Android UI test failures. This restores the previous activity and modal window configuration, fullscreen WebView transitions, system-bar initialization, and edge-to-edge opt-out theme entries. The associated Issue32987 sample and tests are removed. Also removed the screenshot top-cropping logic for now while preserving the existing baseline images. Reverting the fix exposes pixel differences at the bottom, so bottom cropping also needs to be addressed. Top and bottom screenshot cropping will be handled separately in a follow-up later. Issues Fixed Reverts #36226. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change - Resaved the ShellBackgroundColorIsApplied baseline image to match the current rendering on release/11.0.1xx. - The screenshot-cropping changes from PR #39545 ([net11] Fix Android screenshot cropping using reported status bar height) are available in net11.0 but not in release/11.0.1xx. As a result, the generated screenshots differ in dimensions and content positioning between the two branches. - This PR only updates the baseline image. No code changes are included.


Rootcause of the issue
After #36226 enabled consistent edge-to-edge behavior, the default Android status bar became transparent across supported API levels. The screenshot helper’s hard-coded 60-pixel top crop did not fully exclude the status bar, leaving a thin strip visible as the reported 1-pixel line. This strip now shows the background behind the transparent status bar instead of the previous status-bar color, causing mismatches against existing baselines.
Description of change
Use
App.GetSystemBars()to retrievestatusBar.heightand crop the screenshot using the device-reported height instead of the hard-coded60/112values. This removes the entire status-bar region without changing edge-to-edge behavior. ExplicitcropTopoverrides, bottom cropping, and other platforms remain unchanged.Existing baselines must be recropped or regenerated where the corrected crop changes image dimensions.