From c32ebaf7ea6c7b4e1593327e7b6bd3a156a32d10 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 22 Jun 2016 17:52:03 +0900 Subject: [PATCH 01/16] grant User label to wgt-backend Change-Id: I301c4e2c990a7c3aab377cf9435bb194d8d40868 Signed-off-by: jongmyeongko --- packaging/wgt-backend.manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wgt-backend.manifest b/packaging/wgt-backend.manifest index 85f79f1..18893ce 100644 --- a/packaging/wgt-backend.manifest +++ b/packaging/wgt-backend.manifest @@ -3,6 +3,6 @@ - + -- 2.7.4 From 6099c6684c9f61ffae80084671e6a023a41df03d Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Mon, 13 Jun 2016 16:06:10 +0200 Subject: [PATCH 02/16] Rename backup_paths.h to paths.h Submit together: - https://review.tizen.org/gerrit/74296 - https://review.tizen.org/gerrit/74297 - https://review.tizen.org/gerrit/74298 Change-Id: I9b679eebc05951df0e9c706c1495bf54a376fb9e --- src/unit_tests/smoke_test.cc | 2 +- src/wgt/step/configuration/step_parse.cc | 2 +- src/wgt/step/configuration/step_parse_recovery.cc | 2 +- src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc | 2 +- src/wgt/step/filesystem/step_wgt_update_package_directory.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 3ab430b..f150590 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 5e1a677..24c359b 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/wgt/step/configuration/step_parse_recovery.cc b/src/wgt/step/configuration/step_parse_recovery.cc index c01cb41..8ff406d 100644 --- a/src/wgt/step/configuration/step_parse_recovery.cc +++ b/src/wgt/step/configuration/step_parse_recovery.cc @@ -4,7 +4,7 @@ #include "wgt/step/configuration/step_parse_recovery.h" -#include +#include #include namespace { diff --git a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc index fc4907b..a4e1d6a 100644 --- a/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace bf = boost::filesystem; diff --git a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc index 0aadad5..17e07d9 100644 --- a/src/wgt/step/filesystem/step_wgt_update_package_directory.cc +++ b/src/wgt/step/filesystem/step_wgt_update_package_directory.cc @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace bf = boost::filesystem; -- 2.7.4 From 5a036ff4525f485ee44cbc53e05452508a9cbe15 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Tue, 21 Jun 2016 10:50:51 +0200 Subject: [PATCH 03/16] Refactoring StepParse Change-Id: Ib396f828909c4c114c82876b504c37bdb682a128 --- src/wgt/step/configuration/step_parse.cc | 134 +++++++++++++++---------------- src/wgt/step/configuration/step_parse.h | 11 ++- 2 files changed, 74 insertions(+), 71 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 24c359b..602df3f 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -82,6 +82,7 @@ void SetApplicationXDefaults(application_x* application) { application->submode = strdup("false"); application->support_disable = strdup("false"); application->ui_gadget = strdup("false"); + application->multiple = strdup("false"); } template @@ -94,7 +95,6 @@ void AppendLabel(T* root, const std::string& label, strdup(locale.c_str()) : strdup(DEFAULT_LOCALE); root->label = g_list_append(root->label, label_item); } - } // namespace namespace wgt { @@ -146,16 +146,16 @@ bool StepParse::FillInstallationInfo(manifest_x* manifest) { } bool StepParse::FillIconPaths(manifest_x* manifest) { - std::shared_ptr app_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenApplicationKey)); + auto app_info = + GetManifestDataForKey( + app_keys::kTizenApplicationKey); if (!app_info) { LOG(ERROR) << "Application info manifest data has not been found."; return false; } - std::shared_ptr icons_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kIconsKey)); + auto icons_info = + GetManifestDataForKey( + app_keys::kIconsKey); if (icons_info.get()) { for (auto& application_icon : icons_info->icons()) { icon_x* icon = reinterpret_cast (calloc(1, sizeof(icon_x))); @@ -170,9 +170,10 @@ bool StepParse::FillIconPaths(manifest_x* manifest) { } bool StepParse::FillWidgetInfo(manifest_x* manifest) { - std::shared_ptr wgt_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kWidgetKey)); + auto wgt_info = + GetManifestDataForKey( + app_keys::kWidgetKey); + if (!wgt_info.get()) { LOG(ERROR) << "Widget info manifest data has not been found."; return false; @@ -203,9 +204,9 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { manifest->installed_storage = strdup("installed_internal"); // For wgt package use the long name + application_x* app = + reinterpret_cast(manifest->application->data); for (auto& item : wgt_info->name_set()) { - application_x* app = - reinterpret_cast(manifest->application->data); AppendLabel(app, item.second, item.first); } @@ -219,10 +220,9 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { author->lang = strdup(DEFAULT_LOCALE); manifest->author = g_list_append(manifest->author, author); - std::shared_ptr settings_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenSettingKey)); + auto settings_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenSettingKey); if (settings_info) { switch (settings_info->install_location()) { case wgt::parse::SettingInfo::InstallLocation::AUTO: { @@ -246,18 +246,19 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { } bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { - std::shared_ptr app_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenApplicationKey)); + auto app_info = + GetManifestDataForKey( + app_keys::kTizenApplicationKey); if (!app_info) { LOG(ERROR) << "Application info manifest data has not been found."; return false; } bool has_watch_catergory = false; bool has_ime = false; - std::shared_ptr category_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenCategoryKey)); + auto category_info = + GetManifestDataForKey( + app_keys::kTizenCategoryKey); + if (category_info) { has_watch_catergory = std::find_if(category_info->categories.begin(), category_info->categories.end(), @@ -277,7 +278,6 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { application->component_type = has_watch_catergory ? strdup("watchapp") : strdup("uiapp"); application->mainapp = strdup("true"); - application->multiple = strdup("false"); application->appid = strdup(app_info->id().c_str()); application->nodisplay = has_ime ? strdup("true") : strdup("false"); application->taskmanage = has_ime ? strdup("false") : strdup("true"); @@ -304,7 +304,8 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { app_icon->lang = strdup(icon->lang); application->icon = g_list_append(application->icon, app_icon); } - manifest->application = g_list_append(manifest->application, application); + // guarantees that the main app will be at the begining of the list + manifest->application = g_list_insert(manifest->application, application, 0); manifest->package = strdup(app_info->package().c_str()); manifest->mainapp_id = strdup(app_info->id().c_str()); @@ -312,9 +313,9 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { } bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { - std::shared_ptr service_list = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenServiceKey)); + auto service_list = + GetManifestDataForKey( + app_keys::kTizenServiceKey); if (!service_list) return true; for (auto& service_info : service_list->services) { @@ -322,7 +323,6 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { (calloc(1, sizeof(application_x))); application->component_type = strdup("svcapp"); application->mainapp = strdup("false"); - application->multiple = strdup("false"); application->appid = strdup(service_info.id().c_str()); application->exec = strdup((context_->root_application_path.get() / manifest->package @@ -373,10 +373,9 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { } bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { - std::shared_ptr appwidget_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenAppWidgetFullKey)); + auto appwidget_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenAppWidgetFullKey); if (!appwidget_info) return true; for (auto& app_widget : appwidget_info->app_widgets()) { @@ -384,7 +383,6 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { (calloc(1, sizeof(application_x))); application->component_type = strdup("widgetapp"); application->mainapp = strdup("false"); - application->multiple = strdup("false"); application->appid = strdup(app_widget.id.c_str()); application->exec = strdup((context_->root_application_path.get() / manifest->package @@ -439,9 +437,9 @@ bool StepParse::FillBackgroundCategoryInfo(manifest_x* manifest) { } bool StepParse::FillAppControl(manifest_x* manifest) { - std::shared_ptr app_info_list = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenApplicationAppControlsKey)); + auto app_info_list = + GetManifestDataForKey( + app_keys::kTizenApplicationAppControlsKey); application_x* app = reinterpret_cast(manifest->application->data); @@ -459,9 +457,9 @@ bool StepParse::FillAppControl(manifest_x* manifest) { } bool StepParse::FillPrivileges(manifest_x* manifest) { - std::shared_ptr perm_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenPermissionsKey)); + auto perm_info = + GetManifestDataForKey( + app_keys::kTizenPermissionsKey); std::set privileges; if (perm_info) privileges = ExtractPrivileges(perm_info); @@ -474,9 +472,9 @@ bool StepParse::FillPrivileges(manifest_x* manifest) { } bool StepParse::FillCategories(manifest_x* manifest) { - std::shared_ptr category_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenCategoryKey)); + auto category_info = + GetManifestDataForKey( + app_keys::kTizenCategoryKey); if (!category_info) return true; @@ -490,9 +488,9 @@ bool StepParse::FillCategories(manifest_x* manifest) { } bool StepParse::FillMetadata(manifest_x* manifest) { - std::shared_ptr meta_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenMetaDataKey)); + auto meta_info = + GetManifestDataForKey( + app_keys::kTizenMetaDataKey); if (!meta_info) return true; @@ -507,19 +505,18 @@ bool StepParse::FillAppWidget() { WgtBackendData* backend_data = static_cast(context_->backend_data.get()); - std::shared_ptr appwidget_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenAppWidgetFullKey)); + auto appwidget_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenAppWidgetFullKey); if (appwidget_info) backend_data->appwidgets.set(*appwidget_info); return true; } bool StepParse::FillAccounts(manifest_x* manifest) { - std::shared_ptr account_info = - std::static_pointer_cast( - parser_->GetManifestData(app_keys::kAccountKey)); + auto account_info = + GetManifestDataForKey( + app_keys::kAccountKey); if (!account_info) return true; common_installer::AccountInfo info; @@ -538,8 +535,9 @@ bool StepParse::FillAccounts(manifest_x* manifest) { } bool StepParse::FillImeInfo() { - const auto ime_info = std::static_pointer_cast( - parser_->GetManifestData(app_keys::kTizenImeKey)); + auto ime_info = + GetManifestDataForKey( + app_keys::kAccountKey); if (!ime_info) return true; @@ -645,14 +643,12 @@ common_installer::Step::Status StepParse::process() { } // Copy data from ManifestData to InstallerContext - std::shared_ptr info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenApplicationKey)); - std::shared_ptr wgt_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenWidgetKey)); + auto info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenApplicationKey); + auto wgt_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenWidgetKey); std::string name; const auto& name_set = wgt_info->name_set(); @@ -681,10 +677,9 @@ common_installer::Step::Status StepParse::process() { context_->recovery_info.get().recovery_file->WriteAndCommitFileContent(); } - std::shared_ptr perm_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenPermissionsKey)); + auto perm_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenPermissionsKey); parser::PermissionSet permissions; if (perm_info) permissions = perm_info->GetAPIPermissions(); @@ -692,10 +687,9 @@ common_installer::Step::Status StepParse::process() { WgtBackendData* backend_data = static_cast(context_->backend_data.get()); - std::shared_ptr settings_info = - std::static_pointer_cast( - parser_->GetManifestData( - wgt::application_widget_keys::kTizenSettingKey)); + auto settings_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenSettingKey); if (settings_info) backend_data->settings.set(*settings_info); diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index e7b9357..69015fc 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -1,7 +1,6 @@ // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved // Use of this source code is governed by a apache 2.0 license that can be // found in the LICENSE file. - #ifndef WGT_STEP_CONFIGURATION_STEP_PARSE_H_ #define WGT_STEP_CONFIGURATION_STEP_PARSE_H_ @@ -15,6 +14,8 @@ #include #include +#include +#include #include #include #include @@ -75,6 +76,14 @@ class StepParse : public common_installer::Step { ConfigLocation config_location_; bool check_start_file_; + template + std::shared_ptr GetManifestDataForKey(const std::string& key) { + assert(!key.empty()); + static_assert(std::is_base_of::value, + "Type is not base of parser::ManifestData"); + return std::static_pointer_cast(parser_->GetManifestData(key)); + } + STEP_NAME(Parse) }; -- 2.7.4 From da54fd639e7284dd641e5a67579ca2836ade0591 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Wed, 22 Jun 2016 09:51:31 +0200 Subject: [PATCH 04/16] Fix for update-period Change-Id: Ic8adec0d7bd7aa14a3b5e054aaed67d5cb1d849c --- src/wgt/step/pkgmgr/step_generate_xml.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 1148642..1173a85 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -108,7 +108,11 @@ bool WriteWidgetApplicationAttributesAndElements( xmlTextWriterWriteAttribute(writer, BAD_CAST "main", BAD_CAST (appwidget->primary ? "true" : "false")); // NOLINT - xmlTextWriterWriteAttribute(writer, BAD_CAST "update-period", BAD_CAST "0"); + if (!appwidget->update_period.empty()) { + xmlTextWriterWriteAttribute(writer, BAD_CAST "update-period", BAD_CAST + std::to_string(static_cast( + appwidget->update_period.front())).c_str()); + } for (auto& size : appwidget->content_size) { xmlTextWriterStartElement(writer, BAD_CAST "support-size"); @@ -297,7 +301,8 @@ common_installer::Step::Status StepGenerateXml::precheck() { } if (context_->pkgid.get().empty()) { LOG(ERROR) << "pkgid attribute is empty"; - return Step::Status::PACKAGE_NOT_FOUND; } + return Step::Status::PACKAGE_NOT_FOUND; + } if (!context_->manifest_data.get()->application) { LOG(ERROR) << "No application in package"; -- 2.7.4 From 6bbd3f9ddc27487d54bc2441d8cfba9d8bef2345 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 16 Jun 2016 14:57:58 +0200 Subject: [PATCH 05/16] Split API in pkgmgr_registration.h Submit together: - https://review.tizen.org/gerrit/75107 - https://review.tizen.org/gerrit/75108 - https://review.tizen.org/gerrit/75109 Change-Id: I259d3aac621443e7985fc2d5aa87e99d5a7bd959 --- src/unit_tests/smoke_test.cc | 6 +++--- src/wgt/wgt_app_query_interface.cc | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index f150590..56dfb15 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -217,13 +217,13 @@ void PackageCheckCleanup(const std::string& pkgid, void ValidatePackage(const std::string& pkgid, const std::vector& appids) { - ASSERT_TRUE(ci::IsPackageInstalled(pkgid, ci::GetRequestMode())); + ASSERT_TRUE(ci::QueryIsPackageInstalled(pkgid, ci::GetRequestMode())); ValidatePackageFS(pkgid, appids); } void CheckPackageNonExistance(const std::string& pkgid, const std::vector& appids) { - ASSERT_FALSE(ci::IsPackageInstalled(pkgid, ci::GetRequestMode())); + ASSERT_FALSE(ci::QueryIsPackageInstalled(pkgid, ci::GetRequestMode())); PackageCheckCleanup(pkgid, appids); } diff --git a/src/wgt/wgt_app_query_interface.cc b/src/wgt/wgt_app_query_interface.cc index e4245cc..912c861 100644 --- a/src/wgt/wgt_app_query_interface.cc +++ b/src/wgt/wgt_app_query_interface.cc @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -107,21 +107,21 @@ bool WgtAppQueryInterface::IsAppInstalledByArgv(int argc, char** argv) { return false; // argument from commandline is package id - if (ci::IsPackageInstalled(arg, ci::GetRequestMode())) + if (ci::QueryIsPackageInstalled(arg, ci::GetRequestMode())) return true; // argument from commandline is path to file std::string pkg_id = GetPkgIdFromPath(arg); if (pkg_id.empty()) return false; - return ci::IsPackageInstalled(pkg_id, ci::GetRequestMode()); + return ci::QueryIsPackageInstalled(pkg_id, ci::GetRequestMode()); } bool WgtAppQueryInterface::IsHybridApplication(int argc, char** argv) { std::string arg = GetInstallationRequestInfo(argc, argv); if (arg.find("apps_rw/recovery-") != std::string::npos) arg = ReadPkgidFromRecovery(arg); - if (ci::IsPackageInstalled(arg, ci::GetRequestMode())) { + if (ci::QueryIsPackageInstalled(arg, ci::GetRequestMode())) { bf::path package_directory(ci::GetRootAppPath(false)); if (bf::exists(package_directory / arg / kTizenManifestLocation) && bf::exists(package_directory / arg / kHybridConfigLocation)) -- 2.7.4 From 70f676c0d426d55dc0dc7201f83e7c4e9aac1c06 Mon Sep 17 00:00:00 2001 From: Arkadiusz Szulakiewicz Date: Wed, 22 Jun 2016 14:29:06 +0200 Subject: [PATCH 06/16] Add 'multiple-accounts-support' attribute for false values Change-Id: I16f212ec25689115c890f5688cdd7f8657cbebda --- src/wgt/step/pkgmgr/step_generate_xml.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 1173a85..8e92818 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -504,6 +504,10 @@ void StepGenerateXml::GenerateAccount(xmlTextWriterPtr writer) { xmlTextWriterWriteAttribute(writer, BAD_CAST "multiple-accounts-support", BAD_CAST "true"); + else + xmlTextWriterWriteAttribute(writer, + BAD_CAST "multiple-accounts-support", + BAD_CAST "false"); for (auto& icon_pair : account.icon_paths) { xmlTextWriterStartElement(writer, BAD_CAST "icon"); if (icon_pair.first == "AccountSmall") -- 2.7.4 From a90c5e7a6e9bd7302109e7e91f0d44b6ce67cc96 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Mon, 27 Jun 2016 13:26:44 +0900 Subject: [PATCH 07/16] Modify nodisplay value of widget-application Change-Id: I1cc298f5761d9bdd0b446a7cc06a937244f83187 --- src/wgt/step/configuration/step_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 602df3f..df06790 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -388,7 +388,7 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { strdup((context_->root_application_path.get() / manifest->package / "bin" / application->appid).c_str()); application->type = strdup("webapp"); - application->nodisplay = strdup("false"); + application->nodisplay = strdup("true"); application->taskmanage = strdup("false"); SetApplicationXDefaults(application); application->ambient_support = strdup("false"); -- 2.7.4 From f3af9bd52c8664b63d301a4c62e1d45e5bd3d063 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Tue, 28 Jun 2016 12:52:34 +0200 Subject: [PATCH 08/16] [Refactor] check-coding-style Change-Id: If44523674d80b403d32af34848230f53a2620d0b --- src/wgt/step/pkgmgr/step_generate_xml.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wgt/step/pkgmgr/step_generate_xml.cc b/src/wgt/step/pkgmgr/step_generate_xml.cc index 8e92818..dffb4c8 100644 --- a/src/wgt/step/pkgmgr/step_generate_xml.cc +++ b/src/wgt/step/pkgmgr/step_generate_xml.cc @@ -119,7 +119,8 @@ bool WriteWidgetApplicationAttributesAndElements( std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type); if (!size.preview.empty()) { - std::string icon_name = shared_path.string() + "/" + appwidget->id + "." + type + "." + "preview" + + std::string icon_name = shared_path.string() + "/" + + appwidget->id + "." + type + "." + "preview" + bf::path(size.preview).extension().string(); xmlTextWriterWriteAttribute(writer, BAD_CAST "preview", BAD_CAST icon_name.c_str()); // NOLINT -- 2.7.4 From 5957350d379b2307e5b2d33ce2ce90137fe536a0 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Fri, 1 Jul 2016 11:01:36 +0200 Subject: [PATCH 09/16] Check if widget's shared/res/ entry is directory Installation will succeed if shared/res entry is not directory. Change-Id: I06e2b3934dd1342ad7ae98fd681a4b2a21d13885 --- src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc b/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc index 3c5d9e9..fbb8519 100644 --- a/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc +++ b/src/wgt/step/filesystem/step_wgt_patch_storage_directories.cc @@ -52,6 +52,10 @@ bool StepWgtPatchStorageDirectories::ShareDirFor3x() { bf::path src = context_->pkg_path.get() / kResWgtSubPath / kSharedResLocation; if (!bf::exists(src)) return true; + if (!bf::is_directory(src)) { + LOG(WARNING) << "Widget's shared/res/ is not directory"; + return true; + } bf::path dst = context_->pkg_path.get() / kSharedResLocation; if (!common_installer::MoveDir(src, dst, common_installer::FS_MERGE_DIRECTORIES)) { -- 2.7.4 From 5f8f5211a72c991d466192146ce0bbfba45ef22c Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Tue, 5 Jul 2016 14:29:55 +0900 Subject: [PATCH 10/16] Fixed app_keys name.(kAccountKey -> kTizenImeKey) Change-Id: Ifba625f6d0513499fed01360f63cacfc64b9d86d --- src/wgt/step/configuration/step_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index df06790..0295903 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -537,7 +537,7 @@ bool StepParse::FillAccounts(manifest_x* manifest) { bool StepParse::FillImeInfo() { auto ime_info = GetManifestDataForKey( - app_keys::kAccountKey); + app_keys::kTizenImeKey); if (!ime_info) return true; -- 2.7.4 From 3014326fcc25ea087930aa64b855dbfb9eabf785 Mon Sep 17 00:00:00 2001 From: Inhwan Lee Date: Thu, 16 Jun 2016 19:14:55 +0900 Subject: [PATCH 11/16] implement step for use user extension Change-Id: Ie5442f543f6e4dc3dbf78685716db2b113c021d0 --- src/wgt/CMakeLists.txt | 2 + src/wgt/extension_config_parser.cc | 190 +++++++++++++++++++++ src/wgt/extension_config_parser.h | 36 ++++ .../security/step_check_extension_privileges.cc | 132 ++++++++++++++ .../security/step_check_extension_privileges.h | 55 ++++++ src/wgt/wgt_installer.cc | 7 + 6 files changed, 422 insertions(+) mode change 100644 => 100755 src/wgt/CMakeLists.txt create mode 100755 src/wgt/extension_config_parser.cc create mode 100755 src/wgt/extension_config_parser.h create mode 100755 src/wgt/step/security/step_check_extension_privileges.cc create mode 100755 src/wgt/step/security/step_check_extension_privileges.h mode change 100644 => 100755 src/wgt/wgt_installer.cc diff --git a/src/wgt/CMakeLists.txt b/src/wgt/CMakeLists.txt old mode 100644 new mode 100755 index f45acc5..2e70267 --- a/src/wgt/CMakeLists.txt +++ b/src/wgt/CMakeLists.txt @@ -18,8 +18,10 @@ SET(SRCS step/security/step_check_wgt_notification_category.cc step/security/step_check_wgt_ime_privilege.cc step/security/step_direct_manifest_check_signature.cc + step/security/step_check_extension_privileges.cc wgt_app_query_interface.cc wgt_installer.cc + extension_config_parser.cc ) IF(WRT_LAUNCHER) diff --git a/src/wgt/extension_config_parser.cc b/src/wgt/extension_config_parser.cc new file mode 100755 index 0000000..4813d72 --- /dev/null +++ b/src/wgt/extension_config_parser.cc @@ -0,0 +1,190 @@ +// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by a apache 2.0 license that can be +// found in the LICENSE file. + +#include "wgt/extension_config_parser.h" +#include +#include + +#include +#include + +namespace wgt { + +namespace { +const xmlChar kExtensionNodeKey[] = "extension"; +const xmlChar kNamePrivilegeKey[] = "privilege"; +const xmlChar kPrivigeNameAttributeKey[] = "name"; +const char kAttributePrefix[] = "@"; +const xmlChar kDirAttributeKey[] = "dir"; +const char kXmlTextKey[] = "#text"; +const char kNamespaceKey[] = "@namespace"; +const char kExtensionPath[] = "extension.privilege"; +const char kExtensionNameKey[] = "@name"; +} // namespace + +ExtensionConfigParser::ExtensionConfigParser(std::string config_xml) { + config_xml_ = config_xml; +} + +std::unique_ptr + ExtensionConfigParser::LoadExtensionConfig(const std::string& config_xml) { + xmlDoc *doc = nullptr; + xmlNode* root_node = nullptr; + doc = xmlReadFile(config_xml.c_str(), nullptr, XML_PARSE_NOENT); + if (!doc) { + LOG(ERROR) << "Failed to read xml document model from" << config_xml; + return nullptr; + } + root_node = xmlDocGetRootElement(doc); + std::unique_ptr dv = LoadXMLNode(root_node); + std::unique_ptr result(new parser::DictionaryValue); + if (dv) + result->Set(reinterpret_cast(root_node->name), dv.release()); + return result; +} + +std::string ExtensionConfigParser::GetNodeDir( + xmlNode* node, const std::string& inherit_dir) { + std::string dir(inherit_dir); + for (xmlAttr* prop = node->properties; prop; prop = prop->next) { + if (xmlStrEqual(prop->name, kDirAttributeKey)) { + char* prop_value = reinterpret_cast(xmlNodeListGetString( + node->doc, prop->children, 1)); + dir = prop_value; + xmlFree(prop_value); + break; + } + } + return dir; +} +std::string ExtensionConfigParser::GetNodeText( + xmlNode* root, const std::string& inherit_dir) { + if (root->type != XML_ELEMENT_NODE) + return std::string(); + std::string current_dir(GetNodeDir(root, inherit_dir)); + std::string text; + if (!current_dir.empty()) + text += parser::utils::GetDirUTF8Start(current_dir); + for (xmlNode* node = root->children; node; node = node->next) { + if (node->type == XML_TEXT_NODE || node->type == XML_CDATA_SECTION_NODE) + text = text + std::string(reinterpret_cast(node->content)); + else + text += GetNodeText(node, current_dir); + } + if (!current_dir.empty()) + text += parser::utils::GetDirUTF8End(); + return text; +} +bool ExtensionConfigParser::IsPropSupportDir(xmlNode* root, xmlAttr* prop) { + if (xmlStrEqual(root->name, kNamePrivilegeKey) + && xmlStrEqual(prop->name, kPrivigeNameAttributeKey)) { + return true; + } + return false; +} +bool ExtensionConfigParser::IsTrimRequiredForElement(xmlNode* root) { + if (xmlStrEqual(root->name, kNamePrivilegeKey)) { + return true; + } + return false; +} +bool ExtensionConfigParser::IsTrimRequiredForProp( + xmlNode* root, xmlAttr* prop) { + if (xmlStrEqual(root->name, kNamePrivilegeKey) && + xmlStrEqual(prop->name, kPrivigeNameAttributeKey)) { + return true; + } + return false; +} +std::unique_ptr + ExtensionConfigParser::LoadXMLNode( + xmlNode* root, const std::string& inherit_dir) { + std::unique_ptr value(new parser::DictionaryValue()); + if (root->type != XML_ELEMENT_NODE) + return nullptr; + + std::string current_dir(GetNodeDir(root, inherit_dir)); + + xmlAttr* prop = nullptr; + for (prop = root->properties; prop; prop = prop->next) { + xmlChar* value_ptr = xmlNodeListGetString(root->doc, prop->children, 1); + std::string prop_value(reinterpret_cast(value_ptr)); + xmlFree(value_ptr); + if (IsPropSupportDir(root, prop)) + prop_value = parser::utils::GetDirTextUTF8(prop_value, current_dir); + + if (IsTrimRequiredForProp(root, prop)) + prop_value = parser::utils::CollapseWhitespaceUTF8(prop_value); + + value->SetString( + std::string(kAttributePrefix) + + reinterpret_cast(prop->name), + prop_value); + } + + if (root->ns) + value->SetString(kNamespaceKey, + reinterpret_cast(root->ns->href)); + + for (xmlNode* node = root->children; node; node = node->next) { + std::string sub_node_name(reinterpret_cast(node->name)); + std::unique_ptr sub_value = + LoadXMLNode(node, current_dir); + + if (!sub_value) { + continue; + } + if (!value->HasKey(sub_node_name)) { + value->Set(sub_node_name, sub_value.release()); + continue; + } + + parser::Value* temp; + value->Get(sub_node_name, &temp); + + if (temp->IsType(parser::Value::TYPE_LIST)) { + parser::ListValue* list; + temp->GetAsList(&list); + list->Append(sub_value.release()); + } else { + assert(temp->IsType(parser::Value::TYPE_DICTIONARY)); + parser::DictionaryValue* dict; + temp->GetAsDictionary(&dict); + parser::DictionaryValue* prev_value = dict->DeepCopy(); + + parser::ListValue* list = new parser::ListValue(); + list->Append(prev_value); + list->Append(sub_value.release()); + value->Set(sub_node_name, list); + } + } + + std::string text; + xmlChar* text_ptr = xmlNodeListGetString(root->doc, root->children, 1); + if (text_ptr) { + text = reinterpret_cast(text_ptr); + xmlFree(text_ptr); + } + if (IsTrimRequiredForElement(root)) + text = parser::utils::CollapseWhitespaceUTF8(text); + if (!text.empty()) + value->SetString(kXmlTextKey, text); + + return value; +} +std::vector ExtensionConfigParser::GetExtensionPrivilegeList() { + std::unique_ptr dic + = LoadExtensionConfig(config_xml_); + std::vector privilege_list; + + for (auto& item : parser::GetOneOrMany(dic.get(), kExtensionPath, "")) { + std::string privilege; + if (item->GetString(kExtensionNameKey, &privilege)) { + LOG(DEBUG) << "User defined extra privilege: " << privilege; + privilege_list.push_back(privilege); + } + } + return privilege_list; +} +} // namespace wgt diff --git a/src/wgt/extension_config_parser.h b/src/wgt/extension_config_parser.h new file mode 100755 index 0000000..c5cd454 --- /dev/null +++ b/src/wgt/extension_config_parser.h @@ -0,0 +1,36 @@ +// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by a apache 2.0 license that can be +// found in the LICENSE file. + +#ifndef WGT_EXTENSION_CONFIG_PARSER_H_ +#define WGT_EXTENSION_CONFIG_PARSER_H_ + +#include +#include +#include +#include + +#include +#include +#include + +namespace wgt { +class ExtensionConfigParser { + public: + explicit ExtensionConfigParser(std::string config_xml); + std::vector GetExtensionPrivilegeList(); + private: + std::unique_ptr LoadExtensionConfig( + const std::string& config_xml); + std::string GetNodeDir(xmlNode* node, const std::string& inherit_dir); + std::string GetNodeText(xmlNode* root, const std::string& inherit_dir); + bool IsPropSupportDir(xmlNode* root, xmlAttr* prop); + bool IsTrimRequiredForElement(xmlNode* root); + bool IsTrimRequiredForProp(xmlNode* root, xmlAttr* prop); + std::unique_ptr LoadXMLNode( + xmlNode* root, const std::string& inherit_dir = ""); + std::string config_xml_; +}; +} // namespace wgt + +#endif // WGT_EXTENSION_CONFIG_PARSER_H_ diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc new file mode 100755 index 0000000..f75c832 --- /dev/null +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -0,0 +1,132 @@ +// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by a apache 2.0 license that can be +// found in the LICENSE file. + +#include "wgt/step/security/step_check_extension_privileges.h" +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "wgt/extension_config_parser.h" +#include "manifest_parser/values.h" +#include "common/certificate_validation.h" +#include "common/utils/glist_range.h" + +namespace { +const char kPluginsDirectory[] = "/res/wgt/plugin/"; +const char kArchArmv7l[] = "armv7l"; +const char kArchI586[] = "i586"; +const char kArchDefault[] = "default"; +} + +namespace wgt { +namespace security { + +common_installer::Step::Status StepCheckExtensionPrivileges::precheck() { + if (!context_->manifest_data.get()) { + LOG(ERROR) << "Manifest data is not set"; + return Status::ERROR; + } + return Status::OK; +} +common_installer::Step::Status StepCheckExtensionPrivileges::process() { + std::string app_ext_config_pattern(GetExtensionPath()); + + manifest_x* m = context_->manifest_data.get(); + std::set current_privileges; + for (const char* priv : GListRange(m->privileges)) { + current_privileges.insert(priv); + } + + std::set xmlFiles; + { + glob_t glob_result; + glob(app_ext_config_pattern.c_str(), GLOB_TILDE, NULL, &glob_result); + for (unsigned int i = 0; i < glob_result.gl_pathc; ++i) { + xmlFiles.insert(glob_result.gl_pathv[i]); + } + } + std::set privileges; + for (auto it = xmlFiles.begin(); it != xmlFiles.end(); ++it) { + LOG(DEBUG) << "start to parse extension xml : " << *it; + ExtensionConfigParser extensionParser(*it); + std::vector list = extensionParser.GetExtensionPrivilegeList(); + for (int i = 0 ; i < list.size() ; i++) { + if (current_privileges.find(list[i]) == current_privileges.end()) { + privileges.insert(list[i]); + } + } + } + + if (!privileges.empty()) { + if (!CheckPriviligeLevel(privileges)) { + LOG(DEBUG) << "Fail to validation of privilege"; + return Status::ERROR; + } + for (auto it = privileges.begin(); it != privileges.end(); ++it) { + LOG(DEBUG) << "set list privilege : " << *it; + m->privileges = g_list_append(m->privileges, strdup((*it).c_str())); + } + } + return Status::OK; +} + +std::string StepCheckExtensionPrivileges::GetExtensionPath() { + std::string app_ext_config_pattern(context_->pkg_path.get().string()); + app_ext_config_pattern.append(kPluginsDirectory); + struct utsname u; + if (0 == uname(&u)) { + std::string machine = u.machine; + LOG(DEBUG) << "Machine archicture for user defined plugins: " << machine; + if (!machine.empty()) { + if (machine == kArchArmv7l) { + app_ext_config_pattern.append(kArchArmv7l); + } else if (machine == kArchI586) { + app_ext_config_pattern.append(kArchI586); + } else { + app_ext_config_pattern.append(kArchDefault); + } + } else { + LOG(ERROR) << "cannot get machine info"; + app_ext_config_pattern.append(kArchDefault); + } + app_ext_config_pattern.append("/"); + } + app_ext_config_pattern.append("*"); + app_ext_config_pattern.append(".xml"); + return app_ext_config_pattern; +} + +bool StepCheckExtensionPrivileges::CheckPriviligeLevel( + std::set priv_set) { + GList* privileges = nullptr; + for (auto it = priv_set.begin(); it != priv_set.end(); ++it) { + privileges = g_list_append(privileges, strdup((*it).c_str())); + } + guint size = g_list_length(privileges); + if (size == 0) return true; + + std::string error_message; + if (!common_installer::ValidatePrivilegeLevel( + context_->privilege_level.get(), + false, + context_->manifest_data.get()->api_version, + privileges, + &error_message)) { + if (!error_message.empty()) { + LOG(ERROR) << "error_message: " << error_message; + return false; + } + return false; + } + return true; +} + +} // namespace security +} // namespace wgt diff --git a/src/wgt/step/security/step_check_extension_privileges.h b/src/wgt/step/security/step_check_extension_privileges.h new file mode 100755 index 0000000..0c27abc --- /dev/null +++ b/src/wgt/step/security/step_check_extension_privileges.h @@ -0,0 +1,55 @@ +// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by a apache 2.0 license that can be +// found in the LICENSE file. +// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +// Use of this source code is governed by a apache 2.0 license that can be +// found in the LICENSE file. + +#ifndef WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_ +#define WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_ + +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace wgt { +namespace security { + +/** + * \brief Step that add user extension privileges during installation + */ +class StepCheckExtensionPrivileges : public common_installer::Step { + public: + using Step::Step; + + /** + * \Adds extra package privileges defined by extension manifest. + * + * \return Status::OK + */ + Status process() override; + Status clean() override { return Status::OK; } + Status undo() override { return Status::OK; } + /** + * \brief Check requirements for this step + * + * \return Status::ERROR when rmanifest data are missing, + * Status::OK otherwise + */ + Status precheck() override; + private: + std::string GetExtensionPath(); + bool CheckPriviligeLevel(std::set priv_set); + STEP_NAME(CheckExtensionPrivileges) +}; + +} // namespace security +} // namespace wgt + +#endif // WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_ diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc old mode 100644 new mode 100755 index 7abd4e2..ee5f62c --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -82,6 +82,7 @@ #include "wgt/step/security/step_check_wgt_notification_category.h" #include "wgt/step/security/step_check_wgt_ime_privilege.h" #include "wgt/step/security/step_direct_manifest_check_signature.h" +#include "wgt/step/security/step_check_extension_privileges.h" namespace ci = common_installer; @@ -118,6 +119,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep( @@ -157,6 +159,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep( @@ -202,6 +205,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); break; } @@ -241,6 +245,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep( @@ -301,6 +306,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep( ci::Plugin::ActionType::Install); AddStep(); + AddStep(); AddStep(); break; } @@ -332,6 +338,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep( -- 2.7.4 From 8bdf473ae221b4ee3862fb6101b540fc9bdaf809 Mon Sep 17 00:00:00 2001 From: Piotr Ganicz Date: Mon, 11 Jul 2016 08:56:15 +0200 Subject: [PATCH 12/16] Fix memory leak in CheckPrivilegeLevel This patch fixes also typo in the function name. Change-Id: If118e0fd8d220e0d5dbb65a88b3a8f55a8cd343b --- src/wgt/step/security/step_check_extension_privileges.cc | 7 ++++--- src/wgt/step/security/step_check_extension_privileges.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc index f75c832..d2de923 100755 --- a/src/wgt/step/security/step_check_extension_privileges.cc +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -65,7 +65,7 @@ common_installer::Step::Status StepCheckExtensionPrivileges::process() { } if (!privileges.empty()) { - if (!CheckPriviligeLevel(privileges)) { + if (!CheckPrivilegeLevel(privileges)) { LOG(DEBUG) << "Fail to validation of privilege"; return Status::ERROR; } @@ -103,7 +103,7 @@ std::string StepCheckExtensionPrivileges::GetExtensionPath() { return app_ext_config_pattern; } -bool StepCheckExtensionPrivileges::CheckPriviligeLevel( +bool StepCheckExtensionPrivileges::CheckPrivilegeLevel( std::set priv_set) { GList* privileges = nullptr; for (auto it = priv_set.begin(); it != priv_set.end(); ++it) { @@ -119,12 +119,13 @@ bool StepCheckExtensionPrivileges::CheckPriviligeLevel( context_->manifest_data.get()->api_version, privileges, &error_message)) { + g_list_free_full(privileges, free); if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; - return false; } return false; } + g_list_free_full(privileges, free); return true; } diff --git a/src/wgt/step/security/step_check_extension_privileges.h b/src/wgt/step/security/step_check_extension_privileges.h index 0c27abc..837f564 100755 --- a/src/wgt/step/security/step_check_extension_privileges.h +++ b/src/wgt/step/security/step_check_extension_privileges.h @@ -45,7 +45,7 @@ class StepCheckExtensionPrivileges : public common_installer::Step { Status precheck() override; private: std::string GetExtensionPath(); - bool CheckPriviligeLevel(std::set priv_set); + bool CheckPrivilegeLevel(std::set priv_set); STEP_NAME(CheckExtensionPrivileges) }; -- 2.7.4 From eaf194e5b44c0d34cffce08b94307e97581c9100 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Tue, 12 Jul 2016 11:46:04 +0200 Subject: [PATCH 13/16] Implement pkg enable/disable Requires: - https://review.tizen.org/gerrit/78919 Change-Id: Ic5c001fe2b91e81d35a66891f17cfafb2de3f9a1 --- src/hybrid/hybrid_installer.cc | 23 +++++++++++++++++++++++ src/wgt/wgt_installer.cc | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 9b8be50..763d420 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -387,6 +388,28 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( ci::Plugin::ActionType::Upgrade); break; + case ci::RequestType::EnablePkg: + AddStep(pkgmgr_); + AddStep( + ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, + ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep(); + AddStep( + ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable); + AddStep( + ci::Plugin::ActionType::Uninstall); + break; + case ci::RequestType::DisablePkg: + AddStep(pkgmgr_); + AddStep( + ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, + ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep(); + AddStep( + ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable); + AddStep( + ci::Plugin::ActionType::Uninstall); + break; default: AddStep(); break; diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index ee5f62c..d1dc7e9 100755 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -397,6 +398,30 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); break; } + case ci::RequestType::EnablePkg: { + AddStep(pkgmgr_); + AddStep( + ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, + ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep(); + AddStep( + ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable); + AddStep( + ci::Plugin::ActionType::Uninstall); + break; + } + case ci::RequestType::DisablePkg: { + AddStep(pkgmgr_); + AddStep( + ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, + ci::configuration::StepParseManifest::StoreLocation::NORMAL); + AddStep(); + AddStep( + ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable); + AddStep( + ci::Plugin::ActionType::Uninstall); + break; + } default: { AddStep(); } -- 2.7.4 From db67a40cddd61d3e4dc9f932b152bf6f9de5f754 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Sat, 16 Jul 2016 17:57:59 +0900 Subject: [PATCH 14/16] support of legacy app directories. Requires: https://review.tizen.org/gerrit/#/c/80319/4 Change-Id: I9cfa081c634dba4a173d1bcabfb6f2c03eeabe18 Signed-off-by: jongmyeongko --- src/hybrid/hybrid_installer.cc | 6 ++++++ src/wgt/wgt_installer.cc | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 763d420..0e91262 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -124,6 +126,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); break; case ci::RequestType::Update: AddStep(pkgmgr_); @@ -184,6 +187,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -297,6 +301,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); break; case ci::RequestType::MountUpdate: AddStep(pkgmgr_); @@ -361,6 +366,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep(); AddStep(); AddStep(); + AddStep(); break; case ci::RequestType::ManifestDirectUpdate: AddStep(pkgmgr_); diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index d1dc7e9..1da34de 100755 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -127,6 +129,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) ci::Plugin::ActionType::Install); AddStep(); AddStep(); + AddStep(); break; } case ci::RequestType::Update: { @@ -184,6 +187,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); AddStep(); AddStep(); AddStep(); @@ -309,6 +313,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) AddStep(); AddStep(); AddStep(); + AddStep(); break; } case ci::RequestType::MountUpdate: { -- 2.7.4 From ea281f23451f2812f8f63464d594182dea08b09c Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Wed, 27 Jul 2016 19:44:21 +0900 Subject: [PATCH 15/16] Fix build warning Change-Id: I9bf2df3544921fe9a5fde76434f2f7597cbdd21a Signed-off-by: Sangyoon Jang --- src/wgt/step/security/step_check_extension_privileges.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wgt/step/security/step_check_extension_privileges.cc b/src/wgt/step/security/step_check_extension_privileges.cc index d2de923..15b305a 100755 --- a/src/wgt/step/security/step_check_extension_privileges.cc +++ b/src/wgt/step/security/step_check_extension_privileges.cc @@ -57,9 +57,9 @@ common_installer::Step::Status StepCheckExtensionPrivileges::process() { LOG(DEBUG) << "start to parse extension xml : " << *it; ExtensionConfigParser extensionParser(*it); std::vector list = extensionParser.GetExtensionPrivilegeList(); - for (int i = 0 ; i < list.size() ; i++) { - if (current_privileges.find(list[i]) == current_privileges.end()) { - privileges.insert(list[i]); + for (std::string priv : list) { + if (current_privileges.find(priv) == current_privileges.end()) { + privileges.emplace(priv); } } } -- 2.7.4 From 9fcd3e003b4a0b0b0b56beb83884bde047e0ee33 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Fri, 15 Jul 2016 14:54:57 +0200 Subject: [PATCH 16/16] Reorder steps for delta update for external installation Requires: - https://review.tizen.org/gerrit/80277 To verify, check that delta update mode works for external storage. Change-Id: I43433d8fc44136341c084e552042d4195ba2d1b5 --- src/hybrid/hybrid_installer.cc | 4 ++++ src/wgt/wgt_installer.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/hybrid/hybrid_installer.cc b/src/hybrid/hybrid_installer.cc index 0e91262..7c187c2 100644 --- a/src/hybrid/hybrid_installer.cc +++ b/src/hybrid/hybrid_installer.cc @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -208,7 +210,9 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr) AddStep( ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::BACKUP); + AddStep(); AddStep(); + AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, true); AddStep(); diff --git a/src/wgt/wgt_installer.cc b/src/wgt/wgt_installer.cc index 1da34de..17f7b90 100755 --- a/src/wgt/wgt_installer.cc +++ b/src/wgt/wgt_installer.cc @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -225,7 +227,9 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr) ci::configuration::StepParseManifest::ManifestLocation::INSTALLED, ci::configuration::StepParseManifest::StoreLocation::BACKUP); AddStep(); + AddStep(); AddStep("res/wgt/"); + AddStep(); AddStep( wgt::configuration::StepParse::ConfigLocation::PACKAGE, true); AddStep(); -- 2.7.4