Skip to content

[iOS] Inject DisplayLinkManager into FlutterKeyboardInsetManager#189751

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
cbracken:inject-displaylink-manager-2
Jul 21, 2026
Merged

[iOS] Inject DisplayLinkManager into FlutterKeyboardInsetManager#189751
auto-submit[bot] merged 1 commit into
flutter:masterfrom
cbracken:inject-displaylink-manager-2

Conversation

@cbracken

Copy link
Copy Markdown
Member

This is a follow-up to the DisplayLinkManager singleton migration (#189492). FlutterKeyboardInsetManager was reading DisplayLinkManager.shared directly in setUpKeyboardAnimationVsyncClient when passing its VSyncClient's isVariableRefreshRateEnabled and maxRefreshRate, which is effectively using a global.

This wires a DisplayLinkManager through the initializer instead and stores it in an instance var, so that read goes through the injected instance.

I didn't need to touch FakeFlutterKeyboardInsetManager. It's an independent NSObject that conforms to
FlutterKeyboardInsetManagerProtocol and not a subclass, so it never depended on this initializer.

This is a refactoring so introduces no semantic changes. I've updated tests to use the new pattern but there's no new functionality to test.

Issue: #175879
Issue: #181684

Pre-launch Checklist

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

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

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.

This is a follow-up to the DisplayLinkManager singleton migration
(flutter#189492). `FlutterKeyboardInsetManager` was reading
`DisplayLinkManager.shared` directly in `setUpKeyboardAnimationVsyncClient`
when passing its VSyncClient's isVariableRefreshRateEnabled and
maxRefreshRate, which is effectively using a global.

This wires a DisplayLinkManager through the initializer instead and
stores it in an instance var, so that read goes through the injected
instance. 

I didn't need to touch FakeFlutterKeyboardInsetManager. It's an
independent NSObject that conforms to
FlutterKeyboardInsetManagerProtocol and not a subclass, so it never
depended on this initializer.

Issue: flutter#175879
Issue: flutter#181684
@cbracken
cbracken requested a review from a team as a code owner July 21, 2026 00:04
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jul 21, 2026
@github-actions github-actions Bot added platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. team-ios Owned by iOS platform team labels Jul 21, 2026

@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 refactors KeyboardInsetManager to inject DisplayLinkManager via its initializer, replacing direct references to the global DisplayLinkManager.shared singleton. The FlutterViewController and its unit tests are updated to pass the shared instance. Feedback suggests taking advantage of this dependency injection in tests by mocking DisplayLinkManager instead of using the global singleton, which would make the tests hermetic and independent of the host device's display capabilities.

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 21, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Jul 21, 2026
Merged via the queue into flutter:master with commit 69cf0c0 Jul 21, 2026
25 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 21, 2026
@cbracken
cbracken deleted the inject-displaylink-manager-2 branch July 21, 2026 05:38
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 21, 2026
flutter/flutter@cab057d...1ac2e82

2026-07-21 matt.kosarek@canonical.com Add BaseWindowController.isDestroyed flag (flutter/flutter#189061)
2026-07-21 engine-flutter-autoroll@skia.org Roll Dart SDK from 666e1e2133b7 to 3b2f5ad7718d (1 revision) (flutter/flutter#189745)
2026-07-21 engine-flutter-autoroll@skia.org Roll Skia from 3c52d80c960d to 569534e9fa59 (5 revisions) (flutter/flutter#189766)
2026-07-21 engine-flutter-autoroll@skia.org Roll Skia from 11426cf7aaa1 to 3c52d80c960d (2 revisions) (flutter/flutter#189758)
2026-07-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#189760)
2026-07-21 chris@bracken.jp [iOS] Inject DisplayLinkManager into FlutterKeyboardInsetManager (flutter/flutter#189751)
2026-07-21 46920873+gabrimatic@users.noreply.github.com Treat package:stack_trace async-gap marker as asynchronous suspension (flutter/flutter#185791)
2026-07-21 chris@bracken.jp [iOS] Inject DisplayLinkManager into VsyncWaiterIOS (flutter/flutter#189749)
2026-07-20 116356835+AbdeMohlbi@users.noreply.github.com Use String builder in `InputConnectionAdaptorTest.java` (flutter/flutter#189281)
2026-07-20 32538273+ValentinVignal@users.noreply.github.com Fix non-independant tests in draggable_test.dart (flutter/flutter#186898)
2026-07-20 34871572+gmackall@users.noreply.github.com Stop using ReLinker to load libflutter.so on Android 17 (API 37+) (flutter/flutter#189146)
2026-07-20 chris@bracken.jp [et] Refactor gn post-processing, fix minor clang[++] regex match bug (flutter/flutter#189685)
2026-07-20 magder@google.com Take plugin_test_darwin out of bringup (flutter/flutter#189594)
2026-07-20 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#189596)
2026-07-20 47866232+chunhtai@users.noreply.github.com widgets layer re-export ScrollCacheExtent (flutter/flutter#189483)
2026-07-20 engine-flutter-autoroll@skia.org Roll Skia from 47143b6fa402 to 11426cf7aaa1 (7 revisions) (flutter/flutter#189740)
2026-07-20 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#189735)
2026-07-20 jason-simmons@users.noreply.github.com [Impeller] In the AHBTextureSourceVK destructor, do not call Vulkan APIs if the VkDevice has been destroyed (flutter/flutter#189666)
2026-07-20 jameskrupnik@gmail.com Add AutofillHints.emailOTPCode for Android AUTOFILL_HINT_EMAIL_OTP (flutter/flutter#188123)
2026-07-20 jacksongardner@google.com Add a github workflow to remove flutteractionsbot branches after the PRs are merged or closed. (flutter/flutter#189668)
2026-07-20 jason-simmons@users.noreply.github.com Roll ANGLE to cc08479fbcc1 (flutter/flutter#189595)
2026-07-20 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from NL8xtzr8cxr5E8r8E... to GswhlPRO-D1qSNclx... (flutter/flutter#189715)
2026-07-20 engine-flutter-autoroll@skia.org Roll Skia from ba90f98535de to 47143b6fa402 (4 revisions) (flutter/flutter#189721)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
Zubii12 pushed a commit to Zubii12/packages that referenced this pull request Jul 23, 2026
…r#12256)

flutter/flutter@cab057d...1ac2e82

2026-07-21 matt.kosarek@canonical.com Add BaseWindowController.isDestroyed flag (flutter/flutter#189061)
2026-07-21 engine-flutter-autoroll@skia.org Roll Dart SDK from 666e1e2133b7 to 3b2f5ad7718d (1 revision) (flutter/flutter#189745)
2026-07-21 engine-flutter-autoroll@skia.org Roll Skia from 3c52d80c960d to 569534e9fa59 (5 revisions) (flutter/flutter#189766)
2026-07-21 engine-flutter-autoroll@skia.org Roll Skia from 11426cf7aaa1 to 3c52d80c960d (2 revisions) (flutter/flutter#189758)
2026-07-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#189760)
2026-07-21 chris@bracken.jp [iOS] Inject DisplayLinkManager into FlutterKeyboardInsetManager (flutter/flutter#189751)
2026-07-21 46920873+gabrimatic@users.noreply.github.com Treat package:stack_trace async-gap marker as asynchronous suspension (flutter/flutter#185791)
2026-07-21 chris@bracken.jp [iOS] Inject DisplayLinkManager into VsyncWaiterIOS (flutter/flutter#189749)
2026-07-20 116356835+AbdeMohlbi@users.noreply.github.com Use String builder in `InputConnectionAdaptorTest.java` (flutter/flutter#189281)
2026-07-20 32538273+ValentinVignal@users.noreply.github.com Fix non-independant tests in draggable_test.dart (flutter/flutter#186898)
2026-07-20 34871572+gmackall@users.noreply.github.com Stop using ReLinker to load libflutter.so on Android 17 (API 37+) (flutter/flutter#189146)
2026-07-20 chris@bracken.jp [et] Refactor gn post-processing, fix minor clang[++] regex match bug (flutter/flutter#189685)
2026-07-20 magder@google.com Take plugin_test_darwin out of bringup (flutter/flutter#189594)
2026-07-20 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#189596)
2026-07-20 47866232+chunhtai@users.noreply.github.com widgets layer re-export ScrollCacheExtent (flutter/flutter#189483)
2026-07-20 engine-flutter-autoroll@skia.org Roll Skia from 47143b6fa402 to 11426cf7aaa1 (7 revisions) (flutter/flutter#189740)
2026-07-20 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#189735)
2026-07-20 jason-simmons@users.noreply.github.com [Impeller] In the AHBTextureSourceVK destructor, do not call Vulkan APIs if the VkDevice has been destroyed (flutter/flutter#189666)
2026-07-20 jameskrupnik@gmail.com Add AutofillHints.emailOTPCode for Android AUTOFILL_HINT_EMAIL_OTP (flutter/flutter#188123)
2026-07-20 jacksongardner@google.com Add a github workflow to remove flutteractionsbot branches after the PRs are merged or closed. (flutter/flutter#189668)
2026-07-20 jason-simmons@users.noreply.github.com Roll ANGLE to cc08479fbcc1 (flutter/flutter#189595)
2026-07-20 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from NL8xtzr8cxr5E8r8E... to GswhlPRO-D1qSNclx... (flutter/flutter#189715)
2026-07-20 engine-flutter-autoroll@skia.org Roll Skia from ba90f98535de to 47143b6fa402 (4 revisions) (flutter/flutter#189721)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants