From 5e05dbc54d0ca08d81136936c8410af41a349bde Mon Sep 17 00:00:00 2001 From: Youngcheol Kang Date: Wed, 10 May 2017 17:10:21 +0900 Subject: [PATCH 01/16] fixup! Implement Fullscreen API In tizen 2.4 environment, WRT calls the ewk_view_fullscreen_exit() API and exits the event handler when pressing hardware back key if it's fullscreen mode in only "Software key" mode or "windowed" view mode. However above two conditions(software key and windowed view modes) were omitted in tizen 3.0, so the ewk_view_fullscreen_exit() API was always called when pressing hardware back key in fullscreen mode. This CL fixes these problem. Bug: http://suprem.sec.samsung.net/jira/browse/TWF-3201 Change-Id: I4dda2d78be7af8cf75df72875aa2d7e94bbe2da9 Signed-off-by: Youngcheol Kang --- runtime/browser/web_application.cc | 5 +++++ runtime/browser/web_view_impl.cc | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 94ed40a..1d0a6c4 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -1003,6 +1003,11 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { RemoveWebViewFromStack(view_stack_.front()); } } + + if (app_data_->widget_info()->view_modes() == "fullscreen") { + ewk_view_fullscreen_exit(view->evas_object()); + return; + } } } else if (enabled && kKeyNameMenu == keyname) { view->EvalJavascript(kMenuKeyEventScript); diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc index 34d8e57..ea77e15 100644 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -985,10 +985,6 @@ void WebViewImpl::OnRotation(int degree) { void WebViewImpl::OnKeyEvent(Eext_Callback_Type key_type) { std::string keyname; if (key_type == EEXT_CALLBACK_BACK) { - if (fullscreen_) { - ewk_view_fullscreen_exit(ewk_view_); - return; - } if (EINA_TRUE == ewk_view_text_selection_clear(ewk_view_)) { return; } -- 2.7.4 From b00afca150143afe1e1b5e163d76296959040434 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Tue, 23 May 2017 21:16:36 +0900 Subject: [PATCH 02/16] [release 0.3.2]tizen porting Change-Id: I75ab917767be3406d23e01e6c162a5a281ed3145 Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 4 ---- runtime/browser/web_view_impl.cc | 4 ---- 2 files changed, 8 deletions(-) mode change 100644 => 100755 runtime/browser/web_view_impl.cc diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 1d0a6c4..5cd985f 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -711,14 +711,12 @@ void WebApplication::ClosePage() { for (; it != view_stack_.end(); ++it) { (*it)->ReplyToJavascriptDialog(); view_stack_.front()->SetVisibility(false); -#ifdef DENABLE_EWK_ADDITIONAL_FEATURE if (ewk_view_page_close((*it)->evas_object())) { LOGGER(DEBUG) << "ewk_view_page_close returns true"; valid_evas_object_count++; } else { LOGGER(DEBUG) << "ewk_view_page_close returns false"; } -#endif } } @@ -1215,12 +1213,10 @@ void WebApplication::SetupWebView(WebView* view) { void WebApplication::SetupWebViewCompatibilitySettings(WebView* view) { if (tizenWebKitCompatibilityEnabled()) { Ewk_Settings* settings = ewk_view_settings_get(view->evas_object()); -#ifdef DENABLE_COMPATIBILITY_MODE_SET ewk_settings_tizen_compatibility_mode_set(settings, m_tizenCompatibilitySettings.m_major, m_tizenCompatibilitySettings.m_minor, m_tizenCompatibilitySettings.m_release); -#endif ewk_settings_text_autosizing_enabled_set(settings, EINA_FALSE); } } diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc old mode 100644 new mode 100755 index ea77e15..01050c5 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -1028,15 +1028,11 @@ void WebViewImpl::SetDefaultEncoding(const std::string& encoding) { } void WebViewImpl::SetLongPolling(unsigned long longpolling) { -#ifdef DENABLE_CHROMIUM_EWK_FEATURE ewk_view_session_timeout_set(ewk_view_, longpolling); -#endif } void WebViewImpl::SetBGColor(int r, int g, int b, int a) { -#ifdef DENABLE_CHROMIUM_EWK_FEATURE ewk_view_bg_color_set(ewk_view_, r, g, b, a); -#endif } } // namespace runtime -- 2.7.4 From f6fcd9acc6681a448f5bdcfda6be2f20b04d23f2 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Wed, 24 May 2017 10:47:59 +0900 Subject: [PATCH 03/16] Changed the header file of appcore-watch from appcore-watch.h to watch_app.h Change-Id: Ib676f08863f8ec72eedd448c9fa6df20f12b4298 Signed-off-by: jaekuk, lee --- runtime/browser/watch_runtime.cc | 1 - runtime/browser/web_application.cc | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) mode change 100644 => 100755 runtime/browser/watch_runtime.cc diff --git a/runtime/browser/watch_runtime.cc b/runtime/browser/watch_runtime.cc old mode 100644 new mode 100755 index 4ec298b..39302ca --- a/runtime/browser/watch_runtime.cc +++ b/runtime/browser/watch_runtime.cc @@ -15,7 +15,6 @@ */ #include -#include #include #include diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 5cd985f..b6d8865 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -29,7 +29,7 @@ #include #ifdef WATCH_FACE_FEATURE_SUPPORT -#include +#include #endif #include "common/application_data.h" @@ -736,9 +736,7 @@ void WebApplication::Exit() { case common::ApplicationData::AppType::WATCH: if (TIZEN_FEATURE_watch_face_support) { LOGGER(ERROR) << "watch_ui_exit"; -#ifdef DENABLE_WATCH_APP watch_app_exit(); -#endif break; } else { goto __default; -- 2.7.4 From 2921f491ed136a6681a96cb394c5c261b81e53dd Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Thu, 15 Jun 2017 15:12:39 +0900 Subject: [PATCH 04/16] Changed a string to a variable "fullscreen" => kViewmodeTypeFullscreen "windowed" => kViewmodeTypeWindowed Change-Id: I354ce4c9fa84745c9c18d208faf570a9b16e970b Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index b6d8865..4e3d730 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -144,6 +144,9 @@ const char* kDefaultCSPRule = const char* kResWgtPath = "res/wgt/"; const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main"; +const std::string kViewmodeTypeFullscreen = "fullscreen"; +const std::string kViewmodeTypeWindowed = "windowed"; + // Looking for added privilege by Application developer in config.xml. bool FindPrivilegeFromConfig(common::ApplicationData* app_data, const std::string& privilege) { @@ -446,7 +449,7 @@ bool WebApplication::Initialize() { } if (app_data_->widget_info() != NULL && - app_data_->widget_info()->view_modes() == "fullscreen") { + app_data_->widget_info()->view_modes() == kViewmodeTypeFullscreen) { window_->SetCurrentViewModeFullScreen(true); window_->FullScreen(true); } @@ -990,7 +993,7 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { if ((app_data_->setting_info() != NULL && app_data_->setting_info()->backbutton_presence()) || (app_data_->widget_info() != NULL && - app_data_->widget_info()->view_modes() == "windowed")) { + app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) { if (!view->Backward()) { if (view_stack_.size() == 1) { LOGGER(DEBUG) << "Terminate"; @@ -1000,7 +1003,7 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { } } - if (app_data_->widget_info()->view_modes() == "fullscreen") { + if (app_data_->widget_info()->view_modes() == kViewmodeTypeFullscreen) { ewk_view_fullscreen_exit(view->evas_object()); return; } -- 2.7.4 From 93796edd1a1f569edfee7a088b60ce2755508507 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Tue, 20 Jun 2017 14:21:01 +0900 Subject: [PATCH 05/16] Implemented progressbar for web application issue : http://suprem.sec.samsung.net/jira/browse/MPR-1117 Hosted web app such as YouTube displays a white screen until the page finishes loading. Modified WRT to display progressbar until the page finishes loading if progressbar-presence is enabled in config.xml. Change-Id: I114d69543caea76161d0ace22cf57ae052c8f099 Signed-off-by: jaekuk, lee --- runtime/browser/native_window.cc | 24 ++++++++++++++++++++++++ runtime/browser/native_window.h | 4 ++++ runtime/browser/web_application.cc | 29 +++++++++++++++++++++++++++++ runtime/browser/web_application.h | 1 + 4 files changed, 58 insertions(+) diff --git a/runtime/browser/native_window.cc b/runtime/browser/native_window.cc index 6e723e5..43f6bef 100755 --- a/runtime/browser/native_window.cc +++ b/runtime/browser/native_window.cc @@ -23,6 +23,7 @@ #include "common/arraysize.h" #include "common/logger.h" +#include "common/platform_info.h" namespace runtime { @@ -75,6 +76,8 @@ NativeWindow::NativeWindow() currentViewModeFullScreen_(false), focus_(NULL), content_(NULL), + progressbar_(NULL), + top_layout_(NULL), rotation_(0), handler_id_(0) { } @@ -126,6 +129,7 @@ void NativeWindow::Initialize() { EVAS_SIZE_EXPAND_FILL(top_layout); elm_object_content_set(conformant, top_layout); evas_object_show(top_layout); + top_layout_ = top_layout; // focus Evas_Object* focus = elm_bg_add(top_layout); @@ -139,6 +143,17 @@ void NativeWindow::Initialize() { evas_object_show(focus); focus_ = focus; + if (common::getProfile() == common::kPROFILE_MOBILE) { + // progressbar + Evas_Object *progressbar = elm_progressbar_add(top_layout); + EVAS_SIZE_EXPAND_FILL(progressbar); + elm_progressbar_unit_format_set(progressbar, "%1.1f%%"); + elm_progressbar_horizontal_set(progressbar, EINA_TRUE); + elm_object_part_content_set(top_layout, "elm.swallow.progress", progressbar); + evas_object_show(progressbar); + progressbar_ = progressbar; + } + // focus callback auto focus_callback = [](void* user_data, Evas_Object*, @@ -304,4 +319,13 @@ void NativeWindow::ManualRotationDone() { } } +void NativeWindow::SignalEmit(const char* emission, + const char* source) { + elm_object_signal_emit(top_layout_, emission, source); +} + +void NativeWindow::UpdateProgress(double value) { + elm_progressbar_value_set(progressbar_, ELM_SCALE_SIZE(value)); +} + } // namespace runtime diff --git a/runtime/browser/native_window.h b/runtime/browser/native_window.h index 0a5f23c..a305389 100755 --- a/runtime/browser/native_window.h +++ b/runtime/browser/native_window.h @@ -63,6 +63,8 @@ class NativeWindow { Type type() const { return window_type_;} void EnableManualRotation(bool enable); void ManualRotationDone(); + void SignalEmit(const char* emission, const char* source); + void UpdateProgress(double value); protected: virtual Evas_Object* CreateWindowInternal() = 0; @@ -80,6 +82,8 @@ class NativeWindow { bool currentViewModeFullScreen_; Evas_Object* focus_; Evas_Object* content_; + Evas_Object* progressbar_; + Evas_Object* top_layout_; int rotation_; int handler_id_; ScreenOrientation natural_orientation_; diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 4e3d730..b8a95bc 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -144,6 +144,10 @@ const char* kDefaultCSPRule = const char* kResWgtPath = "res/wgt/"; const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main"; +// window signal callback +const char *kEdjeShowProgressSignal = "show,progress,signal"; +const char *kEdjeHideProgressSignal = "hide,progress,signal"; + const std::string kViewmodeTypeFullscreen = "fullscreen"; const std::string kViewmodeTypeWindowed = "windowed"; @@ -1144,8 +1148,33 @@ void WebApplication::OnLoadStart(WebView* /*view*/) { LOGGER(DEBUG) << "LoadStart"; } +void WebApplication::OnLoadProgress(WebView* view, double persent) { + LOGGER(DEBUG) << "LoadProgress, progress ;"<setting_info() != NULL && + app_data_->setting_info()->progressbar_presence()) || + (app_data_->widget_info() != NULL && + app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) { + if (persent == 1.0) { + window_->SignalEmit(kEdjeHideProgressSignal, ""); + } else { + window_->SignalEmit(kEdjeShowProgressSignal, ""); + window_->UpdateProgress(persent); + } + } + } +} + void WebApplication::OnLoadFinished(WebView* /*view*/) { LOGGER(DEBUG) << "LoadFinished"; + if (common::getProfile() == common::kPROFILE_MOBILE) { + if ((app_data_->setting_info() != NULL && + app_data_->setting_info()->progressbar_presence()) || + (app_data_->widget_info() != NULL && + app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) { + window_->SignalEmit(kEdjeHideProgressSignal, ""); + } + } splash_screen_->HideSplashScreen(SplashScreen::HideReason::LOADFINISHED); } diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index 0614f1f..99e56d0 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -71,6 +71,7 @@ class WebApplication : public WebView::EventListener { virtual void OnHardwareKey(WebView* view, const std::string& keyname); virtual void OnConsoleMessage(const std::string& msg, int level); virtual void OnLoadStart(WebView* view); + virtual void OnLoadProgress(WebView* view, double persent); virtual void OnLoadFinished(WebView* view); virtual void OnRendered(WebView* view); virtual void OnLanguageChanged(); -- 2.7.4 From 10cdfc656c2adc296461a5ab703286b8bb2b0a14 Mon Sep 17 00:00:00 2001 From: Pawel Niemirski Date: Wed, 28 Jun 2017 12:11:50 +0200 Subject: [PATCH 06/16] Register service worker on PWA launch Start the registration if config.xml has following metadata: Bug: http://suprem.sec.samsung.net/jira/browse/RWASP-1583 Change-Id: I9ada897e7b654b4a72596935b3d6dc4a53ce13c8 Signed-off-by: Pawel Niemirski --- runtime/browser/web_application.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index b8a95bc..4caa495 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -151,6 +151,8 @@ const char *kEdjeHideProgressSignal = "hide,progress,signal"; const std::string kViewmodeTypeFullscreen = "fullscreen"; const std::string kViewmodeTypeWindowed = "windowed"; +const char* const kServiceWorkerConfigKey = "service-worker-url"; + // Looking for added privilege by Application developer in config.xml. bool FindPrivilegeFromConfig(common::ApplicationData* app_data, const std::string& privilege) { @@ -282,6 +284,16 @@ static bool ProcessWellKnownScheme(const std::string& url) { return true; } +void OnDidRegisterServiceWorkerCb(Ewk_Context*, const char*, const char*, + Eina_Bool result, void*) { + if (result) { + LOGGER(DEBUG) << "Service-worker has been registered successfully"; + } else { + LOGGER(DEBUG) << + "An unexpected error has occurred during service-worker registeration"; + } +} + } // namespace std::vector ParseTizenVersion(const std::string& tizen_string) { @@ -530,6 +542,15 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { resource_manager_->GetStartResource(appcontrol.get()); view->SetDefaultEncoding(res->encoding()); + if (app_data_->meta_data_info().get() && + app_data_->meta_data_info()->HasKey(kServiceWorkerConfigKey)) { + std::string service_worker_url = + app_data_->meta_data_info()->GetValue(kServiceWorkerConfigKey); + ewk_context_service_worker_register(ewk_context_, res->uri().c_str(), + service_worker_url.c_str(), + OnDidRegisterServiceWorkerCb, this); + } + STEP_PROFILE_END("OnCreate -> URL Set"); STEP_PROFILE_START("URL Set -> Rendered"); -- 2.7.4 From f243269ce5ed3b7873822be118149af731f7bb06 Mon Sep 17 00:00:00 2001 From: "min7.choi" Date: Mon, 10 Jul 2017 10:39:10 +0900 Subject: [PATCH 07/16] Remove caps due to security issue & apply caps directly in security-config Change-Id: I70b6f0e2b4c1fb65c2bbecb5bd741c737ac020ed Signed-off-by: min7.choi --- packaging/crosswalk-tizen.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index baed898..6f41520 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -253,7 +253,6 @@ rm -fr %{buildroot} %attr(644,root,root) %{_datadir}/aul/wrt.loader %attr(755,root,root) %{_bindir}/wrt-upgrade %attr(755,root,root) %{_datadir}/upgrade/scripts/720.wrt.upgrade.sh -%caps(cap_sys_admin,cap_setgid=ei) %{_bindir}/wrt-loader %license LICENSE LICENSE.BSD # If it is unified or wearable, create circular-display extension -- 2.7.4 From 0813953a6f113909b0adad3f41088d0e083de8bc Mon Sep 17 00:00:00 2001 From: Pawel Niemirski Date: Wed, 12 Jul 2017 14:13:09 +0200 Subject: [PATCH 08/16] Support swipe to refresh feature Enable the feature if config.xml has following metadata: Bug: http://suprem.sec.samsung.net/jira/browse/RWASP-1534 Change-Id: Id430ea44a3bb344a2836e841f5103a1bb1f55141 Signed-off-by: Pawel Niemirski --- runtime/browser/web_application.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 4caa495..014e882 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -153,6 +153,8 @@ const std::string kViewmodeTypeWindowed = "windowed"; const char* const kServiceWorkerConfigKey = "service-worker-url"; +const char* const kEnableSwipeToRefreshConfigKey = "enable-swipe-to-refresh"; + // Looking for added privilege by Application developer in config.xml. bool FindPrivilegeFromConfig(common::ApplicationData* app_data, const std::string& privilege) { @@ -551,6 +553,12 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { OnDidRegisterServiceWorkerCb, this); } + if (app_data_->meta_data_info().get() && + app_data_->meta_data_info()->HasKey(kEnableSwipeToRefreshConfigKey)) { + Ewk_Settings* settings = ewk_view_settings_get(view->evas_object()); + ewk_settings_swipe_to_refresh_enabled_set(settings, EINA_TRUE); + } + STEP_PROFILE_END("OnCreate -> URL Set"); STEP_PROFILE_START("URL Set -> Rendered"); -- 2.7.4 From 604ec856a53f38ec68f996361d5c87d556684a9e Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Fri, 11 Aug 2017 18:46:58 +0900 Subject: [PATCH 09/16] Add ASLR to wrt-loader and wrt-upgrade Change-Id: Ib16832362f941d15cb68c894ea815512cfb086b1 Signed-off-by: jaekuk, lee --- loader/loader.gyp | 3 +++ wrt-upgrade/wrt-upgrade.gyp | 3 +++ 2 files changed, 6 insertions(+) mode change 100644 => 100755 loader/loader.gyp diff --git a/loader/loader.gyp b/loader/loader.gyp old mode 100644 new mode 100755 index 152ec46..3e99808 --- a/loader/loader.gyp +++ b/loader/loader.gyp @@ -9,6 +9,9 @@ 'sources': [ 'wrt_loader.cc', ], + 'ldflags': [ + '-pie', + ], 'variables': { 'packages': [ 'dlog', diff --git a/wrt-upgrade/wrt-upgrade.gyp b/wrt-upgrade/wrt-upgrade.gyp index cc8a116..55b48a6 100755 --- a/wrt-upgrade/wrt-upgrade.gyp +++ b/wrt-upgrade/wrt-upgrade.gyp @@ -13,6 +13,9 @@ 'wrt-upgrade.cc', 'wrt-upgrade-info.cc', ], + 'ldflags': [ + '-pie', + ], 'variables': { 'packages': [ 'sqlite3', -- 2.7.4 From 3e911dbe7e3f4c2496a4fd98ca8c4286fbc069a5 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Wed, 23 Aug 2017 17:32:45 +0900 Subject: [PATCH 10/16] Added code to check whether wayland get ready before running Web Runtime Change-Id: Ib06f4fc51fa554893ece5c26af8e592838e31d76 Signed-off-by: jaekuk, lee --- runtime/browser/runtime_process.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/browser/runtime_process.cc b/runtime/browser/runtime_process.cc index 4a1576b..9f294ae 100755 --- a/runtime/browser/runtime_process.cc +++ b/runtime/browser/runtime_process.cc @@ -103,7 +103,10 @@ int real_main(int argc, char* argv[]) { // Default behavior, run as runtime. LOGGER(INFO) << "Runtime process has been created."; if (!g_prelaunch) { - ewk_init(); + if (!ewk_init()) { + LOGGER(ERROR) << "could not init ewk"; + return false; + } char* chromium_arg_options[] = { argv[0], const_cast("--no-sandbox"), @@ -150,8 +153,11 @@ int main(int argc, char* argv[]) { if (strcmp(argv[0], "/usr/bin/wrt-loader") == 0) { auto preload = [argv](void) { LOGGER(DEBUG) << "run with wrt-loader"; + if (!ewk_init()) { + LOGGER(ERROR) << "could not init ewk"; + return false; + } g_prelaunch = true; - ewk_init(); char* chromium_arg_options[] = { argv[0], const_cast("--no-sandbox"), -- 2.7.4 From fcca274bd6fa16d4381946878e2c027d8620a33d Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Thu, 27 Jul 2017 19:03:50 +0900 Subject: [PATCH 11/16] Delete NotificationCallback Notification icon and badge were implemented on Web Engine side. (https://review.tizen.org/gerrit/#/c/137819/) So ewk_context_notification_callbacks_set API was removed from WRT. Change-Id: I4fe497eaa944fc761f671b9d01fe41148b1dcbd1 Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 27 --------------------------- runtime/runtime.gyp | 2 -- 2 files changed, 29 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 014e882..390f990 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -44,7 +44,6 @@ #include "extensions/renderer/xwalk_extension_renderer_controller.h" #include "common/platform_info.h" #include "runtime/browser/native_window.h" -#include "runtime/browser/notification_manager.h" #include "runtime/browser/popup.h" #include "runtime/browser/popup_string.h" #include "runtime/browser/vibration_manager.h" @@ -216,31 +215,6 @@ static void SendDownloadRequest(const std::string& url) { request.LaunchRequest(); } -static void InitializeNotificationCallback(Ewk_Context* ewk_context, - WebApplication* app) { - auto show = [](Ewk_Context*, Ewk_Notification* noti, void* user_data) { - WebApplication* self = static_cast(user_data); - if (self == NULL) return; - uint64_t id = ewk_notification_id_get(noti); - std::string title(ewk_notification_title_get(noti) - ? ewk_notification_title_get(noti) - : ""); - std::string body( - ewk_notification_body_get(noti) ? ewk_notification_body_get(noti) : ""); - std::string icon_path = self->data_path() + "/" + kNotiIconFile; - if (!ewk_notification_icon_save_as_png(noti, icon_path.c_str())) { - icon_path = ""; - } - if (NotificationManager::GetInstance()->Show(id, title, body, icon_path)) - ewk_notification_showed(id); - }; - auto hide = [](Ewk_Context*, uint64_t noti_id, void*) { - NotificationManager::GetInstance()->Hide(noti_id); - ewk_notification_closed(noti_id, EINA_FALSE); - }; - ewk_context_notification_callbacks_set(ewk_context, show, hide, app); -} - static Eina_Bool ExitAppIdlerCallback(void* data) { WebApplication* app = static_cast(data); @@ -423,7 +397,6 @@ bool WebApplication::Initialize() { }; ewk_context_did_start_download_callback_set(ewk_context_, download_callback, this); - InitializeNotificationCallback(ewk_context_, this); if (FindPrivilegeFromConfig(app_data_, kFullscreenPrivilege)) { ewk_context_tizen_extensible_api_string_set(ewk_context_, diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index 0beb057..30abbaf 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -39,8 +39,6 @@ 'browser/popup_string.cc', 'browser/vibration_manager.h', 'browser/vibration_manager.cc', - 'browser/notification_manager.h', - 'browser/notification_manager.cc', 'browser/prelauncher.h', 'browser/prelauncher.cc', 'browser/preload_manager.h', -- 2.7.4 From 262ea6d4ff6c81b70b17f7a80873c0905badda31 Mon Sep 17 00:00:00 2001 From: Bartlomiej Kunikowski Date: Fri, 8 Sep 2017 09:33:30 +0200 Subject: [PATCH 12/16] Adds getter and setter to efl window brightness This functions were added, because actually there isn't any brightness control function for Native Window. New Wrt message type is added also, so brightness setting and getting could be added to Web API now. Change-Id: Id2422a24dedffd7e75e18709d6cc7bab69da10a7 Signed-off-by: Bartlomiej Kunikowski Signed-off-by: Szymon Jastrzebski --- runtime/browser/native_window.cc | 12 ++++++++++++ runtime/browser/native_window.h | 2 ++ runtime/browser/web_application.cc | 27 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/runtime/browser/native_window.cc b/runtime/browser/native_window.cc index 43f6bef..e08964f 100755 --- a/runtime/browser/native_window.cc +++ b/runtime/browser/native_window.cc @@ -16,6 +16,7 @@ #include "runtime/browser/native_window.h" +#include #include #include #include @@ -291,6 +292,17 @@ void NativeWindow::SetCurrentViewModeFullScreen(bool mode) { currentViewModeFullScreen_ = mode; } +int NativeWindow::SetWindowBrightness(int brightness) { + if (brightness > 100) + brightness = 100; + + return efl_util_set_window_brightness(window_, brightness); +} + +int NativeWindow::GetWindowBrightness(int& brightness) { + return efl_util_get_window_brightness(window_, &brightness); +} + void NativeWindow::Show() { evas_object_show(window_); } diff --git a/runtime/browser/native_window.h b/runtime/browser/native_window.h index a305389..3cd094d 100755 --- a/runtime/browser/native_window.h +++ b/runtime/browser/native_window.h @@ -51,6 +51,8 @@ class NativeWindow { void SetRotationLock(ScreenOrientation orientation); void SetAutoRotation(); void SetCurrentViewModeFullScreen(bool mode); + int SetWindowBrightness(int brightness); + int GetWindowBrightness(int& brightness); int AddRotationHandler(RotationHandler handler); void RemoveRotationHandler(int id); int rotation() const { return rotation_; } diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 390f990..3ed2960 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -22,9 +22,11 @@ #include #include +#include #include #include #include +#include #include #include @@ -916,6 +918,31 @@ void WebApplication::OnReceivedWrtMessage(WebView* view, ewk_ipc_wrt_message_data_del(ans); } else if (TYPE_IS("tizen://hide_splash_screen")) { splash_screen_->HideSplashScreen(SplashScreen::HideReason::CUSTOM); + } else if (TYPE_IS("tizen://set_window_brightness")) { + // Brightness value parsing + long l_brightness = strtol(msg_value, nullptr, 10); + if (l_brightness == 0 && strncmp(msg_value, "0", 1)) { + LOGGER(ERROR) << "Received invalid brightness value: " << msg_value; + ewk_ipc_wrt_message_data_value_set(msg, "error"); + } + + int brightness = static_cast(l_brightness); + if (!window_->SetWindowBrightness(brightness)) { + ewk_ipc_wrt_message_data_value_set(msg, "success"); + } else { + ewk_ipc_wrt_message_data_value_set(msg, "error"); + } + } else if (TYPE_IS("tizen://get_window_brightness")) { + int brightness; + int status = window_->GetWindowBrightness(brightness); + std::string answer = "{\"status\":\""; + if (status == 0) { + answer += "success\",\"result\":"; + answer += std::to_string(brightness) + "}"; + } else { + answer += "error\"}"; + } + ewk_ipc_wrt_message_data_value_set(msg, answer.c_str()); } eina_stringshare_del(msg_ref_id); -- 2.7.4 From d77075f0a65e01b983ff433c01e6fbb672b083f8 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 2 Jun 2017 17:32:16 +0900 Subject: [PATCH 13/16] Fix codes about initializing the VCWebView handle This change is related with a commit of vc-webview module. https://review.tizen.org/gerrit/#/c/132420/ With this commit, static class VCWebView dynamically can response to the vconf key changing. Therefore, WRT does not need to check vconf key to initialize the voice touch anymore. Change-Id: Ic1a7a6e191563e7196efe72541a857e4a80048fa Signed-off-by: Suyeon Hwang --- runtime/browser/web_application.cc | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index b8a95bc..1b40dcc 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -490,12 +490,8 @@ bool WebApplication::Initialize() { m_tizenCompatibilitySettings.m_release = 0; // Get Web voice touch agent - bool is_supported_web_vt = false; - vc_webview_ = NULL; - if (0 == VCWebView::vc_is_supported_web_vt(&is_supported_web_vt) && is_supported_web_vt) { - LOGGER(DEBUG) << "[DEBUG] Web voice touch is enabled"; - vc_webview_ = VCWebView::getInstance(); - } + LOGGER(DEBUG) << "[DEBUG] Web voice touch is enabled"; + vc_webview_ = VCWebView::getInstance(); return true; } @@ -550,9 +546,7 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { view_stack_.push_front(view); // Set web view into Web voice touch agent - if (NULL != vc_webview_) { - vc_webview_->vc_webview_set_view(view->evas_object()); - } + vc_webview_->vc_webview_set_view(view->evas_object()); // ewk_view_bg_color_set is not working at webview initialization. if (common::getProfile() == common::kPROFILE_WEARABLE && @@ -765,9 +759,7 @@ void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) { window_->SetContent(new_view->evas_object()); // Set web view into Web voice touch agent - if (NULL != vc_webview_) { - vc_webview_->vc_webview_set_view(new_view->evas_object()); - } + vc_webview_->vc_webview_set_view(new_view->evas_object()); } void WebApplication::RemoveWebViewFromStack(WebView* view) { @@ -807,9 +799,7 @@ void WebApplication::RemoveWebViewFromStack(WebView* view) { window_->SetContent(view_stack_.front()->evas_object()); // Set web view into Web voice touch agent - if (NULL != vc_webview_) { - vc_webview_->vc_webview_set_view(view_stack_.front()->evas_object()); - } + vc_webview_->vc_webview_set_view(view_stack_.front()->evas_object()); } // Delete after the callback context(for ewk view) was not used @@ -964,7 +954,7 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { ? app_data_->setting_info()->hwkey_enabled() : true; - if (NULL != vc_webview_ && kKeyNameBack == keyname && vc_webview_->vc_get_conflict_status() == 1) { + if (kKeyNameBack == keyname && vc_webview_->vc_get_conflict_status() == 1) { // When Web voice touch is in result conflict state, function of back key change to // canceling the conflict state vc_webview_->vc_remove_tooltip(); @@ -1165,7 +1155,7 @@ void WebApplication::OnLoadProgress(WebView* view, double persent) { } } -void WebApplication::OnLoadFinished(WebView* /*view*/) { +void WebApplication::OnLoadFinished(WebView* view) { LOGGER(DEBUG) << "LoadFinished"; if (common::getProfile() == common::kPROFILE_MOBILE) { if ((app_data_->setting_info() != NULL && @@ -1176,6 +1166,9 @@ void WebApplication::OnLoadFinished(WebView* /*view*/) { } } splash_screen_->HideSplashScreen(SplashScreen::HideReason::LOADFINISHED); + + // Set web view into Web voice touch agent + vc_webview_->vc_webview_set_view(view->evas_object()); } void WebApplication::OnRendered(WebView* view) { @@ -1184,11 +1177,6 @@ void WebApplication::OnRendered(WebView* view) { LOGGER(DEBUG) << "Rendered"; splash_screen_->HideSplashScreen(SplashScreen::HideReason::RENDERED); - // Set web view into Web voice touch agent - if (NULL != vc_webview_) { - vc_webview_->vc_webview_set_view(view->evas_object()); - } - // Do not show(), active() for language change if(lang_changed_mode_ == false){ // Show window after frame rendered. -- 2.7.4 From 46c3f83ce40d25c0816ca703221fafd8dcfb051e Mon Sep 17 00:00:00 2001 From: "min7.choi" Date: Mon, 15 Jan 2018 15:33:17 +0900 Subject: [PATCH 14/16] Remove Ecore-wayland dependency In Tizen 5.0, upgrading EFL to opensource EFL 1.20 version. Upstream has deprecated ecore-wayland and changed its policy to use ecore-wl2. In crosswalk, there is one api with an ecore-wayland dependency(ecore_wl_screen_size_get()). This can be replaced by elm_win_screen_size_get() api. So removed the ecore-wayland dependency and used elm_win_screen_size_get(). Change-Id: Ic9f3b5ee66e44ebc05ba2eb2f22a111aa883d903 Signed-off-by: min7.choi --- packaging/crosswalk-tizen.spec | 1 - runtime/browser/native_window.cc | 3 +-- runtime/browser/notification_window.cc | 1 - runtime/browser/runtime_process.cc | 1 - runtime/browser/splash_screen.cc | 6 +++--- runtime/browser/splash_screen.h | 2 +- runtime/runtime.gyp | 1 - 7 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index 6f41520..9e24101 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -34,7 +34,6 @@ BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(deviced) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(ecore-wayland) BuildRequires: pkgconfig(efl-extension) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(glib-2.0) diff --git a/runtime/browser/native_window.cc b/runtime/browser/native_window.cc index e08964f..1f2fde2 100755 --- a/runtime/browser/native_window.cc +++ b/runtime/browser/native_window.cc @@ -17,7 +17,6 @@ #include "runtime/browser/native_window.h" #include -#include #include #include #include @@ -97,7 +96,7 @@ void NativeWindow::Initialize() { window_ = CreateWindowInternal(); elm_win_conformant_set(window_, EINA_TRUE); int w, h; - ecore_wl_screen_size_get(&w, &h); + elm_win_screen_size_get(window_, NULL, NULL, &w, &h); evas_object_resize(window_, w, h); elm_win_size_base_set(window_, w, h); elm_win_autodel_set(window_, EINA_TRUE); diff --git a/runtime/browser/notification_window.cc b/runtime/browser/notification_window.cc index ee70e53..e701601 100644 --- a/runtime/browser/notification_window.cc +++ b/runtime/browser/notification_window.cc @@ -15,7 +15,6 @@ */ #include -#include #include namespace runtime { diff --git a/runtime/browser/runtime_process.cc b/runtime/browser/runtime_process.cc index 9f294ae..e397c27 100755 --- a/runtime/browser/runtime_process.cc +++ b/runtime/browser/runtime_process.cc @@ -20,7 +20,6 @@ #include #include -#include #include "common/application_data.h" #include "common/command_line.h" diff --git a/runtime/browser/splash_screen.cc b/runtime/browser/splash_screen.cc index 6b7b456..f588258 100755 --- a/runtime/browser/splash_screen.cc +++ b/runtime/browser/splash_screen.cc @@ -111,7 +111,7 @@ SplashScreen::SplashScreen( ChooseOrientation(splash_map, window->orientation()); if (used_orientation == wgt::parse::ScreenOrientation::NONE) return; - auto dimensions = GetDimensions(); + auto dimensions = GetDimensions(window); SetBackground(splash_map[used_orientation], window->evas_object(), dimensions, app_path); @@ -145,9 +145,9 @@ void SplashScreen::HideSplashScreen(HideReason reason) { is_active_ = false; } -std::pair SplashScreen::GetDimensions() { +std::pair SplashScreen::GetDimensions(NativeWindow* window) { int w, h; - ecore_wl_screen_size_get(&w, &h); + elm_win_screen_size_get(window->evas_object(), NULL, NULL, &w, &h); evas_object_resize(background_, w, h); return std::make_pair(w, h); } diff --git a/runtime/browser/splash_screen.h b/runtime/browser/splash_screen.h index 11d49cd..bde9894 100755 --- a/runtime/browser/splash_screen.h +++ b/runtime/browser/splash_screen.h @@ -41,7 +41,7 @@ class SplashScreen { void HideSplashScreen(HideReason reason); private: - std::pair GetDimensions(); + std::pair GetDimensions(NativeWindow* window); void SetBackground(const wgt::parse::LaunchScreenData& splash_data, Evas_Object* parent, const SplashScreenBound& bound, const std::string& app_path); diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index 30abbaf..ce48619 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -55,7 +55,6 @@ 'capi-system-info', 'chromium-efl', 'ecore', - 'ecore-wayland', 'elementary', 'efl-extension', 'deviced', -- 2.7.4 From edc95c01e48344ee2d3d6475c43eac1de2c18db9 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Thu, 1 Feb 2018 17:44:57 +0900 Subject: [PATCH 15/16] Remove update script Change-Id: I16302cb190e43f9be99179628fdbda902243c417 Signed-off-by: jaekuk, lee --- packaging/crosswalk-tizen.spec | 7 - wrt-upgrade/720.wrt.upgrade.sh | 16 --- wrt-upgrade/wrt-upgrade-info.cc | 171 ----------------------- wrt-upgrade/wrt-upgrade-info.h | 103 -------------- wrt-upgrade/wrt-upgrade.cc | 294 ---------------------------------------- wrt-upgrade/wrt-upgrade.gyp | 38 ------ wrt-upgrade/wrt-upgrade.h | 34 ----- xwalk_tizen.gyp | 1 - 8 files changed, 664 deletions(-) delete mode 100755 wrt-upgrade/720.wrt.upgrade.sh delete mode 100644 wrt-upgrade/wrt-upgrade-info.cc delete mode 100644 wrt-upgrade/wrt-upgrade-info.h delete mode 100755 wrt-upgrade/wrt-upgrade.cc delete mode 100755 wrt-upgrade/wrt-upgrade.gyp delete mode 100644 wrt-upgrade/wrt-upgrade.h mode change 100644 => 100755 xwalk_tizen.gyp diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index 9e24101..945b02e 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -182,7 +182,6 @@ mkdir -p %{buildroot}%{_datadir}/locale mkdir -p %{buildroot}%{_datadir}/icons/xwalk mkdir -p %{buildroot}%{_datadir}/edje/xwalk mkdir -p %{buildroot}%{extension_path} -mkdir -p %{buildroot}%{_datadir}/upgrade/scripts # Loader script file mkdir -p %{buildroot}%{_datadir}/aul/ @@ -226,10 +225,6 @@ install -p -m 755 out/Default/lib/libxwalk_injected_bundle.so %{buildroot}%{_lib # wrt-loader install -p -m 755 out/Default/wrt-loader %{buildroot}%{_bindir} -# wrt-upgrade -install -p -m 755 out/Default/wrt-upgrade %{buildroot}%{_bindir} -install -p -m 644 out/Default/gen/720.wrt.upgrade.sh %{buildroot}%{_datadir}/upgrade/scripts/720.wrt.upgrade.sh - %clean rm -fr %{buildroot} @@ -250,8 +245,6 @@ rm -fr %{buildroot} %attr(755,root,root) %{_bindir}/wrt-client %attr(755,root,root) %{_bindir}/wrt-loader %attr(644,root,root) %{_datadir}/aul/wrt.loader -%attr(755,root,root) %{_bindir}/wrt-upgrade -%attr(755,root,root) %{_datadir}/upgrade/scripts/720.wrt.upgrade.sh %license LICENSE LICENSE.BSD # If it is unified or wearable, create circular-display extension diff --git a/wrt-upgrade/720.wrt.upgrade.sh b/wrt-upgrade/720.wrt.upgrade.sh deleted file mode 100755 index 805a177..0000000 --- a/wrt-upgrade/720.wrt.upgrade.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -PATH=/bin:/usr/bin:/sbin:/usr/sbin - -#excute upgrade application -/usr/bin/wrt-upgrade - -#remove unuse databases -rm /opt/dbspace/.wrt.db -rm /opt/dbspace/.wrt.db-journal - -rm -r /opt/share/widget - -rm /opt/usr/dbspace/.wrt_custom_handler.db -rm /opt/usr/dbspace/.wrt_custom_handler.db-journal -rm /opt/usr/dbspace/.wrt_i18n.db -rm /opt/usr/dbspace/.wrt_i18n.db-journal diff --git a/wrt-upgrade/wrt-upgrade-info.cc b/wrt-upgrade/wrt-upgrade-info.cc deleted file mode 100644 index ca905fe..0000000 --- a/wrt-upgrade/wrt-upgrade-info.cc +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 2013 Intel Corporation. All rights reserved. -// Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "wrt-upgrade/wrt-upgrade-info.h" -#include "common/logger.h" - -// #include - -namespace { -const std::string kSectionPrefix = "_SECT_"; -const std::string kSectionSuffix = "_SECT_"; - -const std::string kDBPublicSection = "public"; -const std::string kDBPrivateSection = "private"; - -const std::string kGeolocationPermissionPrefix = "__WRT_GEOPERM_"; -const std::string kNotificationPermissionPrefix = "__WRT_NOTIPERM_"; -const std::string kQuotaPermissionPrefix = "__WRT_QUOTAPERM_"; -const std::string kCertificateAllowPrefix = "__WRT_CERTIPERM_"; -const std::string kUsermediaPermissionPrefix = "__WRT_USERMEDIAPERM_"; - -const std::string kValueAllow = "allowed"; -const std::string kValueDenied = "denied"; -const std::string kValueUnknown = "unknown"; - -const std::string kAppDirectoryPrefix = "/opt/usr/home/owner/apps_rw/"; -const std::string kAppSecurityOriginDBFile = "/data/.security_origin.db"; -const std::string kAppCertificateDBFile = "/data/.certificate.db"; - -enum { - FEATURE_GEOLOCATION = 0, - FEATURE_WEB_NOTIFICATION, - FEATURE_USER_MEDIA, - FEATURE_FULLSCREEN_MODE, - FEATURE_WEB_DATABASE, - FEATURE_CAMERA, - FEATURE_AUDIO_RECORDER -}; -enum { - RESULT_UNKNOWN = 0, - RESULT_ALLOW_ONCE, - RESULT_DENY_ONCE, - RESULT_ALLOW_ALWAYS, - RESULT_DENY_ALWAYS -}; -} // namespace - -namespace upgrade { - -PreferenceInfo::PreferenceInfo(std::string key, std::string value) { - m_section_ = kDBPublicSection; - m_key_ = key; - m_value_ = value; -} -SecurityOriginInfo::SecurityOriginInfo( - int feature, - std::string scheme, - std::string host, - int port, - int result) { - m_section_ = kDBPrivateSection; - m_key_ = translateKey(feature, scheme, host, port); - m_value_ = translateValue(result); -} -std::string SecurityOriginInfo::translateKey( - int feature, - std::string scheme, - std::string host, - int port) { - - std::string key = ""; - - switch (feature) { - case FEATURE_GEOLOCATION : - key += kGeolocationPermissionPrefix; - break; - case FEATURE_WEB_NOTIFICATION : - key += kNotificationPermissionPrefix; - break; - case FEATURE_USER_MEDIA : - key += kUsermediaPermissionPrefix; - break; - case FEATURE_WEB_DATABASE : - key += kQuotaPermissionPrefix; - break; - default : - break; - } - - key += scheme; - key += "://"; - key += host; - key += ":"; - key += std::to_string(port); - - return key; -} -std::string SecurityOriginInfo::translateValue(int result) { - std::string value = ""; - - switch (result) { - case RESULT_ALLOW_ALWAYS : - value = kValueAllow; - break; - case RESULT_DENY_ALWAYS : - value = kValueDenied; - break; - case RESULT_UNKNOWN : - case RESULT_ALLOW_ONCE : - case RESULT_DENY_ONCE : - default : - value = kValueUnknown; - break; - } - return value; -} -CertificateInfo::CertificateInfo( - std::string pem, - int result) { - m_section_ = kDBPrivateSection; - m_key_ = translateKey(pem); - m_value_ = translateValue(result); -} -std::string CertificateInfo::translateKey(std::string pem) { - std::string key = ""; - key = kCertificateAllowPrefix + pem; - return key; -} -std::string CertificateInfo::translateValue(int result) { - std::string value = ""; - - switch (result) { - case RESULT_ALLOW_ALWAYS : - value = kValueAllow; - break; - case RESULT_DENY_ALWAYS : - value = kValueDenied; - break; - case RESULT_UNKNOWN : - case RESULT_ALLOW_ONCE : - case RESULT_DENY_ONCE : - default : - value = kValueUnknown; - break; - } - return value; -} -WrtUpgradeInfo::WrtUpgradeInfo(std::string appid) { - app_id_ = appid; - pkg_id_ = appid.substr(0, appid.find_first_of('.')); - app_dir_ = kAppDirectoryPrefix + pkg_id_; -} -void WrtUpgradeInfo::addPreferenceInfo(PreferenceInfo preference) { - preference_info_list_.push_back(preference); -} -void WrtUpgradeInfo::addSecurityOriginInfo(SecurityOriginInfo security_origin) { - security_origin_info_list_.push_back(security_origin); -} -void WrtUpgradeInfo::addCertificateInfo(CertificateInfo certificate) { - certificate_info_list.push_back(certificate); -} - -std::string WrtUpgradeInfo::getSecurityOriginDB() { - return app_dir_ + kAppSecurityOriginDBFile; -} -std::string WrtUpgradeInfo::getCertificateDB() { - return app_dir_ + kAppCertificateDBFile; -} -} // namespace upgrade diff --git a/wrt-upgrade/wrt-upgrade-info.h b/wrt-upgrade/wrt-upgrade-info.h deleted file mode 100644 index c304e62..0000000 --- a/wrt-upgrade/wrt-upgrade-info.h +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2013 Intel Corporation. All rights reserved. -// Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WRT_UPGRADE_INFO_H -#define WRT_UPGRADE_INFO_H - -#include -#include -#include - -namespace upgrade { -class PreferenceInfo{ - public: - PreferenceInfo(std::string key, std::string value); - std::string getSection() {return m_section_;} - std::string getKey() {return m_key_;} - std::string getValue() {return m_value_;} - private: - std::string m_section_; - std::string m_key_; - std::string m_value_; -}; - -class SecurityOriginInfo{ - public: - SecurityOriginInfo( - int feature, - std::string scheme, - std::string host, - int port, - int result); - std::string getSection() {return m_section_;} - std::string getKey() {return m_key_;} - std::string getValue() {return m_value_;} - private: - std::string translateKey( - int feature, - std::string scheme, - std::string host, - int port); - std::string translateValue(int result); - std::string m_section_; - std::string m_key_; - std::string m_value_; -}; - -class CertificateInfo{ - public: - CertificateInfo( - std::string pem, - int result); - std::string getSection() {return m_section_;} - std::string getKey() {return m_key_;} - std::string getValue() {return m_value_;} - private: - std::string translateKey(std::string pem); - std::string translateValue(int result); - std::string m_section_; - std::string m_key_; - std::string m_value_; -}; - -class WrtUpgradeInfo{ - public: - WrtUpgradeInfo() {} - explicit WrtUpgradeInfo(std::string appid); - - std::string getAppid() { return app_id_; } - std::string getPkgid() { return pkg_id_; } - std::string getAppDir() { return app_dir_; } - std::string getSecurityOriginDB(); - std::string getCertificateDB(); - - void addPreferenceInfo(PreferenceInfo preference); - void addSecurityOriginInfo(SecurityOriginInfo security_origin); - void addCertificateInfo(CertificateInfo certificate); - - PreferenceInfo getPreferenceInfo(int idx) - {return preference_info_list_[idx];} - SecurityOriginInfo getSecurityOriginInfo(int idx) - {return security_origin_info_list_[idx];} - CertificateInfo getCertificateInfo(int idx) - {return certificate_info_list[idx];} - - int getPreferenceInfoSize() - {return static_cast(preference_info_list_.size());} - int getSecurityOriginInfoSize() - {return static_cast(security_origin_info_list_.size());} - int getCertificateInfoSize() - {return static_cast(certificate_info_list.size());} - - private: - std::string pkg_id_; - std::string app_id_; - std::string app_dir_; - std::vector preference_info_list_; - std::vector security_origin_info_list_; - std::vector certificate_info_list; -}; -} // namespace upgrade -#endif // WRT_UPGRADE_INFO_H diff --git a/wrt-upgrade/wrt-upgrade.cc b/wrt-upgrade/wrt-upgrade.cc deleted file mode 100755 index 43e7ea4..0000000 --- a/wrt-upgrade/wrt-upgrade.cc +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright (c) 2013 Intel Corporation. All rights reserved. -// Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "wrt-upgrade/wrt-upgrade.h" - -#include -#include - -#include -#include -#include - -#include "common/picojson.h" -#include "common/logger.h" -#include "common/file_utils.h" - -namespace { - const std::string kWRTDbFile = "/opt/dbspace/.wrt.db"; - const std::string kAppDirectoryPrefix = "/opt/usr/home/owner/apps_rw/"; - const std::string kAppMigrationFile = "/data/.runtime.migration"; - const std::string kJournalPostfix = "-journal"; -} // namespace - -namespace upgrade { -WrtUpgrade::WrtUpgrade() { -} -WrtUpgrade::~WrtUpgrade() { -} -void WrtUpgrade::Run() { - ParseWrtDatabse(); - ParseSecurityOriginDatabase(); - ParseCertificatenDatabase(); - CreateMigrationFile(); - RemoveDatabases(); -} -void WrtUpgrade::ParseWrtDatabse() { - std::cout << "parseWrtDatabse" << std::endl; - sqlite3 *wrt_db; - try { - int ret = sqlite3_open(kWRTDbFile.c_str(), &wrt_db); - if (ret != SQLITE_OK) { - throw("error to open wrt database"); - } - - // get applist - std::string query = "select tizen_appid from widgetinfo"; - sqlite3_stmt* stmt = NULL; - - ret = sqlite3_prepare_v2(wrt_db, query.c_str() , -1, &stmt, NULL); - if (ret != SQLITE_OK) { - throw("error for prepare query"); - } - - while (SQLITE_ROW == sqlite3_step(stmt)) { - std::string appid - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 0))); - application_list_.push_back(appid); - application_map_.insert( - std::pair(appid, WrtUpgradeInfo(appid))); - } - - ret = sqlite3_finalize(stmt); - if (ret != SQLITE_OK) { - throw("error for finalize stmt"); - } - - // get widget preference - query = "select tizen_appid,key_name,key_value from widgetpreference"; - stmt = NULL; - - ret = sqlite3_prepare_v2(wrt_db, query.c_str() , -1, &stmt, NULL); - if (ret != SQLITE_OK) { - throw("error for prepare query"); - } - - while (SQLITE_ROW == sqlite3_step(stmt)) { - std::string appid - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 0))); - std::string key - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 1))); - std::string value - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 2))); - - application_map_[appid].addPreferenceInfo(PreferenceInfo(key, value)); - } - ret = sqlite3_finalize(stmt); - if (ret != SQLITE_OK) { - throw("error for finalize stmt"); - } - } catch(const char* err) { - std::cout << err << std::endl; - } - sqlite3_close(wrt_db); -} -void WrtUpgrade::ParseSecurityOriginDatabase() { - std::cout << "parseSecurityOriginDatabase" << std::endl; - for (int i = 0; i < static_cast(application_list_.size()) ; i++) { - sqlite3 *security_origin_db; - std::string appid = application_list_[i]; - try { - std::string db_path = application_map_[appid].getSecurityOriginDB(); - - if (access(db_path.c_str(), 0) != 0) { - throw("file is not exist : ["+db_path+"]"); - } - int ret = sqlite3_open(db_path.c_str(), &security_origin_db); - if (ret != SQLITE_OK) { - throw("error to open wrt database"); - } - - // get applist - std::string query = "select * from securityorigininfo"; - sqlite3_stmt* stmt = NULL; - - ret = sqlite3_prepare_v2( - security_origin_db, query.c_str() , -1, &stmt, NULL); - if (ret != SQLITE_OK) { - throw("error for prepare query"); - } - - while (SQLITE_ROW == sqlite3_step(stmt)) { - int feature = sqlite3_column_int(stmt, 0); - std::string scheme - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 1))); - std::string host - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 2))); - int port = sqlite3_column_int(stmt, 3); - int result = sqlite3_column_int(stmt, 4); - application_map_[appid].addSecurityOriginInfo( - SecurityOriginInfo(feature, scheme, host, port, result)); - } - - ret = sqlite3_finalize(stmt); - if (ret != SQLITE_OK) { - throw("error for finalize stmt"); - } - } catch(...) { - } - sqlite3_close(security_origin_db); - } -} -void WrtUpgrade::ParseCertificatenDatabase() { - std::cout << "parseCertificateDatabase" << std::endl; - for (int i = 0 ; i < static_cast(application_list_.size()) ; i++) { - sqlite3 *certificate_db; - std::string appid = application_list_[i]; - try { - std::string db_path = application_map_[appid].getCertificateDB(); - - if (access(db_path.c_str(), 0) != 0) { - throw("file is not exist : ["+db_path+"]"); - } - int ret = sqlite3_open(db_path.c_str(), &certificate_db); - if (ret != SQLITE_OK) { - throw("error to open wrt database"); - } - - // get applist - std::string query = "select * from certificateinfo"; - sqlite3_stmt* stmt = NULL; - - ret = sqlite3_prepare_v2(certificate_db, query.c_str() , -1, &stmt, NULL); - if (ret != SQLITE_OK) { - throw("error for prepare query"); - } - - while (SQLITE_ROW == sqlite3_step(stmt)) { - std::string certificate - = std::string(reinterpret_cast( - sqlite3_column_text(stmt, 0))); - int result = sqlite3_column_int(stmt, 1); - application_map_[appid].addCertificateInfo( - CertificateInfo(certificate, result)); - } - - ret = sqlite3_finalize(stmt); - if (ret != SQLITE_OK) { - throw("error for finalize stmt"); - } - } catch(...) { - } - sqlite3_close(certificate_db); - } -} -void WrtUpgrade::CreateMigrationFile() { - std::cout << "createMigrationFile" << std::endl; - for (int i = 0 ; i < static_cast(application_list_.size()) ; i++) { - std::string appid = application_list_[i]; - std::string json_str = CreateJsonObject(appid); - if (!json_str.empty()) { - std::string pkg_id = appid.substr(0, appid.find_first_of('.')); - std::string output_file_path - = kAppDirectoryPrefix + pkg_id + kAppMigrationFile; - std::ofstream output_file(output_file_path); - output_file << json_str; - output_file.close(); - } - } -} -void WrtUpgrade::RemoveDatabases() { - for (int i = 0 ; i < static_cast(application_list_.size()) ; i++) { - std::string appid = application_list_[i]; - try { - std::string security_origin_db_path - = application_map_[appid].getSecurityOriginDB(); - std::string security_origin_journal_db_path - = security_origin_db_path + kJournalPostfix; - std::string certificate_db_path - = application_map_[appid].getCertificateDB(); - std::string certificate_journal_db_path - = certificate_db_path + kJournalPostfix; - - RemoveFile(security_origin_db_path); - RemoveFile(security_origin_journal_db_path); - RemoveFile(certificate_db_path); - RemoveFile(certificate_journal_db_path); - } catch(...) { - } - } -} -std::string WrtUpgrade::CreateJsonObject(std::string appid) { - WrtUpgradeInfo info = application_map_[appid]; - - if (info.getPreferenceInfoSize() == 0 - && info.getSecurityOriginInfoSize() == 0 - && info.getCertificateInfoSize() == 0) { - return ""; - } - std::cout << "createJsonObject for " << appid << std::endl; - - // make preference value arr : vector - picojson::array preference_arr; - for (int i = 0 ; i < info.getPreferenceInfoSize() ; i++) { - PreferenceInfo p_info = info.getPreferenceInfo(i); - picojson::object obj; - obj["key"] = picojson::value(p_info.getKey()); - obj["value"] = picojson::value(p_info.getValue()); - preference_arr.push_back(picojson::value(obj)); - } - - // make security_origin value arr : vector - picojson::array securityorigin_arr; - for (int i = 0 ; i < info.getSecurityOriginInfoSize() ; i++) { - SecurityOriginInfo s_info = info.getSecurityOriginInfo(i); - picojson::object obj; - obj["section"] = picojson::value(s_info.getSection()); - obj["key"] = picojson::value(s_info.getKey()); - obj["value"] = picojson::value(s_info.getValue()); - securityorigin_arr.push_back(picojson::value(obj)); - } - - // make certificate value arr : vector - picojson::array certificate_arr; - for (int i = 0 ; i < info.getCertificateInfoSize() ; i++) { - CertificateInfo c_info = info.getCertificateInfo(i); - picojson::object obj; - obj["section"] = picojson::value(c_info.getSection()); - obj["key"] = picojson::value(c_info.getKey()); - obj["value"] = picojson::value(c_info.getValue()); - certificate_arr.push_back(picojson::value(obj)); - } - - // make one json - picojson::object migration_obj; - migration_obj["preference"] = picojson::value(preference_arr); - migration_obj["security_orgin"] = picojson::value(securityorigin_arr); - migration_obj["certificate"] = picojson::value(certificate_arr); - - picojson::value migration_val = picojson::value(migration_obj); - std::string json_str = migration_val.serialize(); - return json_str; -} -bool WrtUpgrade::RemoveFile(const std::string& path) { - if (!common::utils::Exists(path)) { - LOGGER(ERROR) << "File is not Exist : " << path; - return false; - } - return (remove(path.c_str()) == 0); -} -} // namespace upgrade -int main() { - std::cout << "Tizen database migration tool for Webruntime" << std::endl; - upgrade::WrtUpgrade mt; - mt.Run(); - return 0; -} diff --git a/wrt-upgrade/wrt-upgrade.gyp b/wrt-upgrade/wrt-upgrade.gyp deleted file mode 100755 index 55b48a6..0000000 --- a/wrt-upgrade/wrt-upgrade.gyp +++ /dev/null @@ -1,38 +0,0 @@ -{ - 'includes': [ - '../build/common.gypi', - ], - 'targets': [ - { - 'target_name': 'wrt-upgrade', - 'type': 'executable', - 'dependencies': [ - '../common/common.gyp:xwalk_tizen_common', - ], - 'sources': [ - 'wrt-upgrade.cc', - 'wrt-upgrade-info.cc', - ], - 'ldflags': [ - '-pie', - ], - 'variables': { - 'packages': [ - 'sqlite3', - 'dlog', - ], - }, - 'libraries' : [ - '-ldl', - ], - 'copies': [ - { - 'destination': '<(SHARED_INTERMEDIATE_DIR)', - 'files': [ - '720.wrt.upgrade.sh' - ], - }, - ], - }, # end of target 'wrt-upgrade' - ], # end of targets -} diff --git a/wrt-upgrade/wrt-upgrade.h b/wrt-upgrade/wrt-upgrade.h deleted file mode 100644 index 110cf46..0000000 --- a/wrt-upgrade/wrt-upgrade.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2013 Intel Corporation. All rights reserved. -// Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WRT_UPGRADE_H -#define WRT_UPGRADE_H -#include -#include -#include -#include - -#include "wrt-upgrade/wrt-upgrade-info.h" - -namespace upgrade { -class WrtUpgrade{ - public: - WrtUpgrade(); - ~WrtUpgrade(); - void Run(); - private: - void ParseWrtDatabse(); - void ParseSecurityOriginDatabase(); - void ParseCertificatenDatabase(); - void CreateMigrationFile(); - void RemoveDatabases(); - bool RemoveFile(const std::string& path); - void RedirectSymlink(); - std::string CreateJsonObject(std::string appid); - std::vector application_list_; - std::map application_map_; -}; -} // namespace upgrade -#endif // WRT_UPGRADE_H diff --git a/xwalk_tizen.gyp b/xwalk_tizen.gyp old mode 100644 new mode 100755 index 94dea57..4c6f3a9 --- a/xwalk_tizen.gyp +++ b/xwalk_tizen.gyp @@ -8,7 +8,6 @@ 'extensions/extensions.gyp:*', 'runtime/runtime.gyp:*', 'loader/loader.gyp:*', - 'wrt-upgrade/wrt-upgrade.gyp:*', ], }, # end of target 'xwalk_tizen' ], # end of targets -- 2.7.4 From ef9c335dc3bd7da0bc66135576e52915aa1d03b0 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Thu, 8 Mar 2018 15:07:23 +0900 Subject: [PATCH 16/16] Change deprecated internal api to public api - libdeviced haptic apis are deprecated - Changed to use capi-system-device apis Change-Id: I7c592774f379620aec1ddae9a60f43cb0694c6ef Signed-off-by: pr.jung --- packaging/crosswalk-tizen.spec | 2 +- runtime/browser/vibration_manager.cc | 12 ++++++------ runtime/runtime.gyp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index 945b02e..0c24483 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -31,7 +31,7 @@ BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-ui-efl-util) BuildRequires: pkgconfig(chromium-efl) >= 56.0.0, pkgconfig(chromium-efl) < 57.0.0 BuildRequires: pkgconfig(cynara-client) -BuildRequires: pkgconfig(deviced) +BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(efl-extension) diff --git a/runtime/browser/vibration_manager.cc b/runtime/browser/vibration_manager.cc index 0e6cfcd..301b20c 100755 --- a/runtime/browser/vibration_manager.cc +++ b/runtime/browser/vibration_manager.cc @@ -16,7 +16,7 @@ #include "runtime/browser/vibration_manager.h" -#include +#include #include "common/logger.h" @@ -42,7 +42,7 @@ VibrationImpl::VibrationImpl() VibrationImpl::~VibrationImpl() { if (handle_ != 0) { - haptic_close(handle_); + device_haptic_close(handle_); handle_ = 0; } } @@ -51,8 +51,8 @@ bool VibrationImpl::Initialize() { if (handle_ != 0) return true; - int ret = haptic_open(HAPTIC_DEVICE_0, &handle_); - if (ret != HAPTIC_ERROR_NONE) { + int ret = device_haptic_open(0, &handle_); + if (ret != DEVICE_ERROR_NONE) { LOGGER(ERROR) << "Fail to open haptic device"; handle_ = 0; return false; @@ -62,13 +62,13 @@ bool VibrationImpl::Initialize() { void VibrationImpl::Start(int ms) { if (Initialize()) { - haptic_vibrate_monotone(handle_, ms, NULL); + device_haptic_vibrate(handle_, ms, 100, NULL); } } void VibrationImpl::Stop() { if (Initialize()) { - haptic_stop_all_effects(handle_); + device_haptic_stop(handle_, NULL); } } diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index ce48619..5772a35 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -57,7 +57,7 @@ 'ecore', 'elementary', 'efl-extension', - 'deviced', + 'capi-system-device', 'manifest-parser', 'wgt-manifest-handlers', 'notification', -- 2.7.4