From c09468bc5ebed5fa425afc35ab46bfe6dc969f80 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Thu, 21 Mar 2024 21:28:09 +0530 Subject: [PATCH 01/16] fixup! [M120 Migration] Languages pak optimization This patch fixes the AssertionError[1] which occurs while desktop build. [1] undefined Grit variable found: is_tizen Reference: https://review.tizen.org/gerrit/291547 Change-Id: I18eda849a0f4a0f5712d082d5f42ad6c85b0d125 Signed-off-by: Manjeet --- tools/grit/grit_rule.gni | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni index f0e7fdf..7956feb 100644 --- a/tools/grit/grit_rule.gni +++ b/tools/grit/grit_rule.gni @@ -96,7 +96,6 @@ import("//tools/grit/grit_args.gni") _strip_resource_files = is_android && is_official_build _js_minifier = "//tools/grit/minify_js.py" _css_minifier = "//tools/grit/minimize_css.py" -grit_defines = [] grit_resource_id_target = "//tools/gritsettings:default_resource_ids" grit_resource_id_file = @@ -115,13 +114,6 @@ if (is_win) { "//tools/gritsettings/startup_resources_win.txt" } -if (is_tizen) { - grit_defines += [ - "-D", - "is_tizen", - ] -} - template("grit") { if (defined(invoker.output_dir)) { _output_dir = invoker.output_dir @@ -202,7 +194,7 @@ template("grit") { rebase_path(depfile, root_build_dir), "--write-only-new=1", "--depend-on-stamp", - ] + _grit_flags + grit_defines + ] + _grit_flags # Add brotli executable if using brotli. if (defined(invoker.use_brotli) && invoker.use_brotli) { -- 2.7.4 From da87b4aadc5c56c4853bc618eab31568521c06bb Mon Sep 17 00:00:00 2001 From: peng1xiao Date: Thu, 21 Mar 2024 17:31:08 +0800 Subject: [PATCH 02/16] [M120 Migration][MM] Supporting ATMOS decoding & checking ATMOS decoding capability - HDMI CEC API is deprecated. - Audio controller API can check soundBar/TV/receiver's capability. Migrated from: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/291012/ https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/291239/ Change-Id: Ibf3813fe5f795fb472eebe2e3a6978951556c84c Signed-off-by: peng1xiao --- packaging/chromium-efl.spec | 9 +++++++ .../renderer/modules/mediasource/media_source.cc | 29 +++++++++++++++++++++- tizen_src/build/BUILD.gn | 13 ++++++++++ tizen_src/build/config/BUILD.gn | 3 +++ tizen_src/build/config/tizen_features.gni | 1 + tizen_src/chromium_impl/media/media_efl.gni | 7 ++++++ tizen_src/ewk/efl_integration/eweb_context.cc | 3 +++ 7 files changed, 64 insertions(+), 1 deletion(-) diff --git a/packaging/chromium-efl.spec b/packaging/chromium-efl.spec index ccc8e52..030e38f 100644 --- a/packaging/chromium-efl.spec +++ b/packaging/chromium-efl.spec @@ -71,6 +71,11 @@ Source1: content_shell.in %else %define __enable_gamepad_latency_test 0 %endif + +%if "%{_vd_cfg_product_type}" != "LFD" && "%{_vd_cfg_product_type}" != "IWB" && "%{?_with_emulator}" != "1" && "%{_vd_cfg_licensing}" == "n" && %{tizen_version} > 60 +%define _tizen_atmos_decoder_enable 1 +%endif + %{?_use_system_icu: %define __use_system_icu %{_use_system_icu}} # Product tv can't utilize system icu due to nacl dependency. %if "%{?profile}" != "tv" && %{tizen_version} == 60 && %{?_use_system_icu: 0}%{!?_use_system_icu: 1} @@ -203,6 +208,9 @@ BuildRequires: pkgconfig(tv-resource-manager) BuildRequires: pkgconfig(tv-resource-information) BuildRequires: pkgconfig(vd-win-util) BuildRequires: pkgconfig(WebProduct) +%if "%{_tizen_atmos_decoder_enable}" == "1" +BuildRequires: pkgconfig(ais-control-settings) +%endif %if %{tizen_version} >= 60 BuildRequires: pkgconfig(resource-center-api) %endif @@ -549,6 +557,7 @@ touch ./tizen_src/downloadable/ewk_api_wrapper_generator.py %endif "ozone_auto_platforms=false" \ "enable_wrt_js=%{macro_to_bool __enable_wrt_js}" \ + "tizen_atmos_decoder_enable=%{macro_to_bool _tizen_atmos_decoder_enable}" \ %if 0%{?__enable_wrt_js} "xwalk_extension_path=\"%{__xwalk_extension_path}\"" \ "xwalk_extension_service_path=\"%{__xwalk_extension_service_path}\"" \ diff --git a/third_party/blink/renderer/modules/mediasource/media_source.cc b/third_party/blink/renderer/modules/mediasource/media_source.cc index 4a8adf9..1f886fd 100644 --- a/third_party/blink/renderer/modules/mediasource/media_source.cc +++ b/third_party/blink/renderer/modules/mediasource/media_source.cc @@ -62,6 +62,9 @@ #include "hdmicec_api.h" #include "tizen_src/chromium_impl/build/tizen_version.h" #include "tizen_src/chromium_impl/tizen/tizen_tv_platform.h" +#if defined(ENABLE_ATMOS_DECODER) +#include +#endif #endif using blink::WebMediaSource; @@ -1735,6 +1738,27 @@ bool MediaSource::IsAV1SupportedOnTizen() { #endif } +bool IsAtmosDecodingSupportedOnTizen(const ContentType& content_type) { +#if defined(ENABLE_ATMOS_DECODER) + int atmos_support = 0; + // audio_ctrl_setting_get_atmos_capability() checks if TV can decode ATMOS + // itself. The function returns 0 when 1) The sound output is not a TV + // speaker. 2) Menu > Sound > Expert Settings > Dolby ATMOS menu OFF. 3) In + // case of Multiview mode. 4) In VR360 mode. + AUDIO_CTRL_SETTING_E ret = AUDIO_CTRL_SETTING_ERR_NONE; + ret = audio_ctrl_setting_get_atmos_capability(&atmos_support); + if (ret != AUDIO_CTRL_SETTING_ERR_NONE) { + LOG(WARNING) << "[ATMOS] AUDIO_CTRL_SETTING_ERR: " << ret; + } + if (atmos_support == 1 && + content_type.Parameter("codecs").FindIgnoringCase("ec-3") != kNotFound && + content_type.Parameter("channels").ToInt() <= 8) { + return true; + } +#endif + return false; +} + bool MediaSource::IsCodecAndMediaTypeSupported( const ContentType& content_type) { DVLOG(1) << __func__ << "MediaSource Extention Type (W=" @@ -1763,7 +1787,10 @@ bool MediaSource::IsCodecAndMediaTypeSupported( } String features = content_type.Parameter("features"); - if (!features.empty()) { + if (features == dolby_eac3_atmos) { + return IsAtmosDecodingSupportedOnTizen(content_type); + } else if (!features.empty()) { + LOG(WARNING) << "The features has invalid parameter: " << features; return false; } diff --git a/tizen_src/build/BUILD.gn b/tizen_src/build/BUILD.gn index 7d3f2a8..4721b99 100644 --- a/tizen_src/build/BUILD.gn +++ b/tizen_src/build/BUILD.gn @@ -670,6 +670,19 @@ if (tizen_multimedia) { } } +config("audio_ctrl_setting") { + if (tizen_atmos_decoder_enable) { + ldflags = [ "-laudio_ctrl_setting" ] + } +} + +tizen_pkg_config("libaudio_ctrl_setting") { + packages = [] + if (tizen_atmos_decoder_enable) { + packages = [ "ais-control-settings" ] + } +} + tizen_pkg_config("libmm-player") { packages = [] if (is_tizen) { diff --git a/tizen_src/build/config/BUILD.gn b/tizen_src/build/config/BUILD.gn index 0c73e19..0773b06 100644 --- a/tizen_src/build/config/BUILD.gn +++ b/tizen_src/build/config/BUILD.gn @@ -71,6 +71,9 @@ config("tizen_feature_flags") { if (tizen_audio_io) { defines += [ "TIZEN_MULTIMEDIA_USE_CAPI_AUDIO_IO" ] } + if (tizen_atmos_decoder_enable) { + defines += [ "ENABLE_ATMOS_DECODER" ] + } if (tizen_autofill) { defines += [ "TIZEN_AUTOFILL" ] if (tizen_autofill_fw) { diff --git a/tizen_src/build/config/tizen_features.gni b/tizen_src/build/config/tizen_features.gni index c754301..027b580 100644 --- a/tizen_src/build/config/tizen_features.gni +++ b/tizen_src/build/config/tizen_features.gni @@ -53,6 +53,7 @@ declare_args() { enable_ewk_interface = false enable_wrt_js = false + tizen_atmos_decoder_enable = false tizen_pepper_extensions = false # Tizen multimedia related diff --git a/tizen_src/chromium_impl/media/media_efl.gni b/tizen_src/chromium_impl/media/media_efl.gni index 02bc620..7b41f67 100644 --- a/tizen_src/chromium_impl/media/media_efl.gni +++ b/tizen_src/chromium_impl/media/media_efl.gni @@ -120,6 +120,13 @@ if (tizen_multimedia) { ] } + if (tizen_atmos_decoder_enable) { + external_media_video_decode_config += [ + "//tizen_src/build:libaudio_ctrl_setting", + "//tizen_src/build:audio_ctrl_setting", + ] + } + external_media_capture_config += [ "//tizen_src/build:capi-media-camera", "//tizen_src/build:libcapi-media-camera", diff --git a/tizen_src/ewk/efl_integration/eweb_context.cc b/tizen_src/ewk/efl_integration/eweb_context.cc index 9da8a8c..dd84743 100644 --- a/tizen_src/ewk/efl_integration/eweb_context.cc +++ b/tizen_src/ewk/efl_integration/eweb_context.cc @@ -277,6 +277,9 @@ void EWebContext::SetTizenAppId(const std::string& tizen_app_id) { auto* plugin = &HbbtvDynamicPlugin::Get(); plugin->Init(injected_bundle_path_); } + // Keep tizen app id into CommandLine in order to access it + // from all over the browser process. + command_line.AppendSwitchASCII(switches::kTizenAppId, tizen_app_id_); #endif // IS_TIZEN_TV #endif // IS_TIZEN } -- 2.7.4 From 6fd842debf6e7ee62750cf3b611eb2eeb24955f7 Mon Sep 17 00:00:00 2001 From: jiangyuwei Date: Tue, 19 Mar 2024 13:33:48 +0800 Subject: [PATCH 03/16] [M120 Migration][VD][AX] Custom the focus event when setFocus to webview Accessibility needs to be informed when system focus has moved into the web area again even if focus did not change within WebCore; And if there is no focus element, try move down to find one. References: - https://review.tizen.org/gerrit/#/c/291817/ Change-Id: I2cc752397b14562e9beaca3ca107d73137750b02 Signed-off-by: jiangyuwei --- .../blink/renderer/core/exported/web_view_impl.cc | 23 ++++++++++++++++++++++ .../blink/renderer/core/page/spatial_navigation.cc | 4 ++++ .../core/page/spatial_navigation_controller.cc | 6 ++++++ .../core/page/spatial_navigation_controller.h | 4 ++++ .../ewk/efl_integration/eweb_accessibility.cc | 6 ++++++ 5 files changed, 43 insertions(+) diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index a1e160c..684ef49 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -209,6 +209,8 @@ #if BUILDFLAG(IS_TIZEN_TV) #include "third_party/blink/public/platform/web_application_type.h" +#include "third_party/blink/renderer/core/page/spatial_navigation_controller.h" +#include "third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h" #include "third_party/blink/public/web/web_security_policy.h" #endif @@ -2015,6 +2017,27 @@ void WebViewImpl::SetPageFocus(bool enable) { SelectionInDOMTree::Builder().Collapse(position).Build()); } } +#if BUILDFLAG(IS_TIZEN_TV) + if (element) { + // Accessibility needs to be informed that system focus has moved + // into the web area again, even if focus did not change within + // WebCore. send the notification even if the element is the same. + AXObjectCache* cache = + focused_frame->GetDocument()->ExistingAXObjectCache(); + if (cache) + cache->HandleFocusedUIElementChanged(0, element); + } else { + // if no focus element and spatial navigation enabled, + // move to the first top element by send a fake arrow down + if (IsSpatialNavigationEnabled(focused_frame) && IsWebBrowser()) { + LOG(INFO) << "No focused element in view, navigate downward"; + GetPage() + ->GetSpatialNavigationController() + .HandleSpatialNavigationDirection( + SpatialNavigationDirection::kDown); + } + } +#endif } } else { CancelPagePopup(); diff --git a/third_party/blink/renderer/core/page/spatial_navigation.cc b/third_party/blink/renderer/core/page/spatial_navigation.cc index 70cb3a8..e430935 100644 --- a/third_party/blink/renderer/core/page/spatial_navigation.cc +++ b/third_party/blink/renderer/core/page/spatial_navigation.cc @@ -610,11 +610,15 @@ bool BothOnTopmostPaintLayerInStackingContext( return false; const LayoutObject* origin = current_interest.visible_node->GetLayoutObject(); + if (!origin) + return false; const PaintLayer* focused_layer = origin->PaintingLayer(); if (!focused_layer || focused_layer->IsRootLayer()) return false; const LayoutObject* next = candidate.visible_node->GetLayoutObject(); + if (!next) + return false; const PaintLayer* candidate_layer = next->PaintingLayer(); if (focused_layer != candidate_layer) return false; diff --git a/third_party/blink/renderer/core/page/spatial_navigation_controller.cc b/third_party/blink/renderer/core/page/spatial_navigation_controller.cc index 9886254..0f3e1a9 100644 --- a/third_party/blink/renderer/core/page/spatial_navigation_controller.cc +++ b/third_party/blink/renderer/core/page/spatial_navigation_controller.cc @@ -606,4 +606,10 @@ void SpatialNavigationController::FullscreenStateChanged(Element* element) { } } +#if BUILDFLAG(IS_TIZEN_TV) +bool SpatialNavigationController::HandleSpatialNavigationDirection( + SpatialNavigationDirection direction) { + return Advance(direction); +} +#endif } // namespace blink diff --git a/third_party/blink/renderer/core/page/spatial_navigation_controller.h b/third_party/blink/renderer/core/page/spatial_navigation_controller.h index 8354679..01311b6 100644 --- a/third_party/blink/renderer/core/page/spatial_navigation_controller.h +++ b/third_party/blink/renderer/core/page/spatial_navigation_controller.h @@ -48,6 +48,10 @@ class CORE_EXPORT SpatialNavigationController final void Trace(Visitor*) const; +#if BUILDFLAG(IS_TIZEN_TV) + bool HandleSpatialNavigationDirection(SpatialNavigationDirection direction); +#endif + private: // Entry-point into SpatialNavigation advancement. Will return true if an // action (moving interest or scrolling), false otherwise. diff --git a/tizen_src/ewk/efl_integration/eweb_accessibility.cc b/tizen_src/ewk/efl_integration/eweb_accessibility.cc index 0882ef4..c3702dd 100644 --- a/tizen_src/ewk/efl_integration/eweb_accessibility.cc +++ b/tizen_src/ewk/efl_integration/eweb_accessibility.cc @@ -81,8 +81,14 @@ void EWebAccessibility::NotifyAccessibilityStatus(bool is_enabled) { if (IsMobileProfile() || IsTvProfile()) (is_enabled) ? AddPlug() : RemovePlug(); +// On TV, the Spatial Navigation and Accessibility are independent, the +// Accessibility Status change should not trigger Spatial Navigation status +// change. So disbale trigger SpatialNavigationStatusChange when +// AccessibilityStatusChanged. +#if !BUILDFLAG(IS_TIZEN_TV) if (observer_) { observer_->OnSpatialNavigationStatusChanged(is_enabled); observer_->OnAccessibilityStatusChanged(is_enabled); } +#endif } -- 2.7.4 From 53bb9e3daf8f45d9609a60445b8bc88bae1a36c9 Mon Sep 17 00:00:00 2001 From: liwei90727 Date: Tue, 12 Mar 2024 14:38:36 +0800 Subject: [PATCH 04/16] [M120 Migration][WRTjs] Support NavigationPolicy on decide Navigation From M108, OnDecideNavigationPolicy() doesn't have logic for open media, only logic related with NavigationPolicy. Reference Patch https://review.tizen.org/gerrit/271794/ https://review.tizen.org/gerrit/230348/ Change-Id: Id51431ea975a7625061f89a1589a9893bdd3a716 Signed-off-by: liwei90727 --- wrt/src/browser/wrt_render_message_filter.cc | 72 +++++++++++++++------------- wrt/src/browser/wrt_render_message_filter.h | 28 ++++------- 2 files changed, 49 insertions(+), 51 deletions(-) mode change 100755 => 100644 wrt/src/browser/wrt_render_message_filter.cc mode change 100755 => 100644 wrt/src/browser/wrt_render_message_filter.h diff --git a/wrt/src/browser/wrt_render_message_filter.cc b/wrt/src/browser/wrt_render_message_filter.cc old mode 100755 new mode 100644 index 5fe9e7e..bfd8ab8 --- a/wrt/src/browser/wrt_render_message_filter.cc +++ b/wrt/src/browser/wrt_render_message_filter.cc @@ -2,56 +2,64 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "wrt_render_message_filter.h" +#include "wrt/src/browser/wrt_render_message_filter.h" -#if !defined(WRT_JS_BRINGUP) -#include "tizen_src/chromium_impl/content/public/browser/policy_decision_util.h" -#endif +#include "third_party/blink/public/web/web_navigation_policy.h" +#include "tizen_src/ewk/efl_integration/common/render_messages_ewk.h" #include "tizen_src/ewk/efl_integration/private/ewk_policy_decision_private.h" #include "wrt/src/browser/native_web_runtime.h" -#include "wrt/src/browser/wrt_browser_context.h" namespace { -static void NavigationPolicyDecision(void* /*data*/, - const std::string& url, - void* event_info) { - if (!event_info) { - LOG(ERROR) << "event_info is nullptr"; - return; - } - - auto policy_decision = static_cast<_Ewk_Policy_Decision*>(event_info); - if (wrt::NativeWebRuntime::GetInstance().ShouldAllowNavigation(url)) - policy_decision->Use(); - else - policy_decision->Ignore(); -} +const uint32_t kFilteredMessageClasses[] = {EwkMsgStart}; } // namespace namespace wrt { -WRTRenderMessageFilter::WRTRenderMessageFilter() {} +WRTRenderMessageFilter::WRTRenderMessageFilter() + : BrowserMessageFilter(kFilteredMessageClasses, + std::size(kFilteredMessageClasses)) {} WRTRenderMessageFilter::~WRTRenderMessageFilter() {} +void WRTRenderMessageFilter::OverrideThreadForMessage( + const IPC::Message& message, + content::BrowserThread::ID* thread) { + switch (message.type()) { + case EwkHostMsg_DecideNavigationPolicy::ID: + *thread = content::BrowserThread::UI; + break; + } +} + +bool WRTRenderMessageFilter::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(WRTRenderMessageFilter, message) + IPC_MESSAGE_HANDLER(EwkHostMsg_DecideNavigationPolicy, + OnDecideNavigationPolicy) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + void WRTRenderMessageFilter::OnDecideNavigationPolicy( - const NavigationPolicyParams& params, + NavigationPolicyParams params, bool* handled) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); -#if defined(WRT_JS_BRINGUP) - *handled = false; -#else - std::unique_ptr navigation( - new content::PolicyDecisionUtil()); - auto* browser_context = WRTBrowserContext::GetInstance(); - DCHECK(browser_context); - navigation->SetNavigationPolicyDecisionCallback(NavigationPolicyDecision); - navigation->PolicyNavigation(params, browser_context->GetProxyURI(), handled, - nullptr); -#endif + std::unique_ptr<_Ewk_Policy_Decision> policy_decision( + new _Ewk_Policy_Decision(params)); + + if (NativeWebRuntime::GetInstance().ShouldAllowNavigation(params.url.spec())) + policy_decision->Use(); + else + policy_decision->Ignore(); + + CHECK(!policy_decision->isSuspended()); + + *handled = policy_decision->GetNavigationPolicyHandler()->GetDecision() == + NavigationPolicyHandlerEfl::Handled; } } // namespace wrt diff --git a/wrt/src/browser/wrt_render_message_filter.h b/wrt/src/browser/wrt_render_message_filter.h old mode 100755 new mode 100644 index ef3b992..638f374 --- a/wrt/src/browser/wrt_render_message_filter.h +++ b/wrt/src/browser/wrt_render_message_filter.h @@ -5,36 +5,26 @@ #ifndef BROWSER_WRT_RENDER_MESSAGE_FILTER_H #define BROWSER_WRT_RENDER_MESSAGE_FILTER_H -#if defined(WRT_JS_BRINGUP) +#include "base/threading/thread.h" +#include "content/public/browser/browser_associated_interface.h" #include "content/public/browser/browser_message_filter.h" + struct NavigationPolicyParams; -namespace content { -class BrowserMessageFilterCommon : public content::BrowserMessageFilter { - public: - bool OnMessageReceived(const IPC::Message& message) override { return false; } - virtual void OnDecideNavigationPolicy(const NavigationPolicyParams&, - bool* handled) {} -}; -} -#else -#include "tizen_src/chromium_impl/content/browser/message_filter/browser_message_filter_common.h" -#endif namespace wrt { -class WRTRenderMessageFilter - : public content::BrowserMessageFilterCommon { +class WRTRenderMessageFilter : public content::BrowserMessageFilter { public: WRTRenderMessageFilter(); ~WRTRenderMessageFilter(); - WRTRenderMessageFilter(const WRTRenderMessageFilter&) = delete; - WRTRenderMessageFilter& operator=(const WRTRenderMessageFilter&) = delete; + // BrowserMessageFilter methods: + bool OnMessageReceived(const IPC::Message&) override; + void OverrideThreadForMessage(const IPC::Message&, + content::BrowserThread::ID*) override; private: - // override content::BrowserMessageFilterCommon - void OnDecideNavigationPolicy(const NavigationPolicyParams&, - bool* handled) override; + void OnDecideNavigationPolicy(NavigationPolicyParams, bool* handled); }; } // namespace wrt -- 2.7.4 From 468917def4930b188c5bbf3963a74d5e5a4a9b94 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 25 Mar 2024 09:41:40 +0900 Subject: [PATCH 05/16] [M120 Migration][WRTjs][VD] Use ps-agent mount for appzone enabled model direct mount's mount_namespace is changed when appzone container is enabled. Then, chromium initilization can be failed since mount point's internal path cannot be accessible. So, for the enterprise models, it will disable direct mount Reference: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/308292/ Change-Id: I100c872832197578108232020bfe21627e6fe992 Signed-off-by: DongHyun Song --- packaging/chromium-efl.spec | 6 ++ tizen_src/build/config/BUILD.gn | 4 + tizen_src/build/config/tizen_features.gni | 2 + tizen_src/build/gn_chromiumefl.sh | 8 ++ tizen_src/downloadable/BUILD.gn | 7 +- tizen_src/downloadable/ewk_interface_main.cc | 108 ++++++++++++++++++++++++--- 6 files changed, 123 insertions(+), 12 deletions(-) diff --git a/packaging/chromium-efl.spec b/packaging/chromium-efl.spec index 030e38f..aace036 100644 --- a/packaging/chromium-efl.spec +++ b/packaging/chromium-efl.spec @@ -528,6 +528,12 @@ touch ./tizen_src/downloadable/ewk_api_wrapper_generator.py %if "%{?tizen_profile_name}" == "tv" && "%{_vd_cfg_product_type}" != "AUDIO" && "%{_vd_cfg_product_type}" != "AV" && %{__build_chrome} != 1 "tizen_vd_accessory=true" \ %endif +%if "%{_vd_cfg_product_type}" == "LFD" + "tizen_vd_lfd=true" \ +%endif +%if "%{_vd_cfg_product_type}" == "IWB" + "tizen_vd_iwb=true" \ +%endif %if 0%{?component_build} "component=\"shared_library\"" \ %endif diff --git a/tizen_src/build/config/BUILD.gn b/tizen_src/build/config/BUILD.gn index 0773b06..fa23ca0 100644 --- a/tizen_src/build/config/BUILD.gn +++ b/tizen_src/build/config/BUILD.gn @@ -122,4 +122,8 @@ config("tizen_feature_flags") { if (drm_mapi_aarch_64) { defines += [ "DRM_MAPI_AARCH_64" ] } + + if (tizen_vd_lfd || tizen_vd_iwb) { + defines += ["TIZEN_VD_ENTERPRISE_FEATURE" ] + } } diff --git a/tizen_src/build/config/tizen_features.gni b/tizen_src/build/config/tizen_features.gni index 027b580..f98fd04 100644 --- a/tizen_src/build/config/tizen_features.gni +++ b/tizen_src/build/config/tizen_features.gni @@ -32,6 +32,8 @@ declare_args() { tizen_product_tv = false tizen_product_da = false + tizen_vd_lfd = false + tizen_vd_iwb = false exe_dir = "/usr/lib/chromium-efl/" lib_ro_root_dir = "/usr/share/chromium-efl" diff --git a/tizen_src/build/gn_chromiumefl.sh b/tizen_src/build/gn_chromiumefl.sh index 4dd81c6..ec70017 100755 --- a/tizen_src/build/gn_chromiumefl.sh +++ b/tizen_src/build/gn_chromiumefl.sh @@ -267,6 +267,14 @@ add_tizen_flags() { ADDITIONAL_GN_PARAMETERS+="tizen_video_hole=false " fi + + if [ "$tizen_vd_lfd" == "true" ]; then + ADDITIONAL_GN_PARAMETERS+="tizen_vd_lfd=true" + fi + + if [ "$tizen_vd_iwb" == "true" ]; then + ADDITIONAL_GN_PARAMETERS+="tizen_vd_iwb=true" + fi } add_wayland_flags() { diff --git a/tizen_src/downloadable/BUILD.gn b/tizen_src/downloadable/BUILD.gn index f209c4b..b2351a1 100644 --- a/tizen_src/downloadable/BUILD.gn +++ b/tizen_src/downloadable/BUILD.gn @@ -40,7 +40,12 @@ shared_library("ewk-interface") { defines += [ "LIB_UPGRADE_ROOT_DIR=\"$lib_upgrade_root_dir\"", ] - libs += [ "launchpad", "lwipc", "ttrace", "vconf" ] + configs += [ + "//tizen_src/build:libcapi-system-info", + "//tizen_src/build:launchpad", + "//tizen_src/build:vconf" + ] + libs += [ "capi-system-info", "lwipc", "ttrace", "vconf", "launchpad" ] } } diff --git a/tizen_src/downloadable/ewk_interface_main.cc b/tizen_src/downloadable/ewk_interface_main.cc index 2857e01..628a68c 100644 --- a/tizen_src/downloadable/ewk_interface_main.cc +++ b/tizen_src/downloadable/ewk_interface_main.cc @@ -47,10 +47,11 @@ #include #include #include -#include +#include +#include #if TIZEN_VERSION_AT_LEAST(8, 0, 0) && defined(TIZEN_VD_ENTERPRISE_FEATURE) -#include +#include #endif #endif // BUILDFLAG(IS_TIZEN_TV) #endif @@ -67,14 +68,15 @@ inline unsigned long long ConvertMilliseconds(timespec ts) { #if BUILDFLAG(IS_TIZEN_TV) bool g_upgrade_lib = false; // conservative policy const char* kChromiumMountReady = "/tmp/.chromium_mount.ready"; -#endif // BUILDFLAG(IS_TIZEN_TV) #if defined(ENABLE_WRT_JS) -#if BUILDFLAG(IS_TIZEN_TV) #define SQUASHFS_MAGIC 0x73717368 +const char* kPrivilegeServiceLibPath = "libprivileged-service-client.so"; +const char* kPSAgentReady = "/run/ps_agent.pid"; const char* kUWETag = "USE_UWE"; const char* kWrtLoaderCompleted = "/tmp/.wrt_loader.completed"; +const unsigned int kPSAgentTimeout = 30000; #if TIZEN_VERSION_AT_LEAST(8, 0, 0) && defined(TIZEN_VD_ENTERPRISE_FEATURE) const int kBooTypeLastModeUrlLauncher = 2; @@ -82,10 +84,10 @@ const char* kEPAppbootType = "db/ep-common/last_mode"; #endif char app_define_base_path[128] = {0}; -bool direct_mounted = false; +bool try_mounted = false; bool IsFirstWrtLoader() { - return direct_mounted || access(kWrtLoaderCompleted, F_OK) != 0; + return try_mounted || access(kWrtLoaderCompleted, F_OK) != 0; } void DisposeLoaderIfNecessary() { @@ -138,6 +140,83 @@ void LowerPriorityIfNecessary() { SetPriority(10); } +bool WaitPSAgentReady() { + static bool ps_agent_ready = false; + if (ps_agent_ready) + return true; + + int max_retry = 20; + LOG(INFO) << "Waiting the ps_agent ready"; + while (max_retry != 0) { + int ret = LwipcWaitEvent(kPSAgentReady, kPSAgentTimeout); + if (ret == 0) { + LOG(INFO) << "ps_agent is ready"; + ps_agent_ready = true; + return true; + } + + --max_retry; + LOG(ERROR) << "ps_agent is not ready : " << (ret > 0 ? "timeout" : "fail") + << ", remain retry [" << max_retry << "]"; + } + + return false; +} + +bool PSAgentMount(const char* image_path) { + if (access(image_path, F_OK) != 0) { + LOG(INFO) << "no chromium-efl.img"; + return false; + } + + if (WaitPSAgentReady() == false) + LOG(ERROR) << "Chromium-efl mount may not work."; + + int rv = 0; + int result = 0; + const char* args = MOUNT_ARGS_PRELOAD_CHROMIUM; + + LOG(INFO) << "mount args: \"" << args << "\""; + + auto ps_handle_ = dlopen(kPrivilegeServiceLibPath, RTLD_LAZY); + if (!ps_handle_) { + LOG(ERROR) << "dlopen() fail : " << dlerror(); + return false; + } + typedef int (*ps_mount)(const char*, size_t, int, int*); + ps_mount PS_Mount = nullptr; +#if TIZEN_VERSION_AT_LEAST(7, 0, 0) + PS_Mount = (ps_mount)dlsym(ps_handle_, "PS_Mount_Fast"); +#else + PS_Mount = (ps_mount)dlsym(ps_handle_, "PS_Mount"); +#endif + if (!PS_Mount) { + LOG(ERROR) << "dlsym() fail : " << dlerror(); + return false; + } + rv = PS_Mount(args, strlen(args) + 1, 1, &result); + LOG(INFO) << "result = " << rv << ", " << result; + if (rv != 0 || result != 0) { + LOG(ERROR) << "mount failed. (" << rv << ", " << result << ")"; + return false; + } + return true; +} + +bool IsAppzoneSupport() { + bool web_isolation_support = false; + LOG(INFO) << "fms get start"; + if (SYSTEM_INFO_ERROR_NONE == + system_info_get_custom_bool( + "com.samsung/featureconf/security.container.web_isolation", + &web_isolation_support)) { + LOG(INFO) << "fms get end"; + return web_isolation_support; + } else { + return false; + } +} + bool DirectMount(const char* image_path, const char* point_point) { const char* dev_loop_control = "/dev/loop-control"; const char* dev_loop_prefix = "/dev/loop"; @@ -199,11 +278,18 @@ bool MountDefaultChromiumImage() { return true; } - if (!DirectMount(PATH_PRELOAD_CHROMIUM_EFL_IMG, LIB_RO_ROOT_DIR)) { - LOG(ERROR) << "Direct mount has failed, will wait efl-install-service"; - return false; + if (IsAppzoneSupport()) { + if (!PSAgentMount(PATH_PRELOAD_CHROMIUM_EFL_IMG)) { + LOG(ERROR) << "pa-agent mount has failed, will wait efl-install-service"; + return false; + } + } else { + if (!DirectMount(PATH_PRELOAD_CHROMIUM_EFL_IMG, LIB_RO_ROOT_DIR)) { + LOG(ERROR) << "Direct mount has failed, will wait efl-install-service"; + return false; + } } - direct_mounted = true; + try_mounted = true; return true; } @@ -239,8 +325,8 @@ void TryOpenAppDefinedLib() { return; } } +#endif // defined(ENABLE_WRT_JS) #endif // BUILDFLAG(IS_TIZEN_TV) -#endif void* open_library() { if (g_impl_lib_handle) -- 2.7.4 From b7f997f4fb4c95179220de1884441cfe53a58fb4 Mon Sep 17 00:00:00 2001 From: "feifei08.liu" Date: Fri, 22 Mar 2024 18:45:49 +0800 Subject: [PATCH 06/16] [M120 Migration][VD] Add debug log for create new window process. Add some debug logs in window create process. Sometimes window.open()/target="_blank" will create a new window in app. Currently wrt not support this situation. Add some logs for locating similar issue in furture. Reference: - https://review.tizen.org/gerrit/291159/ Change-Id: I15dba40f38522b42d5cda9eea0ecf406da111c1c Signed-off-by: feifei08.liu --- content/browser/renderer_host/navigation_controller_impl.cc | 4 ++++ content/renderer/render_frame_impl.cc | 3 +++ .../content/browser/web_contents/web_contents_impl_efl.cc | 6 ++++-- tizen_src/ewk/efl_integration/eweb_view.cc | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index 93ac168..8de75f8 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc @@ -1275,6 +1275,10 @@ base::WeakPtr NavigationControllerImpl::LoadURLWithParams( if (params.is_renderer_initiated) DCHECK(params.initiator_origin.has_value()); +#if BUILDFLAG(IS_TIZEN_TV) + LOG(ERROR) << "url: " << params.url.possibly_invalid_spec(); +#endif + TRACE_EVENT1("browser,navigation", "NavigationControllerImpl::LoadURLWithParams", "url", params.url.possibly_invalid_spec()); diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index be31843..c9c6c3e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -6513,6 +6513,9 @@ WebView* RenderFrameImpl::CreateNewWindow( const absl::optional& pip_options, const blink::WebURL& base_url) { consumed_user_gesture = false; +#if BUILDFLAG(IS_TIZEN_TV) + LOG(ERROR) << __FUNCTION__; +#endif mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); // The user activation check is done at the browser process through diff --git a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc index be4ba5c..be6905d 100644 --- a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc +++ b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc @@ -123,8 +123,7 @@ FrameTree* WebContentsImplEfl::CreateNewWindow( bool has_user_gesture, SessionStorageNamespace* session_storage_namespace) { // Added for EFL implementation - LOG(INFO) << __FUNCTION__ << ", opener:" << opener - << ", target url: " << params.target_url; + LOG(INFO) << "opener:" << opener << ", target url: " << params.target_url; WebContents* new_contents = nullptr; WebViewDelegate::WebContentsCreateCallback callback = base::BindRepeating( &WebContentsImplEfl::HandleNewWebContentsCreate, base::Unretained(this), @@ -159,6 +158,9 @@ WebContents* WebContentsImplEfl::HandleNewWebContentsCreate( SessionStorageNamespace* session_storage_namespace, WebContents** new_contents_out, void* platform_data) { +#if BUILDFLAG(IS_TIZEN_TV) + LOG(ERROR) << __FUNCTION__; +#endif platform_data_for_new_window_ = platform_data; WebContentsImpl::CreateNewWindow(opener, params, is_new_browsing_instance, has_user_gesture, session_storage_namespace); diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 62823cf..22539f1 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -633,6 +633,9 @@ bool EWebView::SetPageVisibility( bool EWebView::CreateNewWindow( content::WebViewDelegate::WebContentsCreateCallback cb) { +#if BUILDFLAG(IS_TIZEN_TV) + LOG(INFO) << __FUNCTION__; +#endif create_new_window_web_contents_cb_ = cb; Evas_Object* new_object = NULL; SmartCallback().call(&new_object); -- 2.7.4 From c17019af0cf7b0f69e8bcd873d3645ec61ce6048 Mon Sep 17 00:00:00 2001 From: jingjieli Date: Fri, 22 Mar 2024 11:37:24 +0800 Subject: [PATCH 07/16] [M120 Migration][VD]add new log tag for http request and response log Log Tag, "CHROMIUM_NETWORK" is added to separate a http network log from the log being printed with Log Tag, "CHROMIUM". It is to prevent lots of log from being printed with Log Tag, "CHROMIUM" Reference: https://review.tizen.org/gerrit/#/c/292083/ Change-Id: I59a2f2d106be723ffc8c3165035f0dabd857baca Signed-off-by: jingjieli --- net/http/http_stream_parser.cc | 17 +++++++++++++++++ net/quic/quic_http_stream.cc | 25 +++++++++++++++++++++++++ net/spdy/spdy_http_stream.cc | 26 ++++++++++++++++++++++++++ tizen_src/chromium_impl/base/base_efl.gni | 5 +++++ 4 files changed, 73 insertions(+) diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 3fd45a6..e185f9a 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -34,6 +34,10 @@ #include "net/ssl/ssl_info.h" #include "url/url_canon.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "tizen_src/chromium_impl/base/logging_network.h" +#endif + namespace net { namespace { @@ -223,6 +227,11 @@ int HttpStreamParser::SendRequest( std::string request = request_line + headers.ToString(); request_headers_length_ = request.size(); +#if BUILDFLAG(IS_TIZEN_TV) + NET_LOGD("Request URL: %s", request_->url.spec().c_str()); + NET_LOGD("Request:\n%s\n", request.c_str()); +#endif + if (request_->upload_data_stream != nullptr) { request_body_send_buf_ = base::MakeRefCounted(kRequestBodyBufferSize); @@ -1042,6 +1051,14 @@ int HttpStreamParser::ParseResponseHeaders(int end_offset) { << response_->headers->GetContentLength() << "\n\"" << " headers = \"" << GetResponseHeaderLines(*response_->headers) << "\""; + +#if BUILDFLAG(IS_TIZEN_TV) + NET_LOGD("Response URL: %s", request_->url.spec().c_str()); + NET_LOGD("Response:\n%scontent_length: %lld\n", + GetResponseHeaderLines(*response_->headers).c_str(), + response_->headers->GetContentLength()); +#endif + return OK; } diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc index e26c116..27687f3 100644 --- a/net/quic/quic_http_stream.cc +++ b/net/quic/quic_http_stream.cc @@ -33,6 +33,10 @@ #include "url/origin.h" #include "url/scheme_host_port.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "tizen_src/chromium_impl/base/logging_network.h" +#endif + namespace net { QuicHttpStream::QuicHttpStream( @@ -172,6 +176,11 @@ int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers, if (rv == ERR_IO_PENDING) callback_ = std::move(callback); +#if BUILDFLAG(IS_TIZEN_TV) + NET_LOGD("Request URL: %s", request_info_->url.spec().c_str()); + NET_LOGD("Request Header: %s", request_headers.ToString().c_str()); +#endif + return rv > 0 ? OK : MapStreamError(rv); } @@ -603,6 +612,22 @@ int QuicHttpStream::ProcessResponseHeaders( return ERR_QUIC_PROTOCOL_ERROR; } +#if BUILDFLAG(IS_TIZEN_TV) + if (request_info_) + NET_LOGD("Response URL: %s", request_info_->url.spec().c_str()); + else + NET_LOGD("Response URL: Error, no request info"); + + HttpResponseHeaders* response_headers = response_info_->headers.get(); + std::string response_header = response_headers->GetStatusLine(); + response_header.push_back('\n'); + size_t iter = 0; + std::string name, value; + while (response_headers->EnumerateHeaderLines(&iter, &name, &value)) + response_header.append(name).append(": ").append(value).push_back('\n'); + NET_LOGD("Response Header: %s\n", response_header.c_str()); +#endif + if (response_info_->headers->response_code() == HTTP_EARLY_HINTS) { DCHECK(!response_headers_received_); headers_bytes_received_ = 0; diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index d16f6a5..60d1813 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc @@ -29,6 +29,11 @@ #include "net/third_party/quiche/src/quiche/spdy/core/spdy_protocol.h" #include "url/scheme_host_port.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "net/http/http_response_headers.h" +#include "tizen_src/chromium_impl/base/logging_network.h" +#endif + namespace net { // Align our request body with |kMaxSpdyFrameChunkSize| to prevent unexpected @@ -238,6 +243,11 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers, return result; response_info_->remote_endpoint = address; +#if BUILDFLAG(IS_TIZEN_TV) + NET_LOGD("Request URL: %s", request_info_->url.spec().c_str()); + NET_LOGD("Request Header: %s", request_headers.ToString().c_str()); +#endif + spdy::Http2HeaderBlock headers; CreateSpdyHeadersFromHttpRequest(*request_info_, priority_, request_headers, &headers); @@ -305,6 +315,22 @@ void SpdyHttpStream::OnHeadersReceived( return; } +#if BUILDFLAG(IS_TIZEN_TV) + if (request_info_) + NET_LOGD("Response URL: %s", request_info_->url.spec().c_str()); + else + NET_LOGD("Response URL: Error, no request info"); + + HttpResponseHeaders* headers = response_info_->headers.get(); + std::string response_header = headers->GetStatusLine(); + response_header.push_back('\n'); + size_t iter = 0; + std::string name, value; + while (headers->EnumerateHeaderLines(&iter, &name, &value)) + response_header.append(name).append(": ").append(value).push_back('\n'); + NET_LOGD("Response Header: %s\n", response_header.c_str()); +#endif + response_info_->response_time = stream_->response_time(); // Don't store the SSLInfo in the response here, HttpNetworkTransaction // will take care of that part. diff --git a/tizen_src/chromium_impl/base/base_efl.gni b/tizen_src/chromium_impl/base/base_efl.gni index 83210b2..9a4ff42 100644 --- a/tizen_src/chromium_impl/base/base_efl.gni +++ b/tizen_src/chromium_impl/base/base_efl.gni @@ -22,3 +22,8 @@ external_base_sources = [ "//tizen_src/chromium_impl/base/message_loop/message_pump_for_ui_efl.h", "//tizen_src/chromium_impl/base/trace_event/ttrace.h", ] + +if (tizen_product_tv) { + external_base_sources += + [ "//tizen_src/chromium_impl/base/logging_network.h" ] +} -- 2.7.4 From 97254b3e4e80005ffcec03ecebfce0774e94ce60 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 25 Mar 2024 13:18:34 +0530 Subject: [PATCH 08/16] fixup! Enable autofill for desktop Some of the changes got missed in the parent commit. Change-Id: I58662590dff6a27dcf361031078b1c68b5f6187c Signed-off-by: Chandan Padhi --- tizen_src/build/config/BUILD.gn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tizen_src/build/config/BUILD.gn b/tizen_src/build/config/BUILD.gn index fa23ca0..2742003 100644 --- a/tizen_src/build/config/BUILD.gn +++ b/tizen_src/build/config/BUILD.gn @@ -20,6 +20,9 @@ config("tizen_feature_flags") { if (ewk_bringup) { defines += [ "EWK_BRINGUP" ] } + if (tizen_autofill) { + defines += [ "TIZEN_AUTOFILL" ] + } if (is_tizen) { defines += [ "OS_TIZEN", @@ -75,7 +78,6 @@ config("tizen_feature_flags") { defines += [ "ENABLE_ATMOS_DECODER" ] } if (tizen_autofill) { - defines += [ "TIZEN_AUTOFILL" ] if (tizen_autofill_fw) { defines += [ "TIZEN_AUTOFILL_FW" ] } -- 2.7.4 From 44aeebae032cbc5a2582b26f88e9137362eee66f Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Thu, 21 Mar 2024 13:50:58 +0800 Subject: [PATCH 09/16] Fixup![Gamepad]fix coredump when gamepad disconnect. Gamepad connect/disconnect callback is invoked in mainthread, and gamepad read is invoked in polling thread. when gamepad disconnect, OCIGamepadItem will be accessed in mainthread and polling thread, mainthread destoring OCIGamepadItem while polling thread is still use it, that could make crash. solution: Moving all handle of OCIGamepadItem to polling thread to avoid issue. Change-Id: I3bfda2112ee78b9cf7a16ed2e92d091182a73bba Signed-off-by: Yu Yang --- .../gamepad_platform_data_fetcher_tizen_tv.cc | 125 ++++++++++++--------- .../gamepad_platform_data_fetcher_tizen_tv.h | 7 ++ .../browser/gamepad/oci_gamepad_item.cc | 13 ++- .../browser/gamepad/oci_gamepad_item.h | 4 +- 4 files changed, 90 insertions(+), 59 deletions(-) diff --git a/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.cc b/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.cc index fc0eaba..608527d 100644 --- a/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.cc +++ b/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.cc @@ -90,20 +90,10 @@ void GamepadPlatformDataFetcherTizenTV::MapperTizenStyleGamepad( GamepadPlatformDataFetcherTizenTV::GamepadPlatformDataFetcherTizenTV() { gamepad_manager_ = nullptr; - if (Gamepad_Create()) { -#if TIZEN_VERSION_AT_LEAST(8, 0, 0) - // initialize autoinput - VirtualKey_Initialize("gamepad-service"); -#endif - Initialize(); - } else { - LOG(ERROR) << "[Gamepad_LOG] " - "GamepadPlatformDataFetcherTizenTV::" - "GamepadPlatformDataFetcherTizenTV() Gamepad_Create() ERROR " - "!!!"; - } + polling_runner_ = nullptr; } +// invoked in polling thread GamepadPlatformDataFetcherTizenTV::~GamepadPlatformDataFetcherTizenTV() { CHECK(gamepad_manager_ != nullptr); gamepad_manager_->UnregisterCallback(this); @@ -217,6 +207,26 @@ void GamepadPlatformDataFetcherTizenTV::GetGamepadData( } } +// OnAddedToProvider is called in polling thread in initialize time +// gamepad initialize should be done here instead of constructor. +void GamepadPlatformDataFetcherTizenTV::OnAddedToProvider() { + polling_runner_ = base::SingleThreadTaskRunner::GetCurrentDefault(); + DCHECK(polling_runner_); + + if (Gamepad_Create()) { +#if TIZEN_VERSION_AT_LEAST(8, 0, 0) + // initialize autoinput + VirtualKey_Initialize("gamepad-service"); +#endif + Initialize(); + } else { + LOG(ERROR) << "[Gamepad_LOG] " + "GamepadPlatformDataFetcherTizenTV::" + "GamepadPlatformDataFetcherTizenTV() Gamepad_Create() ERROR " + "!!!"; + } +} + GamepadSource GamepadPlatformDataFetcherTizenTV::source() { return Factory::static_source(); } @@ -270,10 +280,54 @@ void GamepadPlatformDataFetcherTizenTV::InitMapping(size_t index) { UTF8toUTF16(pad.id, sizeof(pad.id), id, Gamepad::kIdLengthCap); } +void GamepadPlatformDataFetcherTizenTV::HandleGamepadConnectionStatus( + int type, + const OCIDevInfo& deviceinfo) { + LOG(INFO) << " deviceinfo.UID " << deviceinfo.UID << " deviceinfo.name " + << deviceinfo.name; + + switch (type) { + case OCI_EVENT_DEV_CONNECT: { + for (size_t i = 0; i < Gamepads::kItemsLengthCap; i++) { + if (gamepad_items_[i] == nullptr) { + LOG(INFO) << " connected"; + gamepad_items_[i] = OCIGamepadItem::Create( + gamepad_manager_, &deviceinfo, &data_.items[i], i); + if (gamepad_items_[i]) { + InitMapping(i); + break; + } + } + } + break; + } + + case OCI_EVENT_DEV_DISCONNECT: { + for (size_t i = 0; i < Gamepads::kItemsLengthCap; i++) { + if (gamepad_items_[i] != nullptr && + (strcmp(gamepad_items_[i]->GetUID(), deviceinfo.UID) == 0)) { + LOG(INFO) << " gamepad_items_[" << i << "]->GetUID() " + << gamepad_items_[i]->GetUID(); + gamepad_items_[i]->Shutdown(); + gamepad_items_[i] = nullptr; + break; + } + } + break; + } + default: { + break; + } + } +} void GamepadPlatformDataFetcherTizenTV::t_OnCallback(int type, void* pparam1, void* pparam2, void* pparam3) { + LOG(INFO) << "[Gamepad_LOG] t_OnCallback"; + LOG(INFO) << type << " pparam1 " << reinterpret_cast(pparam1); + LOG(INFO) << type << " pparam2 " << reinterpret_cast(pparam2); + int evType = 0; OCIDevInfo dev_info; std::string sType = ""; @@ -283,7 +337,6 @@ void GamepadPlatformDataFetcherTizenTV::t_OnCallback(int type, else if (type == OCI_EVENT_DEV_DISCONNECT) sType = " DISCONNECT "; - LOG(INFO) << sType << " pparam1 " << reinterpret_cast(pparam1); #if TIZEN_VERSION_AT_LEAST(8, 0, 0) strncpy(dev_info.UID, (char*)pparam1, OCI_SIZE_ID - 1); strncpy(dev_info.name, (char*)pparam2, OCI_SIZE_NAME - 1); @@ -312,45 +365,13 @@ void GamepadPlatformDataFetcherTizenTV::t_OnCallback(int type, } #endif - switch (type) { - case OCI_EVENT_DEV_CONNECT: { - for (size_t i = 0; i < Gamepads::kItemsLengthCap; i++) { - if (gamepad_items_[i] == nullptr) { - LOG(INFO) << " connected"; - gamepad_items_[i] = OCIGamepadItem::Create( - gamepad_manager_, &dev_info, &data_.items[i], i); - if (gamepad_items_[i]) { - InitMapping(i); - break; - } - } else { - continue; - } - } - break; - } - - case OCI_EVENT_DEV_DISCONNECT: { - for (size_t i = 0; i < Gamepads::kItemsLengthCap; i++) { - if (gamepad_items_[i] != nullptr && - (strcmp(gamepad_items_[i]->GetUID(), dev_info.UID) == 0)) { - LOG(INFO) << " gamepad_items_[" << i << "]->GetUID() " - << gamepad_items_[i]->GetUID(); - LOG(INFO) << " disconnected"; - gamepad_items_[i]->Shutdown(); - gamepad_items_[i] = nullptr; - break; - } - } - break; - } - case OCI_EVENT_DEV_STATUS: { - break; - } - default: { - break; - } - } + // operate gamepad in polling thread. + DCHECK(polling_runner_); + polling_runner_->PostTask( + FROM_HERE, + base::BindOnce( + &GamepadPlatformDataFetcherTizenTV::HandleGamepadConnectionStatus, + base::Unretained(this), type, dev_info)); } void GamepadPlatformDataFetcherTizenTV::PlayEffect( diff --git a/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.h b/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.h index 61239c5..cab6a56 100644 --- a/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.h +++ b/tizen_src/ewk/efl_integration/browser/gamepad/gamepad_platform_data_fetcher_tizen_tv.h @@ -61,6 +61,7 @@ class GamepadPlatformDataFetcherTizenTV void* pparam3) override; private: + void OnAddedToProvider() override; void ReadTizenDeviceData(size_t index); void EnumerateTizenDevices(); @@ -75,6 +76,8 @@ class GamepadPlatformDataFetcherTizenTV std::string str, size_t str_length); + void HandleGamepadConnectionStatus(int type, const OCIDevInfo& deviceinfo); + // Functions to map from device data to standard layout. static void MapperTizenStyleGamepad(const Gamepad& input, Gamepad* mapped); @@ -84,6 +87,10 @@ class GamepadPlatformDataFetcherTizenTV gamepad::IGamepadManager* gamepad_manager_; std::array, Gamepads::kItemsLengthCap> gamepad_items_; + + // Task runner to use for gamepad polling. + // it will be set in OnAddedToProvider. + scoped_refptr polling_runner_; }; } // namespace device diff --git a/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.cc b/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.cc index 5420a15..572908e 100644 --- a/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.cc +++ b/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.cc @@ -44,10 +44,11 @@ void closeLatencyFile() { size_t OCIGamepadItem::s_oci_gamepaditem_num_ = 0; // static function -std::unique_ptr OCIGamepadItem::Create(IGamepadManager* manager, - OCIDevInfo* dev_info, - Gamepad* pad, - int index) { +std::unique_ptr OCIGamepadItem::Create( + IGamepadManager* manager, + const OCIDevInfo* dev_info, + Gamepad* pad, + int index) { if (manager == nullptr) { return nullptr; } @@ -135,8 +136,9 @@ bool OCIGamepadItem::InitAxisRangeTizen() { } OCIGamepadItem::OCIGamepadItem(IGamepadManager* manager, - OCIDevInfo* info, + const OCIDevInfo* info, Gamepad* pad) { + LOG(ERROR) << "[Gamepad_LOG]OCIGamepadItem construct"; CHECK(info != nullptr); memcpy(&info_, info, sizeof(OCIDevInfo)); CHECK(manager != nullptr); @@ -166,6 +168,7 @@ OCIGamepadItem::OCIGamepadItem(IGamepadManager* manager, } OCIGamepadItem::~OCIGamepadItem() { + LOG(ERROR) << "[Gamepad_LOG][~OCIGamepadItem]"; if (gamepad_ == nullptr) // CreateDevice fail, need not destroy device. return; this->DestroyDevice(); diff --git a/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.h b/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.h index 088adf7..d5ea0a8 100644 --- a/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.h +++ b/tizen_src/ewk/efl_integration/browser/gamepad/oci_gamepad_item.h @@ -51,7 +51,7 @@ class OCIGamepadItem : public gamepad::CGamepadCallback, // static function for create OCIGamepadItem, used by // GamepadPlatformDataFetcherTizenTV static std::unique_ptr Create(IGamepadManager* manager, - OCIDevInfo* dev_info, + const OCIDevInfo* dev_info, Gamepad* pad, int index); @@ -89,7 +89,7 @@ class OCIGamepadItem : public gamepad::CGamepadCallback, OCIControllerEvent events_[kOCIGamepadItemsLength]; explicit OCIGamepadItem(IGamepadManager* manager, - OCIDevInfo* info, + const OCIDevInfo* info, Gamepad* pad); bool CreateDevice(); void DestroyDevice(); -- 2.7.4 From 745034474f1e4d5d007bf8a981b4cc533efa8b40 Mon Sep 17 00:00:00 2001 From: fangfengrong Date: Fri, 15 Mar 2024 19:53:11 +0800 Subject: [PATCH 10/16] [M120 Migration] Add mouseout event On webbrowser internal page (featured, most-visited, Bookmarks, watch later), when move mouse out of the webpage, the Blue Highlight remains in webpage. It caused by no mouse out event being delivered to js. So, keep same with M94, when receive the mouse out event callback from EFL, create a standard mouse out event and deliver it to js. refer: https://review.tizen.org/gerrit/#/c/297166 Change-Id: Id27837f957b633b594a15def0e185c6138502ca4 Signed-off-by: fangfengrong --- .../ui/ozone/platform/efl/efl_event_handler.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_event_handler.cc b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_event_handler.cc index 91ca651..862e74a 100644 --- a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_event_handler.cc +++ b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_event_handler.cc @@ -565,6 +565,7 @@ void EflEventHandler::OnMouseIn(void* data, Evas* evas, Evas_Object* obj, void* event_info) { + LOG(INFO) << "OnMouseIn"; EflEventHandler* thiz = static_cast(data); thiz->window_->UpdateFocus(true); } @@ -574,10 +575,23 @@ void EflEventHandler::OnMouseOut(void* data, Evas* evas, Evas_Object* obj, void* event_info) { -#if !BUILDFLAG(IS_TIZEN) + LOG(INFO) << "OnMouseOut"; EflEventHandler* thiz = static_cast(data); +#if !BUILDFLAG(IS_TIZEN) thiz->window_->UpdateFocus(false); #endif + Evas_Event_Mouse_Out* ev = static_cast(event_info); + + gfx::PointF root_location(ev->canvas.x, ev->canvas.y); + gfx::PointF location(ev->canvas.x, ev->canvas.y); + location.Offset(0, -thiz->GetTopControlsHeight()); + int button = EvasToUIMouseButton(ev->buttons); + int event_flags = EvasModifiersToEventFlags(ev->modifiers); + event_flags |= button; + MouseEvent event(ET_MOUSE_EXITED, location, root_location, + base::TimeTicks::Now(), event_flags, button); + + EflPlatformEventSource::GetInstance()->DispatchEflEvent(&event); } // static -- 2.7.4 From e201798463e3d7731442e3f0871f6cc2b55c825c Mon Sep 17 00:00:00 2001 From: wuxiaoliang Date: Mon, 18 Mar 2024 16:24:57 +0800 Subject: [PATCH 11/16] [M120 Migration] Support HDR10+ property upstream remove side_data_size and add struct DecoderBufferSideData in this patch: https://chromium-review.googlesource.com/c/chromium/src/+/4757645 Migrated from: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/290546/ Change-Id: I0abc0b4fdd7d708582eb9215710ceb51ea194a2d Signed-off-by: wuxiaoliang --- .../media/filters/media_player_esplusplayer_tv.cc | 136 ++++++++++++++++++++- .../media/filters/media_player_esplusplayer_tv.h | 11 ++ 2 files changed, 145 insertions(+), 2 deletions(-) diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc index 33d2e73..84361c1 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc @@ -111,8 +111,16 @@ int MediaPlayerESPlusPlayerTV::SetVideoStreamInfo( } } - LOG(INFO) << "Framerate: [" << video_stream_info.framerate_num << "] [" - << video_stream_info.framerate_den << "]"; + video_codec_ = video_config.codec(); + if (hdr_info_.compare(video_config.hdr_info()) != 0) { + is_hdr_changed_ = true; + hdr_info_ = video_config.hdr_info(); + } + + LOG_ID(INFO, player_id_) << "Framerate: [" << video_stream_info.framerate_num + << "] [" << video_stream_info.framerate_den << "]" + << " ,is_hdr_changed_ : " << is_hdr_changed_ + << " ,hdr info:" << hdr_info_; if (!SetVideoSubmitDataType(video_config)) { LOG(ERROR) << "SetVideoSubmitDataType failed."; @@ -243,6 +251,7 @@ esplusplayer_submit_status MediaPlayerESPlusPlayerTV::SubmitEsPacket( // This filed only set when PushMediaPacket packet.matroska_color_info = nullptr; + FillHDRIntoPacket(type, buffer, &packet); unsigned int tz_handle = buffer->tz_handle() ? buffer->tz_handle() : 0; #if TIZEN_VERSION_AT_LEAST(6, 0, 0) @@ -431,4 +440,127 @@ esplusplayer_drm_info* MediaPlayerESPlusPlayerTV::DrmInfo::GetPlayerDrmInfo( } #endif +void MediaPlayerESPlusPlayerTV::HDRStringToMatroskaColor( + const std::string& hdr_info, + esplusplayer_matroska_color* matroska_color) { + const char* fmt = + "matrixCoefficients:%u bitsPerChannel:%u chromaSubsamplingHorz:%u " + "chromaSubsamplingVert:%u" + " cbSubsamplingHorz:%u cbSubsamplingVert:%u chromaSitingHorz:%u " + "chromaSitingVert:%u" + " range:%u transferCharacteristics:%u primaries:%u maxCLL:%u maxFALL:%u" + " RX:%lf RY:%lf GX:%lf GY:%lf BX:%lf BY:%lf wX:%lf wY:%lf" + " luminanceMax:%lf luminanceMin:%lf"; + + memset(matroska_color, 0, sizeof(esplusplayer_matroska_color)); + if (sscanf(hdr_info.c_str(), fmt, &(matroska_color->matrix_coefficients), + &(matroska_color->bits_per_channel), + &(matroska_color->chroma_subsampling_horizontal), + &(matroska_color->chroma_subsampling_vertical), + &(matroska_color->cb_subsampling_horizontal), + &(matroska_color->cb_subsampling_vertical), + &(matroska_color->chroma_siting_horizontal), + &(matroska_color->chroma_siting_vertical), + &(matroska_color->range), + &(matroska_color->transfer_characteristics), + &(matroska_color->primaries), &(matroska_color->max_cll), + &(matroska_color->max_fall), + &(matroska_color->metadata.primary_r_chromaticity_x), + &(matroska_color->metadata.primary_r_chromaticity_y), + &(matroska_color->metadata.primary_g_chromaticity_x), + &(matroska_color->metadata.primary_g_chromaticity_y), + &(matroska_color->metadata.primary_b_chromaticity_x), + &(matroska_color->metadata.primary_b_chromaticity_y), + &(matroska_color->metadata.white_point_chromaticity_x), + &(matroska_color->metadata.white_point_chromaticity_y), + &(matroska_color->metadata.luminance_max), + &(matroska_color->metadata.luminance_min)) != 23) { + LOG(ERROR) << "HDRStringToMatroskaColor hdr string invalid. " << hdr_info; + return; + } + + LOG_ID(INFO, player_id_) + << "matrixCoefficients:" << matroska_color->matrix_coefficients + << " bitsPerChannel:" << matroska_color->bits_per_channel + << " chromaSubsamplingHorz:" + << matroska_color->chroma_subsampling_horizontal + << " chromaSubsamplingVert:" + << matroska_color->chroma_subsampling_vertical + << " cbSubsamplingHorz:" << matroska_color->cb_subsampling_horizontal + << " cbSubsamplingVert:" << matroska_color->cb_subsampling_vertical + << " chromaSitingHorz:" << matroska_color->chroma_siting_horizontal + << " chromaSitingVert:" << matroska_color->chroma_siting_vertical + << " range:" << matroska_color->range + << " transferCharacteristics:" << matroska_color->transfer_characteristics + << " primaries:" << matroska_color->primaries + << " maxCLL:" << matroska_color->max_cll + << " maxFALL:" << matroska_color->max_fall + << " RX:" << matroska_color->metadata.primary_r_chromaticity_x + << " RY:" << matroska_color->metadata.primary_r_chromaticity_y + << " GX:" << matroska_color->metadata.primary_g_chromaticity_x + << " GY:" << matroska_color->metadata.primary_g_chromaticity_y + << " BX:" << matroska_color->metadata.primary_b_chromaticity_x + << " BY:" << matroska_color->metadata.primary_b_chromaticity_y + << " wX:" << matroska_color->metadata.white_point_chromaticity_x + << " wY:" << matroska_color->metadata.white_point_chromaticity_y + << " luminanceMax:" << matroska_color->metadata.luminance_max + << " luminanceMin:" << matroska_color->metadata.luminance_min; +} + +void MediaPlayerESPlusPlayerTV::FillHDRIntoPacket( + DemuxerStream::Type type, + scoped_refptr buffer, + esplusplayer_es_packet* packet) { + if (type != media::DemuxerStream::VIDEO) + return; + + if (!buffer) { + LOG_ID(ERROR, player_id_) + << "decoder buffer is null, cannot get HDR10 metadata"; + return; + } + + // update HDR info in the first packet + if (is_hdr_changed_) { + HDRStringToMatroskaColor(hdr_info_, &matroska_color_); + packet->matroska_color_info = &matroska_color_; + is_hdr_changed_ = false; + } + + if (!buffer->has_side_data()) { + LOG_ID(ERROR, player_id_) << "decoder buffer has no side data"; + return; + } + + if (buffer->side_data()->alpha_data.empty()) { + LOG_ID(ERROR, player_id_) << "decoder buffer has no alpha data"; + return; + } + + uint8_t* side_data = (uint8_t*)buffer->side_data()->alpha_data.data(); + size_t side_data_size = buffer->side_data()->alpha_data.size(); + + if (side_data_size > 8) { + // follow cobalt's check about hdr10plus inf + std::vector side_data_vec; + size_t side_data_vec_size = 0; + uint64_t blockAddId = 0; + for (int j = 0; j < 8; ++j) { + blockAddId = (blockAddId << 8) | side_data[j]; + } + + if (blockAddId == 0x04) { + side_data_vec_size = side_data_size - 8; + side_data_vec.resize(side_data_vec_size); + memcpy(&side_data_vec[0], side_data + 8, + sizeof(uint8_t) * side_data_vec_size); + } + + packet->hdr10p_metadata_size = side_data_vec_size; + packet->hdr10p_metadata = + reinterpret_cast(const_cast(side_data_vec.data())); + matroska_color_.isHDR10p = true; + } +} + } // namespace media diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h index a063bbf..4a9d6c6 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h @@ -98,6 +98,17 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayerTV : public MediaPlayerESPlusPlayer { bool is_video_drm_eme_{false}; bool single_process_mode_{false}; media::VideoCodec video_codec_{media::VideoCodec::kUnknown}; + + void HDRStringToMatroskaColor(const std::string& hdr_info, + esplusplayer_matroska_color* matroska_color); + void FillHDRIntoPacket(DemuxerStream::Type type, + scoped_refptr buffer, + esplusplayer_es_packet* packet); + + std::string hdr_info_; + bool is_hdr_changed_{false}; + esplusplayer_matroska_color matroska_color_; + base::WeakPtrFactory weak_factory_{this}; }; } // namespace media -- 2.7.4 From 7cd2d323cc9d3bbda857c64f9b3cbb3b279b0823 Mon Sep 17 00:00:00 2001 From: wuxiaoliang Date: Tue, 19 Mar 2024 15:14:29 +0800 Subject: [PATCH 12/16] Fixup! [M120 Migration][MPEG-H][Hbbtv][MSE] Add proper demuxing for MPEG-H codec patch 290424 is merged in tizen.beta, side data get method is changed, and it just comment it for build. now add the right method to fill side data. Change-Id: I55e6036c9d227fdce0aa56cd5873bb6c9e515a8b Signed-off-by: wuxiaoliang --- media/filters/source_buffer_range.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/media/filters/source_buffer_range.cc b/media/filters/source_buffer_range.cc index b5e8f47..d44518e 100644 --- a/media/filters/source_buffer_range.cc +++ b/media/filters/source_buffer_range.cc @@ -230,14 +230,20 @@ void SourceBufferRange::ModifyFirstFrameForMpeghCodec() { // Creating new buffer based on changed data auto new_buffer = StreamParserBuffer::CopyFrom( &(new_data.front()), new_data.size(), -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup (Removed in Open Source) - buffers_[next_buffer_index_]->side_data(), - buffers_[next_buffer_index_]->side_data_size(), -#endif buffers_[next_buffer_index_]->is_key_frame(), buffers_[next_buffer_index_]->type(), buffers_[next_buffer_index_]->track_id()); + // set side_data/alpha_data for new buffer + if (buffers_[next_buffer_index_]->has_side_data()) { + auto side_data = buffers_[next_buffer_index_]->side_data(); + if (!side_data->alpha_data.empty()) { + new_buffer->WritableSideData().alpha_data.assign( + side_data->alpha_data.data(), + side_data->alpha_data.data() + side_data->alpha_data.size()); + } + } + // Setting other necessary data not copied by previous function new_buffer->SetConfigId(buffers_[next_buffer_index_]->GetConfigId()); new_buffer->SetDecodeTimestamp( -- 2.7.4 From 19123f8b08d778428e4e8a45ce72522bc5aeb583 Mon Sep 17 00:00:00 2001 From: "zhishun.zhou" Date: Mon, 25 Mar 2024 20:24:07 +0800 Subject: [PATCH 13/16] [M120 Migration] Add new interface to forward message from mmplayer to hbbtv Support EWK notify interface: DECLARE_EWK_VIEW_CALLBACK(EVENTData, "update,event,data", void*); Patch from: https://review.tizen.org/gerrit/#/c/294840/ Change-Id: I7359fd40029e1788fcca0a1c6aaccf0602744d12 Signed-off-by: yangzhiwen Signed-off-by: zhishun.zhou --- content/public/browser/web_contents_delegate.h | 1 + .../content/browser/media/tizen_renderer_impl.cc | 13 +++++++++++++ .../content/browser/media/tizen_renderer_impl.h | 1 + .../media/filters/media_player_bridge_capi_tv.cc | 4 ++-- tizen_src/chromium_impl/media/filters/media_player_tizen.h | 1 + tizen_src/ewk/efl_integration/eweb_view.cc | 5 +++++ tizen_src/ewk/efl_integration/eweb_view.h | 1 + tizen_src/ewk/efl_integration/eweb_view_callbacks.h | 2 ++ tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc | 4 ++++ tizen_src/ewk/efl_integration/web_contents_delegate_efl.h | 1 + 10 files changed, 31 insertions(+), 2 deletions(-) diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index c561d38..d2d66ab 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -748,6 +748,7 @@ class CONTENT_EXPORT WebContentsDelegate { uint32_t previous, uint32_t current) {} virtual bool IsHighBitRate() const { return false; } + virtual void UpdateEventData(void* data) {} virtual void NotifyParentalRatingInfo(const std::string& info, const std::string& url) {} virtual void NotifyDownloadableFontInfo(const std::string& scheme_id_uri, diff --git a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc index 835c40b..a09bc9f 100644 --- a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc +++ b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc @@ -414,6 +414,19 @@ void TizenRendererImpl::SetPreferTextLanguage(const std::string& lang) { } media_player_->SetPreferTextLanguage(lang); } + +void TizenRendererImpl::UpdateEventData(std::string data) { + content::WebContentsDelegate* web_contents_delegate = + GetWebContentsDelegate(); + if (!web_contents_delegate) { + LOG_ID(ERROR, player_id_) << "web_contents_delegate is null"; + return; + } + + web_contents_delegate->UpdateEventData( + static_cast(const_cast(data.c_str()))); +} + content::WebContentsDelegate* TizenRendererImpl::GetWebContentsDelegate() const { content::WebContents* web_contents = GetWebContents(); diff --git a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h index bf9f6ad..8208990 100644 --- a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h +++ b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h @@ -188,6 +188,7 @@ class CONTENT_EXPORT TizenRendererImpl void SetActiveAudioTrack(int index) override; void SetActiveVideoTrack(int index) override; void SetPreferTextLanguage(const std::string& lang) override; + void UpdateEventData(std::string data); #endif content::WebContents* GetWebContents() const; diff --git a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc index 44e3845..9173530 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc @@ -1207,7 +1207,7 @@ void MediaPlayerBridgeCapiTV::OnOtherEvent(int event_type, void* event_data) { LOG_ID(INFO, player_id_) << "not supported scheme id uri,uri:" << uri; return; } -#if !defined(EWK_BRINGUP) + if (!uri.compare("urn:dvb:css")) { LOG_ID(INFO, player_id_) << "event->value:" << eventstream->value << " evalue " << value.c_str(); @@ -1216,7 +1216,7 @@ void MediaPlayerBridgeCapiTV::OnOtherEvent(int event_type, void* event_data) { weak_factory_.GetWeakPtr(), value)); return; } -#endif + const std::string info = uri + " " + value; task_runner_->PostTask( FROM_HERE, diff --git a/tizen_src/chromium_impl/media/filters/media_player_tizen.h b/tizen_src/chromium_impl/media/filters/media_player_tizen.h index 10a5f22..d24ffc6 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_tizen.h +++ b/tizen_src/chromium_impl/media/filters/media_player_tizen.h @@ -115,6 +115,7 @@ class MEDIA_EXPORT MediaPlayerTizen { virtual void SetActiveAudioTrack(int index) {} virtual void SetActiveVideoTrack(int index) {} virtual void SetPreferTextLanguage(const std::string& lang) {} + virtual void UpdateEventData(std::string data) {} }; } // namespace media diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 22539f1..ab7fac0 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -3443,6 +3443,11 @@ void EWebView::UpdateCurrentTime(double current_time) { current_time_ = current_time; } +void EWebView::UpdateEventData(void* data) { + LOG(INFO) << "EWebView::UpdateEventData data:" << (char*)data; + SmartCallback().call(data); +} + void EWebView::NotifyParentalRatingInfo(const char* info, const char* url) { LOG(INFO) << "info:" << info << ",url:" << url; Ewk_Media_Parental_Rating_Info* data = diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index f6bf763..6d7f069 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -820,6 +820,7 @@ class EWebView { const std::string& data, unsigned int size); void UpdateCurrentTime(double current_time); + void UpdateEventData(void* data); double GetCurrentTime() { return current_time_; } void GetMediaDeviceList(Ewk_Media_Device_List_Get_Callback callback, void* userData); diff --git a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h index 0128cf1..895d47e 100644 --- a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h +++ b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h @@ -138,6 +138,7 @@ enum CallbackType { SubtitleNotifyData, FirstTimestamp, PESData, + EVENTData, #endif OverscrolledLeft, OverscrolledRight, @@ -329,6 +330,7 @@ DECLARE_EWK_VIEW_CALLBACK(SubtitleSeekComplete, DECLARE_EWK_VIEW_CALLBACK(SubtitleNotifyData, "on,subtitle,data", void*); DECLARE_EWK_VIEW_CALLBACK(FirstTimestamp, "on,dvb,subtitle,timestamp", void*); DECLARE_EWK_VIEW_CALLBACK(PESData, "on,dvb,subtitle,data", void*); +DECLARE_EWK_VIEW_CALLBACK(EVENTData, "update,event,data", void*); #endif DECLARE_EWK_VIEW_CALLBACK(OverscrolledLeft, "overscrolled,left", void); DECLARE_EWK_VIEW_CALLBACK(OverscrolledRight, "overscrolled,right", void); diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc index 1357ccc..83ecaec 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc @@ -774,6 +774,10 @@ void WebContentsDelegateEfl::UpdateCurrentTime(double current_time) { web_view_->UpdateCurrentTime(current_time); } +void WebContentsDelegateEfl::UpdateEventData(void* data) { + web_view_->UpdateEventData(data); +} + void WebContentsDelegateEfl::NotifySubtitleState(int state, double time_stamp) { web_view_->NotifySubtitleState(state, time_stamp); } diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h index a4955c8..68edad2 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h @@ -162,6 +162,7 @@ class WebContentsDelegateEfl : public WebContentsDelegate { unsigned int len, int media_position) override; void UpdateCurrentTime(double current_time) override; + void UpdateEventData(void* data) override; void NotifySubtitleState(int state, double time_stamp) override; void NotifySubtitlePlay(int active_track_id, const std::string& url, -- 2.7.4 From 3582344f24a472c9d4b24665e5feae2a516e684a Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Wed, 28 Feb 2024 17:48:13 +0800 Subject: [PATCH 14/16] [M120 Migration][XWalkExtension] Support IME in xwalk exension Due to the reason that pepper plugin will be converted to xwalk plugin Samsung extended IME PPAPI can't be used. Need to provide IME function in xwalk plugin. Call Sequence: (WRT) sendRuntimeMessage(js) -> WRTXWalkExtensionBrowserTV::HandleRuntimeMessageInternal -> SetIMERecommendedWords/SetIMERecommendedWordsType (HBBTV) sendRuntimeMessage(js) -> XWalkExtensionBrowserEfl::HandleRuntimeMessageInternal -> SetIMERecommendedWords/SetIMERecommendedWordsType Support SetIMERecommendedWords and SetIMERecommendedWordsType Migrated from tizen 8.0: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/296727/ https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/298681/ Change-Id: I3323c4f4b1800b651d941291930ce2ef65820805 Signed-off-by: jinbei09 (cherry picked from commit f567edbefd181c35e2452d9f14b8534b8882c477) --- .../browser/xwalk_extension_browser_efl.cc | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc b/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc index 08f29dc..fa12f8a 100644 --- a/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc @@ -6,11 +6,68 @@ #include "base/logging.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "content/browser/renderer_host/render_widget_host_view_aura.h" +#include "content/browser/renderer_host/rwhv_aura_common_helper_efl.h" +#include "content/browser/web_contents/web_contents_impl.h" +#endif + namespace content { +namespace { + +#if BUILDFLAG(IS_TIZEN_TV) +content::RWHVAuraCommonHelperEfl* GetRWHVAEflHelper() { + auto* web_contents = content::WebContentsImpl::GetAllWebContents().front(); + auto* rwhva = static_cast( + web_contents->GetRenderWidgetHostView()); + if (!rwhva || !rwhva->aura_efl_helper()) { + LOG(ERROR) << "RWHV is not created yet!"; + return nullptr; + } + return rwhva->aura_efl_helper(); +} +#endif + +} // namespace + std::string XWalkExtensionBrowserEfl::HandleRuntimeMessageInternal( const std::string& type, const std::string& value) { LOG(INFO) << "type : " << type; + +#if BUILDFLAG(IS_TIZEN_TV) + if (type == "webapis://appcommon/setIMERecommendedWords") { + if (!GetRWHVAEflHelper()) { + LOG(ERROR) << "RWHV is not created yet!"; + return "error"; + } + std::string auto_words = "autoword="; + static const char AUTOWORD_ITEM_DELIMETER[] = {0x07, 0x06, 0x00}; + std::string temp = value; + std::size_t found = temp.find_first_of(','); + while (found != std::string::npos) { + auto_words.append(temp.substr(0, found)); + auto_words.append(AUTOWORD_ITEM_DELIMETER); + temp = temp.substr(found + 1); + found = temp.find_first_of(','); + } + auto_words.append(temp); + LOG(INFO) << "auto_words=[" << auto_words << "]"; + GetRWHVAEflHelper()->SetIMERecommendedWords(auto_words); + return "success"; + } else if (type == "webapis://appcommon/setIMERecommendedType") { + if (!GetRWHVAEflHelper()) { + LOG(ERROR) << "RWHV is not created yet!"; + return "error"; + } + GetRWHVAEflHelper()->SetIMERecommendedWordsType(value == "1" ? true + : false); + return "success"; + } else { + LOG(ERROR) << "Unknown message type : " << type; + } +#endif + // TODO(dh81.song) // According to xwalk extensions, this might handle internal messages. return std::string(); -- 2.7.4 From f35a64e243ade8fa8be61594b53fff80b172b6b2 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Fri, 8 Mar 2024 14:07:37 +0530 Subject: [PATCH 15/16] fixup! [M120 Migration] Selection & Context menu controller This patch avoids creation of additional menu runner from views/directory, which is not needed for our browser and webapps, since we have our own context menu. Reference: https://review.tizen.org/gerrit/293300/ Change-Id: Ied1282196c73fe6815af9184c3d4fcbffe643e47 Signed-off-by: Manjeet --- ui/views/views_delegate.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc index e3895dc..b977838 100644 --- a/ui/views/views_delegate.cc +++ b/ui/views/views_delegate.cc @@ -32,7 +32,8 @@ ViewsDelegate::ViewsDelegate() ui::TouchEditingControllerFactory::SetInstance( editing_controller_factory_.get()); -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || BUILDFLAG(IS_CHROMEOS_ASH) +#if (BUILDFLAG(ENABLE_DESKTOP_AURA) || BUILDFLAG(IS_CHROMEOS_ASH)) && \ + !BUILDFLAG(IS_EFL) // TouchSelectionMenuRunnerViews is not supported on Mac or Cast. // It is also not used on Ash (the ChromeViewsDelegate() for Ash will // immediately replace this). But tests running without the Chrome layer -- 2.7.4 From 45ae09dd7db18242bbd677132b766f05f6b0d3e0 Mon Sep 17 00:00:00 2001 From: Sun-woo Nam Date: Thu, 7 Mar 2024 20:44:15 -0800 Subject: [PATCH 16/16] [MM] Report BufferingState based on the actual buffering status. Report BufferingState based on actual espp buffering status. If it can play when buffered timestamp is 500ms greater than current timestamp then report BUFFERING_HAVE_ENOUGH. If current timestamp is greater than buffered timestamp or buffer is flushed then report BUFFERING_HAVE_NOTHING. Reporting BufferingState affects setting WebMediaPlayer::ReadyState. Change-Id: Ice1a8a42a576d62b8b1e837847e5853dcd5156de Signed-off-by: Sun-woo Nam --- .../media/filters/media_player_esplusplayer.cc | 50 +++++++++++----------- .../media/filters/media_player_esplusplayer.h | 7 +-- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc index 9c7290d..e091b85 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc @@ -289,13 +289,11 @@ void MediaPlayerESPlusPlayer::Release() { SetShouldFeed(DemuxerStream::AUDIO, false); SetIsValid(DemuxerStream::AUDIO, false); SetReadRequested(DemuxerStream::AUDIO, false); - SetBufferingState(DemuxerStream::AUDIO, BUFFERING_HAVE_NOTHING); SetIsEos(DemuxerStream::VIDEO, false); SetShouldFeed(DemuxerStream::VIDEO, false); SetIsValid(DemuxerStream::VIDEO, false); SetReadRequested(DemuxerStream::VIDEO, false); - SetBufferingState(DemuxerStream::VIDEO, BUFFERING_HAVE_NOTHING); esplusplayer_set_ready_to_prepare_cb(esplayer_, nullptr, this); esplusplayer_set_prepare_async_done_cb(esplayer_, nullptr, this); @@ -310,6 +308,8 @@ void MediaPlayerESPlusPlayer::Release() { buffer_observer_->ResetBufferStatus(); buffer_observer_->ResetBufferStatusCallbacks(); + reported_buffering_state_ = BUFFERING_HAVE_NOTHING; + volume_ = 1.0; playback_rate_ = 0.0; is_prepared_ = false; @@ -523,6 +523,10 @@ void MediaPlayerESPlusPlayer::Flush(base::OnceClosure flush_cb) { return; } LOG(INFO) << "(" << static_cast(this) << ") " << __func__; + + ReportBufferingStateIfNeeded(BUFFERING_HAVE_NOTHING, + BUFFERING_CHANGE_REASON_UNKNOWN); + last_frames_.get().first = media::kNoTimestamp; last_frames_.get().first = media::kNoTimestamp; @@ -533,8 +537,6 @@ void MediaPlayerESPlusPlayer::Flush(base::OnceClosure flush_cb) { SetShouldFeed(DemuxerStream::VIDEO, false); GetBufferQueue(DemuxerStream::VIDEO).clear(); GetBufferQueue(DemuxerStream::AUDIO).clear(); - SetBufferingState(DemuxerStream::AUDIO, BUFFERING_HAVE_NOTHING); - SetBufferingState(DemuxerStream::VIDEO, BUFFERING_HAVE_NOTHING); buffer_observer_->ResetBufferStatus(); std::move(flush_cb).Run(); @@ -926,13 +928,23 @@ void MediaPlayerESPlusPlayer::OnBufferingStatusChanged(DemuxerStream::Type type, } if (status != kBufferNone) { - if (GetBufferingState(type) != BUFFERING_HAVE_ENOUGH) { - SetBufferingState(type, BUFFERING_HAVE_ENOUGH); - GetMediaPlayerClient()->OnBufferingStateChange( - BUFFERING_HAVE_ENOUGH, BUFFERING_CHANGE_REASON_UNKNOWN); - } + if (GetOperationForData() == OperationForData::PLAY) + ReportBufferingStateIfNeeded(BUFFERING_HAVE_ENOUGH, + BUFFERING_CHANGE_REASON_UNKNOWN); } else { - SetBufferingState(type, BUFFERING_HAVE_NOTHING); + ReportBufferingStateIfNeeded(BUFFERING_HAVE_NOTHING, + BUFFERING_CHANGE_REASON_UNKNOWN); + } +} + +void MediaPlayerESPlusPlayer::ReportBufferingStateIfNeeded( + BufferingState buffering_state, + BufferingStateChangeReason reason) { + if (reported_buffering_state_ != buffering_state) { + LOG(INFO) << __func__ << " Report BufferingState : " << buffering_state + << ", reason : " << reason; + reported_buffering_state_ = buffering_state; + GetMediaPlayerClient()->OnBufferingStateChange(buffering_state, reason); } } @@ -989,18 +1001,18 @@ MediaPlayerESPlusPlayer::GetOperationForData() { // If data has been pushed enough (>= kMinWaitTimeForPlayback) if (time_diff >= kMinWaitTimeForPlayback) { LOG(INFO) << __func__ << " Data is enough to play,"; + ReportBufferingStateIfNeeded(BUFFERING_HAVE_ENOUGH, + BUFFERING_CHANGE_REASON_UNKNOWN); return OperationForData::PLAY; } } else { bool should_pause = false; if (has_video_media_type && current_position >= last_frames_.get().first) { - SetBufferingState(DemuxerStream::VIDEO, BUFFERING_HAVE_NOTHING); should_pause = true; } if (has_audio_media_type && current_position >= last_frames_.get().first) { - SetBufferingState(DemuxerStream::AUDIO, BUFFERING_HAVE_NOTHING); should_pause = true; } @@ -1008,8 +1020,8 @@ MediaPlayerESPlusPlayer::GetOperationForData() { LOG(INFO) << __func__ << " Not enough data to play."; // If pushing pts smaller than current_position, should report // BUFFERING_HAVE_NOTHING to replace BUFFERING_HAVE_ENOUGH - GetMediaPlayerClient()->OnBufferingStateChange( - BUFFERING_HAVE_NOTHING, BUFFERING_CHANGE_REASON_UNKNOWN); + ReportBufferingStateIfNeeded(BUFFERING_HAVE_NOTHING, + BUFFERING_CHANGE_REASON_UNKNOWN); return OperationForData::PAUSE; } } @@ -1355,16 +1367,6 @@ void MediaPlayerESPlusPlayer::SetReadRequested(DemuxerStream::Type type, GetElementryStream(type).read_requested_ = value; } -BufferingState MediaPlayerESPlusPlayer::GetBufferingState( - DemuxerStream::Type type) { - return GetElementryStream(type).buffering_state_; -} - -void MediaPlayerESPlusPlayer::SetBufferingState(DemuxerStream::Type type, - BufferingState state) { - GetElementryStream(type).buffering_state_ = state; -} - DemuxerStream* MediaPlayerESPlusPlayer::GetDemuxerStream( DemuxerStream::Type type) const { return GetElementryStream(type).input_stream_; diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h index 8c3a416..a8e9c59 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h @@ -158,7 +158,6 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { bool is_eos_ = false; bool should_feed_ = false; bool read_requested_ = false; - BufferingState buffering_state_ = BUFFERING_HAVE_NOTHING; DemuxerStream* input_stream_ = nullptr; base::circular_deque> pending_buffers_; }; @@ -175,6 +174,9 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { void SeekInternal(base::TimeDelta time); void UpdateBufferedDtsDifference(); + void ReportBufferingStateIfNeeded(BufferingState buffering_state, + BufferingStateChangeReason reason); + void PerformOperationForData(); OperationForData GetOperationForData(); void StartOperationForDataTimer(); @@ -183,8 +185,6 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { ElementryStream& GetElementryStream(DemuxerStream::Type type); const ElementryStream& GetElementryStream(DemuxerStream::Type type) const; void SetReadRequested(DemuxerStream::Type type, bool value); - BufferingState GetBufferingState(DemuxerStream::Type type); - void SetBufferingState(DemuxerStream::Type type, BufferingState state); DemuxerStream* GetDemuxerStream(DemuxerStream::Type type) const; void SetDemuxerStream(DemuxerStream::Type type, DemuxerStream* stream); Queue& GetBufferQueue(DemuxerStream::Type type); @@ -207,6 +207,7 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { bool should_set_playback_rate_ = false; bool is_paused_by_buffering_ = false; + BufferingState reported_buffering_state_ = BUFFERING_HAVE_NOTHING; #if defined(TIZEN_VIDEO_HOLE) gfx::Rect viewport_rect_; -- 2.7.4