diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac27b77..c4cd9dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - api-version: ['5.5', '6.0', '6.5'] + api-version: ['6.0', '6.5'] arch: [arm, arm64, x86] include: - arch: arm @@ -45,21 +45,12 @@ jobs: - name: Generate Tizen 6.0 sysroot if: ${{ matrix.api-version == '6.0' }} - run: src/tools/generate_sysroot.py --api-version 6.0 --out src/sysroot-6.0 + run: src/tools/generate_sysroot.py --out src/sysroot-6.0 - name: Generate Tizen 6.5 sysroot if: ${{ matrix.api-version == '6.5' }} run: src/tools/generate_sysroot.py --api-version 6.5 --out src/sysroot-6.5 - - name: Build for Tizen 5.5 - if: ${{ matrix.api-version == '5.5' }} - run: | - src/tools/gn \ - --target-cpu ${{ matrix.arch }} \ - --target-toolchain /usr/lib/llvm-12 \ - --target-dir build - ninja -C src/out/build - - name: Build for Tizen 6.0 if: ${{ matrix.api-version == '6.0' }} run: | @@ -67,7 +58,6 @@ jobs: --target-cpu ${{ matrix.arch }} \ --target-toolchain /usr/lib/llvm-12 \ --target-sysroot src/sysroot-6.0/${{ matrix.arch }} \ - --api-version 6.0 --system-cxx \ --target-dir build ninja -C src/out/build @@ -78,7 +68,7 @@ jobs: --target-cpu ${{ matrix.arch }} \ --target-toolchain /usr/lib/llvm-12 \ --target-sysroot src/sysroot-6.5/${{ matrix.arch }} \ - --api-version 6.5 --system-cxx \ + --api-version 6.5 \ --target-dir build ninja -C src/out/build diff --git a/README.md b/README.md index 4e5e692..0f2eaca 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The Flutter embedder for Tizen. ### Notes - To build an app (TPK) with the embedder generated in the above, copy the output artifacts (`libflutter_tizen*.so`) into the [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen) tool's cached artifacts directory (`flutter/bin/cache/artifacts/engine`) and run `flutter-tizen run` or `flutter-tizen build tpk`. -- To use the target device's `libstdc++.so` instead of the embedder's built-in libc++ (`third_party/libcxx`), provide the `--system-cxx` option to `tools/gn`. Tizen 5.5's `libstdc++.so` is not compatible with C++17, so you cannot use this option for Tizen 5.5. +- To use the embedder's built-in libc++ (`third_party/libcxx`) instead of the target device's `libstdc++.so`, provide the `--no-system-cxx` option to `tools/gn`. - Building NUI-related code requires a sysroot for Tizen 6.5 or above and the `--api-version 6.5` option. ## Repository structure diff --git a/flutter/shell/platform/tizen/BUILD.gn b/flutter/shell/platform/tizen/BUILD.gn index f566693..5515509 100644 --- a/flutter/shell/platform/tizen/BUILD.gn +++ b/flutter/shell/platform/tizen/BUILD.gn @@ -77,6 +77,7 @@ template("embedder") { public = _public_headers sources = [ + "accessibility_bridge_tizen.cc", "accessibility_settings.cc", "channels/accessibility_channel.cc", "channels/app_control.cc", @@ -93,8 +94,11 @@ template("embedder") { "channels/settings_channel.cc", "channels/text_input_channel.cc", "channels/window_channel.cc", + "external_texture_pixel_egl.cc", "external_texture_pixel_evas_gl.cc", + "external_texture_surface_egl.cc", "external_texture_surface_evas_gl.cc", + "flutter_platform_node_delegate_tizen.cc", "flutter_project_bundle.cc", "flutter_tizen.cc", "flutter_tizen_elementary.cc", @@ -106,8 +110,11 @@ template("embedder") { "tizen_event_loop.cc", "tizen_input_method_context.cc", "tizen_renderer.cc", + "tizen_renderer_egl.cc", "tizen_renderer_evas_gl.cc", "tizen_view_elementary.cc", + "tizen_vsync_waiter.cc", + "tizen_window_ecore_wl2.cc", "tizen_window_elementary.cc", ] @@ -128,6 +135,7 @@ template("embedder") { "ecore_imf", "ecore_imf_evas", "ecore_input", + "ecore_wl2", "efl-extension", "eina", "elementary", @@ -136,30 +144,14 @@ template("embedder") { "feedback", "flutter_engine", "tbm", + "tdm-client", + "tizen-extension-client", "vconf", "wayland-client", + "EGL", + "GLESv2", ] - if (target_name != "flutter_tizen_wearable") { - sources += [ - "accessibility_bridge_tizen.cc", - "external_texture_pixel_egl.cc", - "external_texture_surface_egl.cc", - "flutter_platform_node_delegate_tizen.cc", - "tizen_renderer_egl.cc", - "tizen_vsync_waiter.cc", - "tizen_window_ecore_wl2.cc", - ] - - libs += [ - "ecore_wl2", - "tdm-client", - "tizen-extension-client", - "EGL", - "GLESv2", - ] - } - if (target_name == "flutter_tizen_common") { sources += [ "channels/tizen_shell.cc" ] @@ -172,7 +164,7 @@ template("embedder") { defines += invoker.defines defines += [ "FLUTTER_ENGINE_NO_PROTOTYPES" ] - if (api_version == "6.5" && target_name != "flutter_tizen_wearable") { + if (api_version == "6.5") { sources += [ "flutter_tizen_nui.cc", "tizen_clipboard.cc", @@ -203,16 +195,13 @@ template("embedder") { deps += [ ":dart_api_dl", "//flutter/shell/platform/common:common_cpp", + "//flutter/shell/platform/common:common_cpp_accessibility", "//flutter/shell/platform/common:common_cpp_input", "//flutter/shell/platform/common:common_cpp_library_headers", "//flutter/shell/platform/common/client_wrapper:client_wrapper", "//flutter/shell/platform/embedder:embedder_headers", "//third_party/rapidjson", ] - - if (target_name != "flutter_tizen_wearable") { - deps += [ "//flutter/shell/platform/common:common_cpp_accessibility" ] - } } } @@ -222,12 +211,6 @@ embedder("flutter_tizen_mobile") { defines = [ "MOBILE_PROFILE" ] } -embedder("flutter_tizen_wearable") { - target_type = "shared_library" - - defines = [ "WEARABLE_PROFILE" ] -} - embedder("flutter_tizen_tv") { target_type = "shared_library" @@ -286,7 +269,6 @@ group("flutter_tizen") { ":flutter_tizen_common", ":flutter_tizen_mobile", ":flutter_tizen_tv", - ":flutter_tizen_wearable", ":publish_cpp_client_wrapper", ":publish_headers_tizen", ] diff --git a/flutter/shell/platform/tizen/accessibility_settings.cc b/flutter/shell/platform/tizen/accessibility_settings.cc index ebc5712..442c508 100644 --- a/flutter/shell/platform/tizen/accessibility_settings.cc +++ b/flutter/shell/platform/tizen/accessibility_settings.cc @@ -16,7 +16,6 @@ namespace flutter { AccessibilitySettings::AccessibilitySettings(FlutterTizenEngine* engine) : engine_(engine) { -#ifndef WEARABLE_PROFILE bool tts_enabled = false; int ret = system_settings_get_value_bool( SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS, &tts_enabled); @@ -29,7 +28,6 @@ AccessibilitySettings::AccessibilitySettings(FlutterTizenEngine* engine) } system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS, OnScreenReaderStateChanged, this); -#endif #ifdef TV_PROFILE int high_contrast = 0; @@ -46,9 +44,7 @@ AccessibilitySettings::AccessibilitySettings(FlutterTizenEngine* engine) } AccessibilitySettings::~AccessibilitySettings() { -#ifndef WEARABLE_PROFILE system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS); -#endif #ifdef TV_PROFILE system_settings_unset_changed_cb( SYSTEM_SETTINGS_KEY_ACCESSIBILITY_HIGHCONTRAST); @@ -76,7 +72,6 @@ void AccessibilitySettings::OnHighContrastStateChanged( void AccessibilitySettings::OnScreenReaderStateChanged( system_settings_key_e key, void* user_data) { -#ifndef WEARABLE_PROFILE auto* self = static_cast(user_data); bool enabled = false; @@ -90,7 +85,6 @@ void AccessibilitySettings::OnScreenReaderStateChanged( self->screen_reader_enabled_ = enabled; self->engine_->SetSemanticsEnabled(enabled); } -#endif } } // namespace flutter diff --git a/flutter/shell/platform/tizen/flutter_tizen.cc b/flutter/shell/platform/tizen/flutter_tizen.cc index 977d085..d6ffd97 100644 --- a/flutter/shell/platform/tizen/flutter_tizen.cc +++ b/flutter/shell/platform/tizen/flutter_tizen.cc @@ -20,9 +20,7 @@ #include "flutter/shell/platform/tizen/tizen_view_nui.h" #endif #include "flutter/shell/platform/tizen/tizen_window.h" -#ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/tizen_window_ecore_wl2.h" -#endif #include "flutter/shell/platform/tizen/tizen_window_elementary.h" namespace { @@ -209,13 +207,9 @@ FlutterDesktopViewRef FlutterDesktopViewCreateFromNewWindow( window_properties.focusable, window_properties.top_level, window_properties.external_output_type); } else { -#ifndef WEARABLE_PROFILE window = std::make_unique( window_geometry, window_properties.transparent, window_properties.focusable, window_properties.top_level); -#else - return nullptr; -#endif } auto view = std::make_unique( diff --git a/flutter/shell/platform/tizen/flutter_tizen_engine.cc b/flutter/shell/platform/tizen/flutter_tizen_engine.cc index e3e2bbb..e2708a4 100644 --- a/flutter/shell/platform/tizen/flutter_tizen_engine.cc +++ b/flutter/shell/platform/tizen/flutter_tizen_engine.cc @@ -9,15 +9,13 @@ #include #include -#ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/accessibility_bridge_tizen.h" #include "flutter/shell/platform/tizen/flutter_platform_node_delegate_tizen.h" -#include "flutter/shell/platform/tizen/tizen_renderer_egl.h" -#endif #include "flutter/shell/platform/tizen/flutter_tizen_view.h" #include "flutter/shell/platform/tizen/logger.h" #include "flutter/shell/platform/tizen/system_utils.h" #include "flutter/shell/platform/tizen/tizen_input_method_context.h" +#include "flutter/shell/platform/tizen/tizen_renderer_egl.h" #include "flutter/shell/platform/tizen/tizen_renderer_evas_gl.h" namespace flutter { @@ -92,12 +90,9 @@ void FlutterTizenEngine::CreateRenderer( } }, renderer_.get()); - } -#ifndef WEARABLE_PROFILE - else { + } else { renderer_ = std::make_unique(); } -#endif } bool FlutterTizenEngine::RunEngine() { @@ -205,7 +200,7 @@ bool FlutterTizenEngine::RunEngine() { if (!project_->custom_dart_entrypoint().empty()) { args.custom_dart_entrypoint = project_->custom_dart_entrypoint().c_str(); } -#ifndef WEARABLE_PROFILE + args.update_semantics_callback2 = [](const FlutterSemanticsUpdate2* update, void* user_data) { auto* engine = static_cast(user_data); @@ -222,7 +217,6 @@ bool FlutterTizenEngine::RunEngine() { } }; } -#endif FlutterRendererConfig renderer_config = GetRendererConfig(); @@ -268,14 +262,14 @@ bool FlutterTizenEngine::StopEngine() { plugin_registrar_destruction_callbacks_) { callback(registrar); } -#ifndef WEARABLE_PROFILE + { std::lock_guard lock(vsync_mutex_); if (vsync_waiter_) { vsync_waiter_.reset(); } } -#endif + FlutterEngineResult result = embedder_api_.Shutdown(engine_); view_ = nullptr; engine_ = nullptr; @@ -500,7 +494,6 @@ FlutterRendererConfig FlutterTizenEngine::GetRendererConfig() { return config; } -#ifndef WEARABLE_PROFILE void FlutterTizenEngine::DispatchAccessibilityAction( uint64_t target, FlutterSemanticsAction action, @@ -552,6 +545,5 @@ void FlutterTizenEngine::OnUpdateSemantics( geometry.height); window->SetRootNode(root); } -#endif } // namespace flutter diff --git a/flutter/shell/platform/tizen/flutter_tizen_engine.h b/flutter/shell/platform/tizen/flutter_tizen_engine.h index 7e160bb..0d2d919 100644 --- a/flutter/shell/platform/tizen/flutter_tizen_engine.h +++ b/flutter/shell/platform/tizen/flutter_tizen_engine.h @@ -8,9 +8,7 @@ #include -#ifndef WEARABLE_PROFILE #include "flutter/shell/platform/common/accessibility_bridge.h" -#endif #include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h" #include "flutter/shell/platform/common/incoming_message_dispatcher.h" #include "flutter/shell/platform/embedder/embedder.h" @@ -27,9 +25,7 @@ #include "flutter/shell/platform/tizen/public/flutter_tizen.h" #include "flutter/shell/platform/tizen/tizen_event_loop.h" #include "flutter/shell/platform/tizen/tizen_renderer.h" -#ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/tizen_vsync_waiter.h" -#endif // State associated with the plugin registrar. struct FlutterDesktopPluginRegistrar { @@ -113,11 +109,9 @@ class FlutterTizenEngine { NavigationChannel* navigation_channel() { return navigation_channel_.get(); } -#ifndef WEARABLE_PROFILE std::weak_ptr accessibility_bridge() { return accessibility_bridge_; } -#endif // Registers |callback| to be called when the plugin registrar is destroyed. void AddPluginRegistrarDestructionCallback( @@ -174,7 +168,6 @@ class FlutterTizenEngine { // given |texture_id|. bool MarkExternalTextureFrameAvailable(int64_t texture_id); -#ifndef WEARABLE_PROFILE // Dispatch accessibility action back to the Flutter framework. void DispatchAccessibilityAction(uint64_t target, FlutterSemanticsAction action, @@ -182,7 +175,6 @@ class FlutterTizenEngine { // Change semantics state when accessibility state is changed. void SetSemanticsEnabled(bool enabled); -#endif // Notifies the engine about enabled accessibility features. void UpdateAccessibilityFeatures(bool invert_colors, bool high_contrast); @@ -203,10 +195,8 @@ class FlutterTizenEngine { // FlutterTizenEngine. FlutterRendererConfig GetRendererConfig(); -#ifndef WEARABLE_PROFILE // Called when semantics nodes updates are received from the engine. void OnUpdateSemantics(const FlutterSemanticsUpdate2* update); -#endif // The Flutter engine instance. FLUTTER_API_SYMBOL(FlutterEngine) engine_ = nullptr; @@ -241,10 +231,8 @@ class FlutterTizenEngine { FlutterDesktopPluginRegistrarRef> plugin_registrar_destruction_callbacks_; -#ifndef WEARABLE_PROFILE // The accessibility bridge for the Tizen platform. std::shared_ptr accessibility_bridge_; -#endif std::unique_ptr accessibility_settings_; @@ -277,12 +265,10 @@ class FlutterTizenEngine { // An interface between the Flutter rasterizer and the platform. std::unique_ptr renderer_; -#ifndef WEARABLE_PROFILE std::mutex vsync_mutex_; // The vsync waiter for the embedder. std::unique_ptr vsync_waiter_; -#endif }; } // namespace flutter diff --git a/flutter/shell/platform/tizen/flutter_tizen_texture_registrar.cc b/flutter/shell/platform/tizen/flutter_tizen_texture_registrar.cc index 9ea610f..28eb976 100644 --- a/flutter/shell/platform/tizen/flutter_tizen_texture_registrar.cc +++ b/flutter/shell/platform/tizen/flutter_tizen_texture_registrar.cc @@ -7,11 +7,9 @@ #include #include -#ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/external_texture_pixel_egl.h" -#include "flutter/shell/platform/tizen/external_texture_surface_egl.h" -#endif #include "flutter/shell/platform/tizen/external_texture_pixel_evas_gl.h" +#include "flutter/shell/platform/tizen/external_texture_surface_egl.h" #include "flutter/shell/platform/tizen/external_texture_surface_evas_gl.h" #include "flutter/shell/platform/tizen/flutter_tizen_engine.h" #include "flutter/shell/platform/tizen/logger.h" @@ -110,13 +108,9 @@ FlutterTizenTextureRegistrar::CreateExternalTexture( texture_info->pixel_buffer_config.callback, texture_info->pixel_buffer_config.user_data); } -#ifndef WEARABLE_PROFILE return std::make_unique( texture_info->pixel_buffer_config.callback, texture_info->pixel_buffer_config.user_data); -#else - return nullptr; -#endif case kFlutterDesktopGpuSurfaceTexture: ExternalTextureExtensionType gl_extension = ExternalTextureExtensionType::kNone; @@ -133,13 +127,9 @@ FlutterTizenTextureRegistrar::CreateExternalTexture( gl_extension, texture_info->gpu_surface_config.callback, texture_info->gpu_surface_config.user_data); } -#ifndef WEARABLE_PROFILE return std::make_unique( gl_extension, texture_info->gpu_surface_config.callback, texture_info->gpu_surface_config.user_data); -#else - return nullptr; -#endif } } diff --git a/flutter/shell/platform/tizen/flutter_tizen_view.cc b/flutter/shell/platform/tizen/flutter_tizen_view.cc index 5074790..5ba94a2 100644 --- a/flutter/shell/platform/tizen/flutter_tizen_view.cc +++ b/flutter/shell/platform/tizen/flutter_tizen_view.cc @@ -10,17 +10,13 @@ #ifdef NUI_SUPPORT #include "flutter/shell/platform/tizen/tizen_view_nui.h" #endif -#ifndef WEARABLE_PROFILE #include "flutter/shell/platform/tizen/tizen_renderer_egl.h" -#endif #include "flutter/shell/platform/tizen/tizen_window.h" namespace { #if defined(MOBILE_PROFILE) constexpr double kProfileFactor = 0.7; -#elif defined(WEARABLE_PROFILE) -constexpr double kProfileFactor = 0.4; #elif defined(TV_PROFILE) constexpr double kProfileFactor = 2.0; #else @@ -196,7 +192,6 @@ void FlutterTizenView::OnRotate(int32_t degree) { TizenGeometry geometry = tizen_view_->GetGeometry(); int32_t width = geometry.width; int32_t height = geometry.height; -#ifndef WEARABLE_PROFILE if (dynamic_cast(engine_->renderer())) { rotation_degree_ = degree; // Compute renderer transformation based on the angle of rotation. @@ -221,7 +216,6 @@ void FlutterTizenView::OnRotate(int32_t degree) { std::swap(width, height); } } -#endif engine_->renderer()->ResizeSurface(width, height); diff --git a/flutter/shell/platform/tizen/tizen_evas_gl_helper.h b/flutter/shell/platform/tizen/tizen_evas_gl_helper.h index 578e0b5..9a730ca 100644 --- a/flutter/shell/platform/tizen/tizen_evas_gl_helper.h +++ b/flutter/shell/platform/tizen/tizen_evas_gl_helper.h @@ -1,5 +1,5 @@ // This file is a copy of Tizen's Evas_GL_GLES2_Helpers.h file. -// https://docs.tizen.org/application/native/api/wearable/5.5/group__Evas__GL__GLES2__Helpers.html +// https://docs.tizen.org/application/native/api/iot-headed/6.0/group__Evas__GL__GLES2__Helpers.html /** * @file Evas_GL_GLES2_Helpers.h diff --git a/flutter/shell/platform/tizen/tizen_window_elementary.cc b/flutter/shell/platform/tizen/tizen_window_elementary.cc index 5de664f..3b3840e 100644 --- a/flutter/shell/platform/tizen/tizen_window_elementary.cc +++ b/flutter/shell/platform/tizen/tizen_window_elementary.cc @@ -377,14 +377,9 @@ TizenGeometry TizenWindowElementary::GetGeometry() { } bool TizenWindowElementary::SetGeometry(TizenGeometry geometry) { -#ifndef WEARABLE_PROFILE evas_object_resize(elm_win_, geometry.width, geometry.height); evas_object_move(elm_win_, geometry.left, geometry.top); return true; -#else - FT_LOG(Error) << "SetGeometry is not supported."; - return false; -#endif } TizenGeometry TizenWindowElementary::GetScreenGeometry() { diff --git a/tools/generate_sysroot.py b/tools/generate_sysroot.py index c0fa253..dbb2564 100755 --- a/tools/generate_sysroot.py +++ b/tools/generate_sysroot.py @@ -216,8 +216,8 @@ def main(): help='Force re-downloading of packages') parser.add_argument('-q', '--quiet', action='store_true', help='Suppress log output') - parser.add_argument('--api-version', metavar='VER', default=5.5, type=float, - help='Target API version (defaults to 5.5)') + parser.add_argument('--api-version', metavar='VER', default=6.0, type=float, + help='Target API version (defaults to 6.0)') args = parser.parse_args() if args.out: diff --git a/tools/gn b/tools/gn index 5005fc2..dce2647 100755 --- a/tools/gn +++ b/tools/gn @@ -75,7 +75,7 @@ def to_gn_args(args): gn_args['clang_version'] = get_clang_version(args.target_toolchain) gn_args['api_version'] = args.api_version - gn_args['use_system_cxx'] = args.system_cxx + gn_args['use_system_cxx'] = not args.no_system_cxx for key, val in gn_args.items(): if isinstance(val, bool): @@ -100,8 +100,8 @@ def parse_args(args): parser.add_argument('--target-toolchain', type=str, required=True) parser.add_argument('--target-sysroot', type=str) - parser.add_argument('--api-version', default='5.5', type=str) - parser.add_argument('--system-cxx', default=False, action='store_true') + parser.add_argument('--api-version', default='6.0', type=str) + parser.add_argument('--no-system-cxx', default=False, action='store_true') parser.add_argument('--target-dir', type=str) parser.add_argument('--verbose', default=False, action='store_true')