Skip to content

Commit 745ac10

Browse files
author
Jonah Williams
authored
[Android] fix hcpp gestures. (#162859)
We only need to conditionally send motion events to the platform_view_2 channel. This can be done with an override in the controller, the existing surface classes don't need to be touched.
1 parent d488205 commit 745ac10

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

packages/flutter/lib/src/services/platform_views.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -888,12 +888,6 @@ abstract class AndroidViewController extends PlatformViewController {
888888
/// call's future has completed.
889889
bool get requiresViewComposition => false;
890890

891-
/// True if the experimental hybrid composition controller is enabled.
892-
///
893-
/// This value may change during [create], but will not change after that
894-
/// call's future has completed.
895-
bool get useNewHybridComposition => false;
896-
897891
/// Sends an Android [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)
898892
/// to the view.
899893
///
@@ -1179,9 +1173,6 @@ class HybridAndroidViewController extends AndroidViewController {
11791173
);
11801174
}
11811175

1182-
@override
1183-
bool get useNewHybridComposition => true;
1184-
11851176
@override
11861177
int? get textureId {
11871178
return _internals.textureId;
@@ -1206,6 +1197,11 @@ class HybridAndroidViewController extends AndroidViewController {
12061197
Future<void> setOffset(Offset off) {
12071198
return _internals.setOffset(off, viewId: viewId, viewState: _state);
12081199
}
1200+
1201+
@override
1202+
Future<void> sendMotionEvent(AndroidMotionEvent event) async {
1203+
await SystemChannels.platform_views.invokeMethod<dynamic>('touch', event._asList(viewId));
1204+
}
12091205
}
12101206

12111207
/// Controls an Android view that is rendered as a texture.

packages/flutter/lib/src/widgets/platform_view.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,14 +1473,6 @@ class _AndroidViewSurfaceState extends State<AndroidViewSurface> {
14731473
@override
14741474
Widget build(BuildContext context) {
14751475
if (widget.controller.requiresViewComposition) {
1476-
if (widget.controller.useNewHybridComposition) {
1477-
// TODO(jonahwilliams): make it actually work.
1478-
return _PlatformLayerBasedAndroidViewSurface(
1479-
controller: widget.controller,
1480-
hitTestBehavior: widget.hitTestBehavior,
1481-
gestureRecognizers: widget.gestureRecognizers,
1482-
);
1483-
}
14841476
return _PlatformLayerBasedAndroidViewSurface(
14851477
controller: widget.controller,
14861478
hitTestBehavior: widget.hitTestBehavior,

packages/flutter/test/services/fake_platform_views.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class FakeAndroidViewController implements AndroidViewController {
4949
this.viewId, {
5050
this.requiresSize = false,
5151
this.requiresViewComposition = false,
52-
this.useNewHybridComposition = false,
5352
});
5453

5554
bool disposed = false;
@@ -148,9 +147,6 @@ class FakeAndroidViewController implements AndroidViewController {
148147

149148
@override
150149
bool requiresViewComposition;
151-
152-
@override
153-
bool useNewHybridComposition;
154150
}
155151

156152
class FakeAndroidPlatformViewsController {

0 commit comments

Comments
 (0)