-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[iOS] Avoid keyboard animation jank and laggy on Promotion devices. #34871
Conversation
…keyboard animation link refresh rate using new interface
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. |
Tests has added. |
@cyanglaz could you take a look? |
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating it to use vsync client. Let's also mention the purpose of using vsync client in the PR description.
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/VsyncWaiterIosTest.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest_mrc.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest_mrc.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
Outdated
Show resolved
Hide resolved
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@gaaclarke Do you mind giving a secondary review?
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
Outdated
Show resolved
Hide resolved
I think this PR is more suitable for this desc: |
And If you want to run locally to test the benefit. You can use this demo code😄 You can test according to this: The comparison is very obvious. |
Hi @gaaclarke @cyanglaz |
Hi @gaaclarke @cyanglaz This PR is to mainly avoid the keyboard animation junk and laggy on Promotion devices (eg:iPhone13Pro) The visual glitch in flutter/flutter#105687 . I think it is due to the cause below probably: So why's this visual glitch related with this PR? In brief, this PR is to mainly avoid the keyboard animation junk and laggy, and will reduce the visual glitch..... Before ,I wanted to show you a video that can show the difference before and after applying this PR. |
@luckysmg Great work. I guess this PR is most important for improving frame rate performance on devices with promotions so far.
IMHO, we don't need to pause |
@rotorgames Oh yeah, I'll also take a look that problem you said. |
Here is the corresponding flutter framework ref to run locally: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on my iPhone 13 pro and the Jank is gone with this fix.
@luckysmg Thank you!
@gaaclarke Do you mind to take another look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM =)
The issue with keyboard animation on flutter is also that the curve is different from native. It is strange that nodoby mentioned this so far but it seems I couldnt find an open issue for that. Native video below: IMG_5074.MOV |
As from video above, keyboard and textfield move up almost in sync. While in flutter they are not in sync and visual result looks weird to the end user |
See |
Hello @luckysmg , Thank you for the PR. Is this feature merged to latest stable flutter version(3.3.9)? |
No, but it should be in beta channel |
This is available in 3.4.0-17.0.pre, see https://github.com/flutter/flutter/wiki/Where's-my-Commit%3F#finding-the-framework-commit-that-contains-engine-commit-x |
@jmagman oh I didn't know how to check the corresponding version. Thanks for the reference! |
If use
CADisplaylink
directly, the refresh rate ofCADisplaylink
is not correctIt doesn't match the refresh using for flutter rendering, and this will cause some junk and laggy when start keyboard animation.
So using
VsyncClient
will fix this (SeeVsyncClient.setMaxRefreshRateIfEnabled
)List which issues are fixed by this PR. You must list at least one issue.
flutter/flutter#109435
Pre-launch Checklist
writing and running engine tests.
///
).