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

Conversation

@stuartmorgan-g
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g commented Aug 8, 2022

Allows for the new Android platform view mode introduced in Flutter 3.0 (tentatively called Texture Layer Hybrid Composition) to fall back—when explicitly requested—to Hybrid Composition rather than Virtual Display when TLHC mode is not supported. This allows us to avoid the issue introduced in Flutter 3.0 where a plugin that previously used HC will now use VD in some cases, which would not be the plugin author's intent since they had explicitly chosen the initialization mode that was for HC in Flutter 2.x.

In order to support this, the internals of creation of each mode have been extracted to helper methods, to allow for delegation, and the use of a mutable wrapper context is now unconditional as we now no longer know if we will need it until after the context has been provided to the plugin's factory method; we just don't ever set the underlying context to anything else in the cases where it's not needed.

This is the engine portion of flutter/flutter#107313
Framework portion: flutter/flutter#109161

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.

@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 (don't just cc him here, he won't see it! He's on Discord!).

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.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft August 8, 2022 16:10
@stuartmorgan-g
Copy link
Contributor Author

@bparrishMines @dnfield This is a WIP since I still need to add tests, but I wanted to post it to get initial feedback on the approach.

return temp;
}

List<int> _encodeString(String value) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just a drive-by improvement since I accidentally mismatched the strings in the .length and utf8.encode lines when I added a new string, so I thought I'd prevent the whole class of mistake once I realized what I'd done wrong.

@stuartmorgan-g stuartmorgan-g marked this pull request as ready for review September 9, 2022 19:54
@stuartmorgan-g
Copy link
Contributor Author

stuartmorgan-g commented Sep 9, 2022

The new golden tests I added have somewhat odd visual output where the top of the platform view square is white and the bottom is pale grey, instead of the whole square being pale grey like most of the other outputs from this suite of tests. I'm not sure why (and whether it's a problem with the manual composition these tests do, or a real issue with HC + SurfaceView), but since it's the same for both the "HC with SurfaceView" and "fallback from TLHC to HC with SurfaceView" tests I added, I decided to just go ahead with landing them since it means it's not specific to the new fallback logic.

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 11.
View them at https://flutter-engine-gold.skia.org/cl/github/35233

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 12.
View them at https://flutter-engine-gold.skia.org/cl/github/35233

@skia-gold
Copy link

Gold has detected about 1 new digest(s) on patchset 13.
View them at https://flutter-engine-gold.skia.org/cl/github/35233

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 12, 2022
@auto-submit auto-submit bot merged commit a59351f into flutter:main Sep 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 12, 2022
cfontas pushed a commit to cfontas/engine that referenced this pull request Sep 14, 2022
Oleh-Sv pushed a commit to Oleh-Sv/engine that referenced this pull request Sep 28, 2022
stuartmorgan-g added a commit to stuartmorgan-g/engine that referenced this pull request Oct 14, 2022
Bypasses the step of wrapping the `Context` provided to the platform
view factory when Hybrid Composition has been requested (i.e., when
using `initExpensiveAndroidView`). This was added to the Hybrid
Composition codepath in flutter#35233
when the creation flow was unified; it was intended to be a no-op for
HC, but turns out not to have been, as described in
flutter/flutter#113449

This effectively reverts just the HC-specific part of
flutter#35233 without affecting the other
codepaths (so doesn't require reverting other changes built on that for
TLHC mode).

Fixes b/249389618
See also flutter/flutter#113449
stuartmorgan-g added a commit to stuartmorgan-g/engine that referenced this pull request Oct 14, 2022
Bypasses the step of wrapping the `Context` provided to the platform
view factory when Hybrid Composition has been requested (i.e., when
using `initExpensiveAndroidView`). This was added to the Hybrid
Composition codepath in flutter#35233
when the creation flow was unified; it was intended to be a no-op for
HC, but turns out not to have been, as described in
flutter/flutter#113449

This effectively reverts just the HC-specific part of
flutter#35233 without affecting the other
codepaths (so doesn't require reverting other changes built on that for
TLHC mode).

Fixes b/249389618
See also flutter/flutter#113449
stuartmorgan-g added a commit to stuartmorgan-g/engine that referenced this pull request Oct 14, 2022
Bypasses the step of wrapping the `Context` provided to the platform
view factory when Hybrid Composition has been requested (i.e., when
using `initExpensiveAndroidView`). This was added to the Hybrid
Composition codepath in flutter#35233
when the creation flow was unified; it was intended to be a no-op for
HC, but turns out not to have been, as described in
flutter/flutter#113449

This effectively reverts just the HC-specific part of
flutter#35233 without affecting the other
codepaths (so doesn't require reverting other changes built on that for
TLHC mode).

Fixes b/249389618
See also flutter/flutter#113449
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants