Repository navigation
[Android] Fix scrolling performance in shadowed containers - #37291
Merged
Merged
Conversation
Limit shadow wrapper redraws to invalidations from the immediate child so scrolling descendants do not redraw entire shadowed containers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e5a1e61b-7ba7-4459-b224-6f22fc178755
kubaflo
temporarily deployed
to
copilot-pat-pool
August 10, 2026 21:57 — with
GitHub Actions
Inactive
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
kubaflo
temporarily deployed
to
copilot-pat-pool
August 10, 2026 21:58 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
August 10, 2026 21:58 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
August 10, 2026 22:00 — with
GitHub Actions
Inactive
kubaflo
had a problem deploying
to
copilot-pat-pool
August 10, 2026 22:01 — with
GitHub Actions
Failure
kubaflo
temporarily deployed
to
copilot-pat-pool
August 10, 2026 22:01 — with
GitHub Actions
Inactive
This was referenced Aug 11, 2026
Contributor
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Contributor
Author
|
/backport to main |
Contributor
Author
|
/backport to release/10.0.1xx-sr10 |
Contributor
|
Started backporting to |
Contributor
|
Started backporting to |
This was referenced Aug 11, 2026
kubaflo
added a commit
that referenced
this pull request
Aug 11, 2026
…ed containers (#37312) <!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! Backport of #37291 to `release/10.0.1xx-sr10`. /cc @kubaflo Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo
added a commit
that referenced
this pull request
Aug 11, 2026
…7313) <!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! Backport of #37291 to `main`. /cc @kubaflo Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
This was referenced Aug 18, 2026
This branch was previously deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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!
Root Cause
#35623 made
PlatformWrapperView.onDescendantInvalidated()callinvalidate()for every descendant update whenever the wrapper had a shadow. That keeps an immediate child animation such as a shadowedSwitchin sync, but it also makes scrolling descendants redraw the entire shadowed container for every item update.The complete reproduction from MrLazyLee/ScrollPerformance has two large shadow wrappers around the
CollectionView:Border.Instrumentation over four up/down scroll cycles recorded:
The current code therefore forces thousands of full-popup redraws even though only five invalidations originate from the immediate children whose shadows may need to move.
Description of Change
Only invalidate a shadow wrapper when Android reports that the invalidation target is its immediate child (
child == target). Deeper descendants continue to redraw through their own RenderNodes without forcing the whole shadowed ancestor to re-record its display list.This preserves the #35623 behavior for controls such as
Switch, while removing the scrolling regression for nestedCollectionViewandScrollViewcontent.Verification
The author reproduction was built with the exact 10.0.90 source and the same locally-built native AAR for both control and patched runs. Each row below used the same emulator and automated eight-cycle scroll sequence without screen recording:
The patched result returns to the 10.0.80 range. The Android Core
Viewdevice-test category also passes: 76 run, 74 passed, 2 ignored, 0 failed. A focused test verifies that an immediate child still invalidates a shadow while a deeper descendant does not.Videos
10.0.80 baseline
ScrollPerformance-10.0.80-evidence.mp4
10.0.90 regression
ScrollPerformance-10.0.90-regression.mp4
10.0.90 with this fix
ScrollPerformance-10.0.90-fixed.mp4
Issues Fixed
Fixes #37281
Regressed by #35623.