-
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
Android Platform Views support Verified Input Events #49268
Android Platform Views support Verified Input Events #49268
Conversation
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 "@text-exemption-reviewers" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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. |
babac33
to
f6ba24f
Compare
3bb27d5
to
663b7ce
Compare
test-exempt: Test will be checked into the flutter repository. |
663b7ce
to
ad80399
Compare
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, just left a question concerning my own understanding
shell/platform/android/io/flutter/embedding/android/MotionEventTracker.java
Outdated
Show resolved
Hide resolved
// We are in virtual display mode or don't have a reference to the original MotionEvent. | ||
// In this case we manually recreate a MotionEvent to be delivered. This MotionEvent | ||
// will fail the verifiable input check. | ||
|
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.
What are the cases are where we don't have the original event if virtual display isn't being used (if we know them)? And why won't we have it when virtual display is used? Do these cases warrant warning users here?
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.
IIUC, the only case where this will happen (when not using virtual display) is when a gesture detector runs and creates new events related to the detected gesture.
1. MotionEvent is captured and delivered to PlatformViewWrapper.onTouchEvent (TLHC) or FlutterMutatorView.onTouchEvent (HC) 2. MotionEvent is transformed by the AndroidTouchProcessor into a PointerEvent 3. AndroidTouchProcessor sends the PointerEvent over the PlatformViewChannel 4. Framework processes the PointerEvent 5. Framework sends the PointerEvent over the PlatformViewChannel. 6. in PlatformViewsController.onTouch a new MotionEvent is synthesized 7. The MotionEvent is delivered to the platform view After step (6) the MotionEvent will fail Verification (android.hardware.input.InputManager.verifyInputEvent). The fix requires that in step (6) we use the original motion event delivered in step (1) instead of synthesizing a new instance.
ad80399
to
b2de306
Compare
…140824) flutter/engine@9d89f87...b02d59a 2024-01-02 [email protected] Android Platform Views support Verified Input Events (flutter/engine#49268) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[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
This is an integration test associated with flutter/engine#49268
Reverts #140806 Initiated by: zanderso This change reverts the following previous change: Original Description: This is an integration test associated with flutter/engine#49268
Fixes flutter/flutter#146570, which tracks a regression from #49268 regarding platform view inputs in some specific cases. This PR translates the input event location to be the same as the location we calculated before #49268, returning to the previous behavior, while maintaining the input event's verified status (I checked this manually with the `InputManager`). Tested manually with the reproduction in the linked issue. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Fixes flutter/flutter#146570, which tracks a regression from flutter#49268 regarding platform view inputs in some specific cases. This PR translates the input event location to be the same as the location we calculated before flutter#49268, returning to the previous behavior, while maintaining the input event's verified status (I checked this manually with the `InputManager`). Tested manually with the reproduction in the linked issue. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Android Platform Views process MotionEvents in a complicated way:
After step (6) the MotionEvent will fail Verification (
android.hardware.input.InputManager.verifyInputEvent
).The fix requires that in step (6) we use the original motion event delivered in step (1) instead of synthesizing a new instance.