Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@2ZeroSix
Copy link

@2ZeroSix 2ZeroSix commented Mar 31, 2021

Fixed rendering of single widget in multiple overlays on top of each hybrid composition PlatformView

I wasn't able to come up with any meaningful test for this scenario (besides snapshot test on android device), would appreciate any help here.

reproduction examples:

simple case in multiple_overlays branch (from original issue): https://github.com/2ZeroSix/flutter_android_surface_activity_destroy_bug_example/tree/multiple_overlays

screenshots
1 view 2 views
before
after

complex case in multiple_scrollable_overlays branch: https://github.com/2ZeroSix/flutter_android_surface_activity_destroy_bug_example/tree/multiple_scrollable_overlays

videos

before

FILE.2021-03-31.13.00.57.mp4

after

FILE.2021-03-31.13.01.14.mp4

List which issues are fixed by this PR. You must list at least one issue.
fixes flutter/flutter#79371

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.
  • The reviewer has submitted any presubmit flakes in this PR using the engine presubmit flakes form before re-triggering the failure.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

if (overlay_layers.at(view_id).empty()) {
overlay_layers.at(view_id).push_back(intersection_rect);
} else if (intersection_rect.contains(
overlay_layers.at(view_id).back())) {
Copy link

Choose a reason for hiding this comment

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

I was expecting the overlay layers to be associated with two different view_ids since there are two platform views, and the fab button intersects both.

Do you mind verifying why a single view_id contain the two overlay surfaces?

@blasten
Copy link

blasten commented Mar 31, 2021

For testing, we use the scenario app. https://github.com/flutter/engine/blob/master/testing/scenario_app/README.md#running-for-android.

The tests are in https://github.com/flutter/engine/blob/master/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java.

Thanks for the contribution, and let me know if you encounter any issue.

@2ZeroSix
Copy link
Author

2ZeroSix commented Apr 1, 2021

@blasten I updated bug reproduction example https://github.com/2ZeroSix/flutter_android_surface_activity_destroy_bug_example/tree/multiple_scrollable_overlays

I found strange behavior (like a race condition) when view should jump between overlay and background layers

To fix this I just added empty fullscreen platform view.
And now I don't understand what's going on at all 🙃

video

background android view is disabled: flutter views in listview might get clipped in region of transition between background and overlay layers
background android view is enabled: everything works as expected in this pr

master:

FILE.2021-04-01.14.25.36.mp4

this pr:

FILE.2021-04-01.14.33.31.mp4

@chinmaygarde
Copy link
Member

Do we understand the issue and/or are we making progress?

@blasten
Copy link

blasten commented Apr 8, 2021

@chinmaygarde Hard to say without debugging it. I will take a look shortly.

@chinmaygarde
Copy link
Member

@blasten Is this still on your plate? Is there someone else we can find to review this patch?

@blasten
Copy link

blasten commented Apr 16, 2021

@2ZeroSix I took a closer look, and this seems reasonable. Can you add some unit tests for each of the code branches?

@chinmaygarde
Copy link
Member

Any updates on the unit-tests?

@blasten
Copy link

blasten commented Apr 23, 2021

Thanks for the contribution. I will take this bug, and add the tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

widgets are rendered for every PlatformView with hybrid composition

3 participants