Skip to content

[net11] Fix Android screenshot cropping using reported status bar height - #39545

Merged
kubaflo merged 9 commits into
dotnet:net11.0from
Ahamed-Ali:ahamed-ali-android-screenshot-cropping
Oct 24, 2026
Merged

kubaflo merged 9 commits into
dotnet:net11.0from
Ahamed-Ali:ahamed-ali-android-screenshot-cropping

Conversation

@Ahamed-Ali

@Ahamed-Ali Ahamed-Ali commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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 retrieve statusBar.height and crop the screenshot using the device-reported height instead of the hard-coded 60/112 values. This removes the entire status-bar region without changing edge-to-edge behavior. Explicit cropTop overrides, bottom cropping, and other platforms remain unchanged.

Existing baselines must be recropped or regenerated where the corrected crop changes image dimensions.

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>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39545

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39545"

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 22, 2026
@azure-pipelines

This comment has been minimized.

@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 22, 2026
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please modify this PR to include #36226 because I reverted it

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>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 05:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The shared Android screenshot change needs device validation and confirmation of baseline compatibility; neither was available in the supplied evidence.

No open issues 🎉

Review effort: Balanced

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>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 05:56
@sheiksyedm

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Configuration changes can overwrite explicit status-bar theme selections without restoring them.

2 open issues

Review effort: Balanced

// 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>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 10:42
@kubaflo

kubaflo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Resolved and pushed the conflict with the current net11.0 tip (22fc4de8a80) in ordinary merge commit 3789d5df5bd, on the original PR branch.

The sole conflict was android/ShellBackgroundSupportsGradientBrush.png. The PR's recropped image predates #37137 and lacks the updated bottom-tab gradient. Kept the latest target baseline's visual content and removed its top three rows to match this PR's 1080×1732 baseline dimensions. All retained RGB pixels were verified identical to that crop of the target image; this is a deterministic baseline reconciliation, not a newly captured or runtime-certified screenshot. The PR's crop logic is unchanged.

Validation: the managed Android UI-test assembly compiled with zero warnings/errors using dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -v:minimal. No native/device UI tests, screenshot captures or XCTest were run; CI must confirm the recropped baseline against actual rendering.

@kubaflo
kubaflo merged commit f95b36b into dotnet:net11.0 Oct 24, 2026
4 of 14 checks passed
@github-actions github-actions Bot added this to the .NET 11.0-rc2 milestone Oct 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Configuration-change handling can overwrite explicit status-bar themes and clear custom system-bar backgrounds.

4 open issues

Review effort: Balanced

// 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);
kubaflo added a commit that referenced this pull request Oct 29, 2026
#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>
kubaflo pushed a commit that referenced this pull request Oct 29, 2026
### 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-review-in-progress AI review is currently running for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants