Skip to content

Commit 7099814

Browse files
authored
[input] Migrate fuchsia.ui.pointerinjector to TouchSource (flutter#190855)
Removed fuchsia.ui.pointerinjector.Registry usages, dependencies, manifests, and the PointerInjectorDelegate class in the Flutter Runner. Input events for child views are routed directly by Scenic to child TouchSources in Flatland, making parent-side pointer injection obsolete. Test: touch-input-test, mouse-input-test, text-input-test, flutter_runner_tests Issue: b/42175685 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] 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. - [x] 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] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent a539e0e commit 7099814

19 files changed

Lines changed: 2 additions & 1379 deletions

‎engine/src/flutter/shell/platform/fuchsia/flutter/BUILD.gn‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ template("runner_sources") {
8585
"platform_view.h",
8686
"pointer_delegate.cc",
8787
"pointer_delegate.h",
88-
"pointer_injector_delegate.cc",
89-
"pointer_injector_delegate.h",
9088
"program_metadata.h",
9189
"rtree.cc",
9290
"rtree.h",
@@ -155,7 +153,6 @@ template("runner_sources") {
155153
"${fuchsia_sdk}/fidl/fuchsia.ui.input",
156154
"${fuchsia_sdk}/fidl/fuchsia.ui.input3",
157155
"${fuchsia_sdk}/fidl/fuchsia.ui.pointer",
158-
"${fuchsia_sdk}/fidl/fuchsia.ui.pointerinjector",
159156
"${fuchsia_sdk}/fidl/fuchsia.ui.test.input",
160157
"${fuchsia_sdk}/fidl/fuchsia.ui.views",
161158
"${fuchsia_sdk}/pkg/inspect",
@@ -457,7 +454,6 @@ if (enable_unittests) {
457454
"fuchsia_intl_unittest.cc",
458455
"keyboard_unittest.cc",
459456
"pointer_delegate_unittests.cc",
460-
"pointer_injector_delegate_unittest.cc",
461457
"rtree_unittests.cc",
462458
"tests/engine_unittests.cc",
463459
"tests/external_view_embedder_unittests.cc",

‎engine/src/flutter/shell/platform/fuchsia/flutter/engine.cc‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,6 @@ void Engine::Initialize(
305305
<< "fuchsia::ui::input3::Keyboard connection failed: "
306306
<< zx_status_get_string(keyboard_status);
307307

308-
// Connect to Pointerinjector service.
309-
fuchsia::ui::pointerinjector::RegistryHandle pointerinjector_registry;
310-
zx_status_t pointerinjector_registry_status =
311-
runner_services->Connect<fuchsia::ui::pointerinjector::Registry>(
312-
pointerinjector_registry.NewRequest());
313-
if (pointerinjector_registry_status != ZX_OK) {
314-
FML_LOG(WARNING)
315-
<< "fuchsia::ui::pointerinjector::Registry connection failed: "
316-
<< zx_status_get_string(pointerinjector_registry_status);
317-
}
318-
319308
// Make clones of the `ViewRef` before sending it to various places.
320309
fuchsia::ui::views::ViewRef platform_view_ref;
321310
view_ref_pair.second.Clone(&platform_view_ref);
@@ -469,7 +458,6 @@ void Engine::Initialize(
469458
view_ref_focused = std::move(view_ref_focused),
470459
touch_source = std::move(touch_source),
471460
mouse_source = std::move(mouse_source),
472-
pointerinjector_registry = std::move(pointerinjector_registry),
473461
on_session_listener_error_callback =
474462
std::move(on_session_listener_error_callback),
475463
on_enable_wireframe_callback =
@@ -531,7 +519,6 @@ void Engine::Initialize(
531519
std::move(keyboard), std::move(touch_source),
532520
std::move(mouse_source), std::move(focuser),
533521
std::move(view_ref_focused), std::move(parent_viewport_watcher),
534-
std::move(pointerinjector_registry),
535522
std::move(on_enable_wireframe_callback),
536523
std::move(on_create_view_callback),
537524
std::move(on_update_view_callback),

‎engine/src/flutter/shell/platform/fuchsia/flutter/meta/common.shard.cml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"fuchsia.ui.composition.Flatland",
4747
"fuchsia.ui.input.ImeService",
4848
"fuchsia.ui.input3.Keyboard",
49-
"fuchsia.ui.pointerinjector.Registry",
5049
"fuchsia.vulkan.loader.Loader", // Copied from vulkan/client.shard.cml.
5150
],
5251
},

‎engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "third_party/rapidjson/include/rapidjson/writer.h"
2525

2626
#include "flutter/fml/make_copyable.h"
27-
#include "flutter/shell/platform/fuchsia/flutter/pointer_injector_delegate.h"
2827
#include "flutter/shell/platform/fuchsia/flutter/text_delegate.h"
2928
#include "flutter/shell/platform/fuchsia/flutter/vsync_waiter.h"
3029
#include "flutter/shell/platform/fuchsia/runtime/dart/utils/inlines.h"
@@ -68,7 +67,6 @@ PlatformView::PlatformView(
6867
fuchsia::ui::views::ViewRefFocusedHandle view_ref_focused,
6968
fuchsia::ui::composition::ParentViewportWatcherHandle
7069
parent_viewport_watcher,
71-
fuchsia::ui::pointerinjector::RegistryHandle pointerinjector_registry,
7270
OnEnableWireframeCallback wireframe_enabled_callback,
7371
OnCreateViewCallback on_create_view_callback,
7472
OnUpdateViewCallback on_update_view_callback,
@@ -104,9 +102,6 @@ PlatformView::PlatformView(
104102
dart_application_svc_(dart_application_svc),
105103
parent_viewport_watcher_(parent_viewport_watcher.Bind()),
106104
weak_factory_(this) {
107-
fuchsia::ui::views::ViewRef view_ref_clone;
108-
fidl::Clone(view_ref, &view_ref_clone);
109-
110105
text_delegate_ =
111106
std::make_unique<TextDelegate>(
112107
std::move(view_ref), std::move(ime_service), std::move(keyboard),
@@ -163,10 +158,6 @@ PlatformView::PlatformView(
163158
weak->DispatchPointerDataPacket(std::move(packet));
164159
});
165160

166-
// Configure the pointer injector delegate.
167-
pointer_injector_delegate_ = std::make_unique<PointerInjectorDelegate>(
168-
std::move(pointerinjector_registry), std::move(view_ref_clone));
169-
170161
// This is only used by the integration tests.
171162
if (dart_application_svc) {
172163
// Connect to TouchInputListener
@@ -418,12 +409,8 @@ void PlatformView::OnChildViewViewRef(uint64_t content_id,
418409
fuchsia::ui::views::ViewRef view_ref) {
419410
FML_CHECK(child_view_info_.count(content_id) == 1);
420411

421-
fuchsia::ui::views::ViewRef view_ref_clone;
422-
fidl::Clone(view_ref, &view_ref_clone);
423-
424412
focus_delegate_->OnChildViewViewRef(view_id, std::move(view_ref));
425413

426-
pointer_injector_delegate_->OnCreateView(view_id, std::move(view_ref_clone));
427414
OnChildViewConnected(content_id);
428415
}
429416

@@ -457,7 +444,7 @@ void PlatformView::OnCreateView(ViewCallback on_view_created,
457444
watcher_handle.Bind();
458445
FML_CHECK(child_view_watcher);
459446

460-
child_view_watcher.set_error_handler([weak, view_id, content_id](
447+
child_view_watcher.set_error_handler([weak, content_id](
461448
zx_status_t status) {
462449
FML_LOG(WARNING)
463450
<< "Child disconnected. ChildViewWatcher status: " << status;
@@ -469,9 +456,6 @@ void PlatformView::OnCreateView(ViewCallback on_view_created,
469456
return;
470457
}
471458

472-
// Disconnected views cannot listen to pointer events.
473-
weak->pointer_injector_delegate_->OnDestroyView(view_id);
474-
475459
weak->OnChildViewDisconnected(content_id.value);
476460
});
477461

@@ -517,7 +501,6 @@ void PlatformView::OnDisposeView(int64_t view_id_raw) {
517501
weak->OnChildViewDisconnected(content_id.value);
518502
weak->child_view_info_.erase(content_id.value);
519503
weak->focus_delegate_->OnDisposeChildView(view_id_raw);
520-
weak->pointer_injector_delegate_->OnDestroyView(view_id_raw);
521504
});
522505
};
523506
on_destroy_view_callback_(view_id_raw, std::move(on_view_unbound));
@@ -901,10 +884,6 @@ bool PlatformView::HandleFlutterPlatformViewsChannelPlatformMessage(
901884
} else if (method.rfind("View.focus", 0) == 0) {
902885
return focus_delegate_->HandlePlatformMessage(document,
903886
message->response());
904-
} else if (method.rfind(PointerInjectorDelegate::kPointerInjectorMethodPrefix,
905-
0) == 0) {
906-
return pointer_injector_delegate_->HandlePlatformMessage(
907-
document, message->response());
908887
} else {
909888
FML_LOG(ERROR) << "Unknown " << message->channel() << " method " << method;
910889
}

‎engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "flutter/shell/platform/fuchsia/flutter/focus_delegate.h"
3434
#include "flutter/shell/platform/fuchsia/flutter/keyboard.h"
3535
#include "flutter/shell/platform/fuchsia/flutter/pointer_delegate.h"
36-
#include "flutter/shell/platform/fuchsia/flutter/pointer_injector_delegate.h"
3736
#include "flutter/shell/platform/fuchsia/flutter/text_delegate.h"
3837
#include "flutter/shell/platform/fuchsia/flutter/vsync_waiter.h"
3938

@@ -83,7 +82,6 @@ class PlatformView : public flutter::PlatformView {
8382
fuchsia::ui::views::ViewRefFocusedHandle view_ref_focused,
8483
fuchsia::ui::composition::ParentViewportWatcherHandle
8584
parent_viewport_watcher,
86-
fuchsia::ui::pointerinjector::RegistryHandle pointerinjector_registry,
8785
OnEnableWireframeCallback wireframe_enabled_callback,
8886
OnCreateViewCallback on_create_view_callback,
8987
OnUpdateViewCallback on_update_view_callback,
@@ -198,7 +196,6 @@ class PlatformView : public flutter::PlatformView {
198196

199197
std::shared_ptr<FocusDelegate> focus_delegate_;
200198
std::shared_ptr<PointerDelegate> pointer_delegate_;
201-
std::unique_ptr<PointerInjectorDelegate> pointer_injector_delegate_;
202199

203200
// Text delegate is responsible for handling keyboard input and text editing.
204201
std::unique_ptr<TextDelegate> text_delegate_;

0 commit comments

Comments
 (0)