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

Conversation

@0xZOne
Copy link
Member

@0xZOne 0xZOne commented Jul 12, 2023

In the add-to-app scenario where multiple FlutterViews share the same FlutterEngine, the host application desires to determine the timing of attaching the FlutterView to the engine, for example, during the onResume instead of the onCreateView.

As an example, consider the following scenario: A native page contains multiple tabs, and each tab is a FlutterFragment. During initialization, FlutterFragments of different tabs are created almost simultaneously, but only the one that needs to be displayed currently requires attachment to the engine, while the others need to be attached only when they receive the |onResume| callback.

Partial fix: flutter/flutter#130235

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.

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

@0xZOne 0xZOne force-pushed the task/attach_manually branch from 00113e0 to 5d6df6d Compare July 12, 2023 08:07
@0xZOne 0xZOne marked this pull request as draft July 12, 2023 08:08
@0xZOne 0xZOne force-pushed the task/attach_manually branch 4 times, most recently from 4715230 to cd00b2c Compare July 12, 2023 10:08
@0xZOne 0xZOne marked this pull request as ready for review July 12, 2023 10:53
@0xZOne 0xZOne force-pushed the task/attach_manually branch from cd00b2c to 4e6d85f Compare July 13, 2023 09:36
@chinmaygarde
Copy link
Member

cc @reidbaker to find a reviewer.

@0xZOne
Copy link
Member Author

0xZOne commented Jul 22, 2023

@johnmccutchan Please take a look at it when you have a chance. Many thanks.

@chinmaygarde
Copy link
Member

Triage: The comments on the linked issue seem to indicate that underlying issue had a workaround. Is this PR stale?

@0xZOne
Copy link
Member Author

0xZOne commented Aug 13, 2023

Triage: The comments on the linked issue seem to indicate that underlying issue had a workaround. Is this PR stale?

No, it's not stale. I'm still waiting on a code review.

* <p>Defaults to {@code false}.
*/
@Override
public boolean shouldAttachToEngineManually() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we flip this to be:

attachToEngineAutomatically() {
return true;
}

?

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@0xZOne 0xZOne force-pushed the task/attach_manually branch from b160ec8 to 5c9eb7d Compare August 15, 2023 03:36
@0xZOne 0xZOne requested a review from johnmccutchan August 15, 2023 04:47
@0xZOne 0xZOne force-pushed the task/attach_manually branch from 4a50c88 to a0e86de Compare August 15, 2023 05:37
@0xZOne 0xZOne added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 16, 2023
@auto-submit auto-submit bot merged commit 3dc86ef into flutter:main Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 16, 2023
fluttermirroringbot pushed a commit to flutter/flutter that referenced this pull request Aug 16, 2023
…132618)

flutter/engine@659cdfc...decaccf

2023-08-16 [email protected] Roll Fuchsia Mac SDK from 7iuIq3PsSkuCmuEMr... to Zp9or9YwxZHHPeQbA... (flutter/engine#44747)
2023-08-16 [email protected] Move cache builders to prod. (flutter/engine#44739)
2023-08-16 [email protected] Enabling the host application to control the timing of attaching the |FlutterView| to the engine (flutter/engine#43595)
2023-08-16 [email protected] Roll Skia from 9fc1c628456a to 3d2b84e28e79 (1 revision) (flutter/engine#44746)
2023-08-16 [email protected] Roll Dart SDK from b36934aae968 to e6bf503b36fe (1 revision) (flutter/engine#44745)
2023-08-16 [email protected] [Skia] Only respect ui.Paint.dither when the colorSource is a gradient (flutter/engine#44730)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from 7iuIq3PsSkuC to Zp9or9YwxZHH

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
…|FlutterView| to the engine (flutter#43595)

In the add-to-app scenario where multiple FlutterViews share the same FlutterEngine, the host application desires to determine the timing of attaching the FlutterView to the engine, for example, during the `onResume` instead of the `onCreateView`.

As an example, consider the following scenario: A native page contains multiple tabs, and each tab is a FlutterFragment. During initialization, FlutterFragments of different tabs are created almost simultaneously, but only the one that needs to be displayed currently requires attachment to the engine, while the others need to be attached only when they receive the |onResume| callback.

Partial fix: flutter/flutter#130235

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
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.

[Android][add_to_app] Limited Support for Sharing the Same Engine Across Multiple FlutterViews

3 participants