engine icon indicating copy to clipboard operation
engine copied to clipboard

[ios][platform_view]force reset forwarding recognizer state when its stuck

Open hellohuanlin opened this issue 1 year ago • 6 comments

This PR force reset forwarding recognizer state when it's stuck at failed state, by recreating the recognizer (we are not able to reset the state back to possible - it has to be reset by UIKit).

This is a tricky one since pencil and finger triggers exactly the same callbacks. It turns out that when pencil is involved after finger interaction, the platform view's "forwarding" gesture recognizer is stuck at failed state. This seems to be an iOS bug, because according to the API doc, it should be reset back to "possible" state:

No action message is sent and the gesture recognizer is reset to UIGestureRecognizerStatePossible.

However, when iPad pencil is involved, the state is not reset. I tried to KVO the state property, and wasn't able to capture the change. This means the state change very likely happened internally within the recognizer via the backing ivar of the state property.

Fixes https://github.com/flutter/flutter/issues/136244

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I signed the CLA.
  • [x] All existing and new tests are passing.

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

hellohuanlin avatar Oct 18 '24 18:10 hellohuanlin

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!).

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. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

flutter-dashboard[bot] avatar Oct 18 '24 18:10 flutter-dashboard[bot]

Tested the demo app from github issue and confirmed it's working. I will do more testing before landing it.

hellohuanlin avatar Oct 18 '24 18:10 hellohuanlin

Verified both google map and web view plugin example apps still work as expected.

hellohuanlin avatar Oct 22 '24 03:10 hellohuanlin

@tdevaux confirmed this fixes the issue

polina-c avatar Oct 22 '24 14:10 polina-c

I don't know if change would impact it, but can you confirm the totally-not-running-anywhere iPad gesture tests still pass? https://github.com/flutter/engine/blob/4e6405e2a89fa8fda2c0e7017ddcd8b39d7b3052/testing/scenario_app/ios/Scenarios/ScenariosUITests/iPadGestureTests.m

I got all of them failed with main branch on simulator. Let me try physical devices.

hellohuanlin avatar Oct 22 '24 21:10 hellohuanlin

I got all of them failed with main branch on simulator. Let me try physical devices.

Don't worry about it, we can investigate later and get them passing and running somewhere. Let's merge this! 🙂

jmagman avatar Oct 23 '24 03:10 jmagman

I was able to run on device and got the same failure as simulator. Filed https://github.com/flutter/flutter/issues/157454

hellohuanlin avatar Oct 23 '24 17:10 hellohuanlin

auto label is removed for flutter/engine/55958, due to - The status or check suite Mac mac_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label.

auto-submit[bot] avatar Oct 23 '24 18:10 auto-submit[bot]