Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reland: iOS Background Platform Channels (#29665) #30697

Merged
merged 3 commits into from
Jan 12, 2022

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Jan 5, 2022

This relands the iOS Background Platform Channels with a fix.

commits:

fixes flutter/flutter#91635
see also: b/209604261

The internal bug mentions "MissingPluginException"s being thrown after this PR had landed. That means that the message handler hasn't been sent by the time the message is sent from Flutter. I suspect that is because they are setting the message handlers during setup after the Dart isolate has actually been launched. That means messages can start being sent immediately from Flutter on the UI thread and the handler hasn't been set yet. By virtue of previously handling all platform messages on the platform thread that would allow people to set message handlers later in the event where the engine is run, which while wasn't intended usage, was something we supported. This supports that usage with background platform channels.

It is also possible they just have a race in their code where they are setting the message handler at an arbitrary time after the engine is run. That's probably unlikely since they would see sometimes MissingPluginExceptions without this change.

I was unable to verify for myself with the google app unfortunately because of b/213948589.

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.

@gaaclarke
Copy link
Member Author

@zanderso maybe we want to wait for the fix for flutter/flutter#95623?

@gaaclarke gaaclarke marked this pull request as draft January 5, 2022 22:28
@gaaclarke gaaclarke removed the request for review from zanderso January 5, 2022 22:28
@gaaclarke gaaclarke marked this pull request as ready for review January 11, 2022 23:52
@gaaclarke gaaclarke requested a review from dnfield January 11, 2022 23:52
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM

@dnfield
Copy link
Contributor

dnfield commented Jan 12, 2022

@jmagman fyi

@gaaclarke gaaclarke merged commit bdbd075 into flutter:main Jan 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 12, 2022
JsouLiang pushed a commit to JsouLiang/engine that referenced this pull request Jan 14, 2022
* iOS Background Platform Channels (flutter#29665)

* added test that passes before this change, and fails after it

* started supporting backwards compatible usage of setting handlers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Background Platform Channels
2 participants