Skip to content

[various] Add engineIdentifier to fake plugin registrars - #13574

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
elliette:fix-engine-identifier-registrar
Nov 5, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
elliette:fix-engine-identifier-registrar

Conversation

@elliette

@elliette elliette commented Nov 5, 2026

Copy link
Copy Markdown
Member

flutter/flutter#195881 added a required engineIdentifier property to FlutterBaseRegistrar (iOS) and FlutterPluginRegistrar (macOS), which breaks compilation of the test-only registrar fakes and blocks the Flutter roll (#13569).

Implement the property in each fake in a way that also compiles against stable, where the property does not exist yet.

Fixes flutter/flutter#196065

Pre-Review Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

flutter/flutter#195881 added a required engineIdentifier property to
FlutterBaseRegistrar (iOS) and FlutterPluginRegistrar (macOS), which
breaks compilation of the test-only registrar fakes and blocks the
Flutter roll (flutter#13569).

Implement the property in each fake in a way that also compiles against
stable, where the property does not exist yet.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds the engineIdentifier property or method returning 0 to several test stubs and mock implementations of FlutterPluginRegistrar across multiple packages, including google_maps_flutter, image_picker, in_app_purchase, and webview_flutter. There are no review comments, and I have no feedback to provide.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 5, 2026
@auto-submit
auto-submit Bot merged commit 674067d into flutter:main Nov 5, 2026
12 checks passed
flutter-zl pushed a commit to NemesisDevX/flutter that referenced this pull request Nov 6, 2026
flutter/packages@0478162...63881f9

2026-11-06 [email protected] [material_ui] Paint Dialog.fullscreen
background color behind the keyboard (flutter/packages#13244)
2026-11-05 [email protected] [material_ui] Add tabBar/tab
roles and expanded state semantics (flutter/packages#13176)
2026-11-05 [email protected]
[material_ui] Disable the DropdownButtonFormField decoration when the
field is disabled (flutter/packages#13473)
2026-11-05 [email protected] [material_ui] Fix Switch throwing when first
painted mid-animation (flutter/packages#13496)
2026-11-05 [email protected] [various] Add
engineIdentifier to fake plugin registrars (flutter/packages#13574)
2026-11-05 [email protected] [google_sign_in]
Allow GoogleSignIn-iOS 10 (flutter/packages#13306)
2026-11-05 [email protected] [material_ui] Hit
test the floating label of InputDecorator at its painted position
(flutter/packages#13326)
2026-11-05 [email protected] [material_ui] Fix InputDecorator
intrinsic height when isDense or isC… (flutter/packages#13522)
2026-11-05 [email protected] [material_ui] Paint Scaffold
persistent bottom sheet background color behind the keyboard
(flutter/packages#13242)
2026-11-05 [email protected] [image_picker_ios] PR 5/5 Switch
Pigeon to Swift and finish the Objective-C to Swift migration.
(flutter/packages#13493)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit Bot pushed a commit to flutter/flutter that referenced this pull request Nov 9, 2026
…droid, iOS, and macOS (#196145)

### Issue Link:
#195876

### Impact Description:
Native plugins using JNI/FFI (such as plugins generated with Pigeon's native interop support) register directly in native memory rather than on a per-engine `BinaryMessenger`, and have no non-deprecated public API on `FlutterPluginBinding` (Android) or `FlutterPluginRegistrar` (iOS/macOS) to obtain the engine identifier during plugin attachment and detachment. In apps running multiple `FlutterEngine` instances in the same process (such as background engines alongside the main UI engine), one engine attaching or detaching can overwrite or unregister another engine's JNI/FFI host API instance (#194920). This blocks shipping multi-engine-safe FFI/JNI plugins (flutter/packages#13359) against the 3.50 stable release.

**Scope of the API break:** This supersedes #195991, which was closed as a breaking change. As [@stuartmorgan noted](#195991 (comment)), the `@required` `engineIdentifier` property on `FlutterBaseRegistrar` (iOS) and `FlutterPluginRegistrar` (macOS) only affects hand-written native unit-test fakes that conform to those protocols directly. Production plugin and app code only consumes registrars provided by the engine and is unaffected. Following that, [@zanderso commented](#195991 (comment)) that if the change is safer than the earlier signals indicated, it should be considered for a hotfix release in this cycle. Affected test fakes can add `var engineIdentifier: Int64 = 0` (Swift) or `@synthesize engineIdentifier;` (Objective-C), which compiles both before and after this change. First-party fakes were already updated in flutter/packages#13574. On Android, `FlutterPluginBinding` is a concrete class, so adding `getEngineId()` does not affect mocks.

### Changelog Description:
[flutter/195876] When running multiple `FlutterEngine`s on Android, iOS, or macOS, FFI/JNI plugins could not determine which engine a `FlutterPluginBinding` or `FlutterPluginRegistrar` belonged to.

### Workaround:
On Android, plugins can call the deprecated `FlutterPluginBinding.getFlutterEngine().getEngineId()`. On iOS and macOS, there is no public API workaround (`engineIdentifier` is only declared in internal headers, and the registrar's weak engine reference is already `nil` during `detachFromEngineForRegistrar:`).

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
1. On Android, verify `FlutterPluginBinding.getEngineId()` returns the associated `FlutterEngine.getEngineId()`.
2. On iOS, verify `registrar.engineIdentifier` on `FlutterPluginRegistrar` and `FlutterApplicationRegistrar` matches the owning `FlutterEngine.engineIdentifier`, both during registration and during `detachFromEngineForRegistrar:`.
3. On macOS, verify `registrar.engineIdentifier` on `FlutterPluginRegistrar` matches the owning `FlutterEngine.engineIdentifier`.
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.

[packages] flutter -> packages autoroller failing due to PR #195881

2 participants