Skip to content

Commit fffabf0

Browse files
committed
Initial implementation of Tizen platform shell
1 parent 2b96c20 commit fffabf0

File tree

95 files changed

+13457
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+13457
-0
lines changed

flutter/shell/platform/tizen/BUILD.gn

+282
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
# Copyright 2022 Samsung Electronics Co., Ltd. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
import("//flutter/shell/platform/common/client_wrapper/publish.gni")
6+
7+
_public_headers = [
8+
"public/flutter_platform_view.h",
9+
"public/flutter_tizen.h",
10+
]
11+
12+
config("flutter_tizen_config") {
13+
include_dirs = [
14+
"${sysroot_path}/usr/include/appfw",
15+
"${sysroot_path}/usr/include/base",
16+
"${sysroot_path}/usr/include/dali",
17+
"${sysroot_path}/usr/include/dali-adaptor",
18+
"${sysroot_path}/usr/include/dali-toolkit",
19+
"${sysroot_path}/usr/include/dlog",
20+
"${sysroot_path}/usr/include/ecore-1",
21+
"${sysroot_path}/usr/include/ecore-con-1",
22+
"${sysroot_path}/usr/include/ecore-evas-1",
23+
"${sysroot_path}/usr/include/ecore-file-1",
24+
"${sysroot_path}/usr/include/ecore-imf-1",
25+
"${sysroot_path}/usr/include/ecore-imf-evas-1",
26+
"${sysroot_path}/usr/include/ecore-input-1",
27+
"${sysroot_path}/usr/include/ecore-input-evas-1",
28+
"${sysroot_path}/usr/include/ecore-wayland-1",
29+
"${sysroot_path}/usr/include/ecore-wl2-1",
30+
"${sysroot_path}/usr/include/edje-1",
31+
"${sysroot_path}/usr/include/eet-1",
32+
"${sysroot_path}/usr/include/efl-1",
33+
"${sysroot_path}/usr/include/efl-extension",
34+
"${sysroot_path}/usr/include/efl-1/interfaces",
35+
"${sysroot_path}/usr/include/efreet-1",
36+
"${sysroot_path}/usr/include/eina-1",
37+
"${sysroot_path}/usr/include/eina-1/eina",
38+
"${sysroot_path}/usr/include/elementary-1",
39+
"${sysroot_path}/usr/include/emile-1",
40+
"${sysroot_path}/usr/include/eo-1",
41+
"${sysroot_path}/usr/include/ethumb-1",
42+
"${sysroot_path}/usr/include/ethumb-client-1",
43+
"${sysroot_path}/usr/include/evas-1",
44+
"${sysroot_path}/usr/include/feedback",
45+
"${sysroot_path}/usr/include/system",
46+
"${sysroot_path}/usr/include/tzsh",
47+
"${sysroot_path}/usr/include/wayland-extension",
48+
]
49+
50+
cflags_cc = [
51+
"-Wno-newline-eof",
52+
"-Wno-macro-redefined",
53+
]
54+
}
55+
56+
config("relative_client_wrapper_headers") {
57+
include_dirs = [ "//flutter/shell/platform/common/client_wrapper/include" ]
58+
}
59+
60+
source_set("dart_api_dl") {
61+
sources = [
62+
"//third_party/dart/runtime/include/dart_api_dl.c",
63+
"//third_party/dart/runtime/include/dart_api_dl.h",
64+
]
65+
}
66+
67+
template("embedder") {
68+
forward_variables_from(invoker,
69+
[
70+
"target_type",
71+
"defines",
72+
])
73+
74+
target(target_type, target_name) {
75+
public = _public_headers
76+
77+
sources = [
78+
"accessibility_settings.cc",
79+
"channels/accessibility_channel.cc",
80+
"channels/app_control.cc",
81+
"channels/app_control_channel.cc",
82+
"channels/feedback_manager.cc",
83+
"channels/key_event_channel.cc",
84+
"channels/key_mapping.cc",
85+
"channels/lifecycle_channel.cc",
86+
"channels/navigation_channel.cc",
87+
"channels/platform_channel.cc",
88+
"channels/platform_view_channel.cc",
89+
"channels/settings_channel.cc",
90+
"channels/text_input_channel.cc",
91+
"channels/window_channel.cc",
92+
"external_texture_pixel_evas_gl.cc",
93+
"external_texture_surface_evas_gl.cc",
94+
"flutter_project_bundle.cc",
95+
"flutter_tizen.cc",
96+
"flutter_tizen_elementary.cc",
97+
"flutter_tizen_engine.cc",
98+
"flutter_tizen_texture_registrar.cc",
99+
"flutter_tizen_view.cc",
100+
"logger.cc",
101+
"system_utils.cc",
102+
"tizen_event_loop.cc",
103+
"tizen_input_method_context.cc",
104+
"tizen_renderer.cc",
105+
"tizen_renderer_evas_gl.cc",
106+
"tizen_view_elementary.cc",
107+
"tizen_window_elementary.cc",
108+
]
109+
110+
lib_dirs = [ "//engine/${target_cpu}" ]
111+
112+
libs = [
113+
"base-utils-i18n",
114+
"capi-appfw-application",
115+
"capi-appfw-app-common",
116+
"capi-appfw-app-control",
117+
"capi-base-common",
118+
"capi-system-info",
119+
"capi-system-system-settings",
120+
"capi-ui-efl-util",
121+
"dlog",
122+
"ecore",
123+
"ecore_evas",
124+
"ecore_imf",
125+
"ecore_imf_evas",
126+
"ecore_input",
127+
"efl-extension",
128+
"eina",
129+
"elementary",
130+
"evas",
131+
"feedback",
132+
"flutter_engine",
133+
"tbm",
134+
"wayland-client",
135+
]
136+
137+
if (target_name != "flutter_tizen_wearable") {
138+
sources += [
139+
"accessibility_bridge_delegate_tizen.cc",
140+
"external_texture_pixel_egl.cc",
141+
"external_texture_surface_egl.cc",
142+
"flutter_platform_node_delegate_tizen.cc",
143+
"tizen_renderer_egl.cc",
144+
"tizen_vsync_waiter.cc",
145+
"tizen_window_ecore_wl2.cc",
146+
]
147+
148+
libs += [
149+
"ecore_wl2",
150+
"tdm-client",
151+
"tizen-extension-client",
152+
"EGL",
153+
"GLESv2",
154+
]
155+
}
156+
157+
if (target_name == "flutter_tizen_common") {
158+
sources += [ "channels/tizen_shell.cc" ]
159+
160+
libs += [
161+
"tzsh_common",
162+
"tzsh_softkey",
163+
]
164+
}
165+
166+
defines += invoker.defines
167+
defines += [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]
168+
169+
if (api_version == "6.5") {
170+
sources += [
171+
"flutter_tizen_nui.cc",
172+
"tizen_view_nui.cc",
173+
]
174+
175+
libs += [
176+
"dali2-adaptor",
177+
"dali2-core",
178+
]
179+
180+
defines += [ "NUI_SUPPORT" ]
181+
}
182+
183+
configs += [
184+
":flutter_tizen_config",
185+
"//flutter/shell/platform/common:desktop_library_implementation",
186+
]
187+
188+
public_configs = [
189+
":relative_client_wrapper_headers",
190+
"//flutter:config",
191+
]
192+
193+
deps += [
194+
":dart_api_dl",
195+
"//flutter/shell/platform/common:common_cpp",
196+
"//flutter/shell/platform/common:common_cpp_input",
197+
"//flutter/shell/platform/common:common_cpp_library_headers",
198+
"//flutter/shell/platform/common/client_wrapper:client_wrapper",
199+
"//third_party/rapidjson",
200+
]
201+
202+
if (target_name != "flutter_tizen_wearable") {
203+
deps += [ "//flutter/shell/platform/common:common_cpp_accessibility" ]
204+
}
205+
}
206+
}
207+
208+
embedder("flutter_tizen_mobile") {
209+
target_type = "shared_library"
210+
211+
defines = [ "MOBILE_PROFILE" ]
212+
}
213+
214+
embedder("flutter_tizen_wearable") {
215+
target_type = "shared_library"
216+
217+
defines = [ "WEARABLE_PROFILE" ]
218+
}
219+
220+
embedder("flutter_tizen_tv") {
221+
target_type = "shared_library"
222+
223+
defines = [ "TV_PROFILE" ]
224+
}
225+
226+
embedder("flutter_tizen_common") {
227+
target_type = "shared_library"
228+
229+
defines = [ "COMMON_PROFILE" ]
230+
}
231+
232+
embedder("flutter_tizen_source") {
233+
target_type = "source_set"
234+
235+
defines = []
236+
}
237+
238+
executable("flutter_tizen_unittests") {
239+
testonly = true
240+
241+
sources = [
242+
"channels/lifecycle_channel_unittests.cc",
243+
"channels/settings_channel_unittests.cc",
244+
"flutter_project_bundle_unittests.cc",
245+
"flutter_tizen_engine_unittest.cc",
246+
"flutter_tizen_texture_registrar_unittests.cc",
247+
]
248+
249+
ldflags = [ "-Wl,--unresolved-symbols=ignore-in-shared-libs" ]
250+
251+
configs += [ ":flutter_tizen_config" ]
252+
253+
deps += [
254+
":flutter_tizen_source",
255+
"//flutter/shell/platform/common:common_cpp",
256+
"//flutter/shell/platform/common:common_cpp_accessibility",
257+
"//flutter/shell/platform/common/client_wrapper:client_wrapper",
258+
"//third_party/googletest:gtest_main",
259+
"//third_party/rapidjson",
260+
]
261+
}
262+
263+
publish_client_wrapper_core("publish_cpp_client_wrapper") {
264+
visibility = [ ":*" ]
265+
}
266+
267+
copy("publish_headers_tizen") {
268+
sources = _public_headers
269+
270+
outputs = [ "$root_out_dir/public/{{source_file_part}}" ]
271+
}
272+
273+
group("flutter_tizen") {
274+
deps = [
275+
":flutter_tizen_common",
276+
":flutter_tizen_mobile",
277+
":flutter_tizen_tv",
278+
":flutter_tizen_wearable",
279+
":publish_cpp_client_wrapper",
280+
":publish_headers_tizen",
281+
]
282+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2022 Samsung Electronics Co., Ltd. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "accessibility_bridge_delegate_tizen.h"
6+
7+
#include "flutter/shell/platform/tizen/flutter_platform_node_delegate_tizen.h"
8+
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
9+
#include "flutter/shell/platform/tizen/logger.h"
10+
11+
namespace flutter {
12+
13+
AccessibilityBridgeDelegateTizen::AccessibilityBridgeDelegateTizen(
14+
FlutterTizenEngine* engine)
15+
: engine_(engine) {}
16+
17+
void AccessibilityBridgeDelegateTizen::OnAccessibilityEvent(
18+
ui::AXEventGenerator::TargetedEvent targeted_event) {
19+
std::shared_ptr<AccessibilityBridge> bridge =
20+
engine_->accessibility_bridge().lock();
21+
if (!bridge) {
22+
FT_LOG(Error) << "Accessibility bridge is deallocated";
23+
return;
24+
}
25+
26+
std::shared_ptr<FlutterPlatformNodeDelegate> platform_node_delegate =
27+
bridge->GetFlutterPlatformNodeDelegateFromID(targeted_event.node->id())
28+
.lock();
29+
if (!platform_node_delegate) {
30+
FT_LOG(Error) << "Platform node delegate is deallocated";
31+
return;
32+
}
33+
auto tizen_platform_node_delegate =
34+
std::static_pointer_cast<FlutterPlatformNodeDelegateTizen>(
35+
platform_node_delegate);
36+
tizen_platform_node_delegate->NotifyAccessibilityEvent(
37+
targeted_event.event_params.event);
38+
}
39+
40+
void AccessibilityBridgeDelegateTizen::DispatchAccessibilityAction(
41+
AccessibilityNodeId target,
42+
FlutterSemanticsAction action,
43+
fml::MallocMapping data) {
44+
engine_->DispatchAccessibilityAction(target, action, std::move(data));
45+
}
46+
47+
std::shared_ptr<FlutterPlatformNodeDelegate>
48+
AccessibilityBridgeDelegateTizen::CreateFlutterPlatformNodeDelegate() {
49+
return std::make_shared<FlutterPlatformNodeDelegateTizen>();
50+
}
51+
52+
} // namespace flutter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2022 Samsung Electronics Co., Ltd. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef EMBEDDER_ACCESSIBILITY_BRIDGE_DELEGATE_TIZEN_H_
6+
#define EMBEDDER_ACCESSIBILITY_BRIDGE_DELEGATE_TIZEN_H_
7+
8+
#include "flutter/shell/platform/common/accessibility_bridge.h"
9+
10+
namespace flutter {
11+
12+
class FlutterTizenEngine;
13+
14+
// The Tizen implementation of AccessibilityBridge::AccessibilityBridgeDelegate.
15+
// This delegate is used to create AccessibilityBridge in the Tizen platform.
16+
class AccessibilityBridgeDelegateTizen
17+
: public AccessibilityBridge::AccessibilityBridgeDelegate {
18+
public:
19+
explicit AccessibilityBridgeDelegateTizen(FlutterTizenEngine* engine);
20+
virtual ~AccessibilityBridgeDelegateTizen() = default;
21+
22+
// |AccessibilityBridge::AccessibilityBridgeDelegate|
23+
void OnAccessibilityEvent(
24+
ui::AXEventGenerator::TargetedEvent targeted_event) override;
25+
26+
// |AccessibilityBridge::AccessibilityBridgeDelegate|
27+
void DispatchAccessibilityAction(AccessibilityNodeId target,
28+
FlutterSemanticsAction action,
29+
fml::MallocMapping data) override;
30+
31+
// |AccessibilityBridge::AccessibilityBridgeDelegate|
32+
std::shared_ptr<FlutterPlatformNodeDelegate>
33+
CreateFlutterPlatformNodeDelegate() override;
34+
35+
private:
36+
FlutterTizenEngine* engine_;
37+
};
38+
39+
} // namespace flutter
40+
41+
#endif // EMBEDDER_ACCESSIBILITY_BRIDGE_DELEGATE_TIZEN_H_

0 commit comments

Comments
 (0)