From 7f0343f6fc39e84d865d8a5cdbdbeb50b1542247 Mon Sep 17 00:00:00 2001 From: Code Otaku Date: Tue, 19 Dec 2023 13:41:02 +0900 Subject: [PATCH] Makes PlatformViewsController view to use tracked event's action & pointer count (flutter/engine#47424) related issue https://github.com/flutter/flutter/issues/111268, https://github.com/flutter/flutter/issues/106190 ### Motivation: - At https://github.com/flutter/flutter/issues/111268, we found that Android PlatformView scrolls slowly after #34182 commit ### Modification: - Makes `PlatformViewsController` view to use `tracked event`'s action & pointer count ### Result: - Now PlatformView scrolls not slowly - Close https://github.com/flutter/flutter/issues/111268, https://github.com/flutter/flutter/issues/106190 - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] All existing and new tests are passing. Co-authored-by: John McCutchan --- .../io/flutter/plugin/platform/PlatformViewsController.java | 4 ++-- .../flutter/plugin/platform/PlatformViewsControllerTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index 003df1981d..f567e32de0 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -690,8 +690,8 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega return MotionEvent.obtain( trackedEvent.getDownTime(), trackedEvent.getEventTime(), - touch.action, - touch.pointerCount, + trackedEvent.getAction(), + trackedEvent.getPointerCount(), pointerProperties, pointerCoords, trackedEvent.getMetaState(), diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java index f72b8329b4..81e264232b 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java @@ -356,8 +356,8 @@ public class PlatformViewsControllerTest { frameWorkTouch, false // usingVirtualDisplays ); - assertEquals(resolvedEvent.getAction(), frameWorkTouch.action); - assertNotEquals(resolvedEvent.getAction(), original.getAction()); + assertEquals(resolvedEvent.getAction(), original.getAction()); + assertNotEquals(resolvedEvent.getAction(), frameWorkTouch.action); } @Ignore