Repository navigation
Fix crash when do multifinger gesture in XiaoMi or Huawei - #82013
haohongwei wants to merge 1 commit into
Conversation
When three finger moving in some android mobile(XiaoMi or Huawei), the MIUI in XiaoMi or EMUI in Huawei will cancel some of the finger moving. Then if flutter get the pointer cancel event ,it should remove the pointer which is canceled instead of cancel all the pointer.
|
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. 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. |
|
Can you add a test to prevent future regressions? |
|
This is not a fix, but a workaround. As already discussed in #69431, a fix inside the engine is needed. For reference, see @Hixie's comment here: #78874 (comment) |
|
I don't think we should check in workarounds. Let's just fix the real problem. |
Thank you for all of the people who reply about my commit. I still think the original code about cancel pointer may have problem. |
|
I am going to close this one since this is the wrong place for the fix (see discussion above). |
|
I think this is the correct fix. The framework also treats CANCEL and UP similarly, although I didn't check for all cases. |
|
@haohongwei thanks for the PR. #69431 is marked as P2 - this means is likely blocking customers. Any chance you could add tests? |
| pointerProperties.clear(); | ||
| usedAndroidPointerIds.clear(); | ||
| downTimeMillis = null; | ||
| pointerPositions.remove(event.pointer); |
There was a problem hiding this comment.
nit: consider reducing the duplicated logic
|
I have posted PR #84257 to continue the test work. |
Fixes #69431
When three finger moving in some android mobile(XiaoMi or Huawei), the MIUI in XiaoMi or EMUI in Huawei will cancel some of the finger moving. Then if flutter get the pointer cancel event ,it should remove the pointer which is canceled instead of cancel all the pointer.
When user moving three fingers in a webview which is shown on webview_flutter in Huawei or XiaoMi , there is an error in logcat, and the webview can not handle any touches any more:
I/flutter: Null check operator used on a null value
#0 _AndroidMotionEventConverter.toAndroidMotionEvent (package:flutter/src/services/platform_views.dart:605:31)
#1 AndroidViewController.dispatchPointerEvent (package:flutter/src/services/platform_views.dart:873:31)
#2 _PlatformViewGestureRecognizer.handleEvent (package:flutter/src/rendering/platform_view.dart:535:26)
#3 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12)
#4 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:122:9)
#5 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8)
#6 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)
#7 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)
#8 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:358:19)
#9 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart
After change the cancel method in platform_view.dart this error disappear, and webview can handle all the touches.
Fix crash when do three finger gesture #72611
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.