#include <tpk/step/step_create_symbolic_link.h>
#include <tpk/step/step_parse.h>
+#include <tpk/step/step_tpk_patch_icons.h>
#include "hybrid/hybrid_backend_data.h"
#include "hybrid/step/step_encrypt_resources.h"
#include "wgt/step/step_create_symbolic_link.h"
#include "wgt/step/step_generate_xml.h"
#include "wgt/step/step_remove_encryption_data.h"
-#include "wgt/step/step_wgt_create_icons.h"
+#include "wgt/step/step_wgt_patch_icons.h"
#include "wgt/step/step_wgt_patch_storage_directories.h"
namespace ci = common_installer;
AddStep<hybrid::encrypt::StepEncryptResources>();
AddStep<ci::security::StepRollbackInstallationSecurity>();
AddStep<ci::filesystem::StepCopy>();
+ AddStep<tpk::filesystem::StepTpkPatchIcons>();
+ AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
- AddStep<wgt::filesystem::StepWgtCreateIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCreateStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<ci::backup::StepBackupManifest>();
AddStep<ci::backup::StepBackupIcons>();
AddStep<ci::backup::StepCopyBackup>();
+ AddStep<tpk::filesystem::StepTpkPatchIcons>();
+ AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
- AddStep<wgt::filesystem::StepWgtCreateIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<ci::backup::StepBackupManifest>();
AddStep<ci::backup::StepBackupIcons>();
AddStep<ci::backup::StepCopyBackup>();
+ AddStep<tpk::filesystem::StepTpkPatchIcons>();
+ AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
- AddStep<wgt::filesystem::StepWgtCreateIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
step/step_parse_recovery.cc
step/step_rds_parse.cc
step/step_rds_modify.cc
- step/step_wgt_backup_icons.cc
- step/step_wgt_create_icons.cc
+ step/step_wgt_patch_icons.cc
step/step_wgt_patch_storage_directories.cc
- step/step_wgt_recover_icons.cc
step/step_wgt_resource_directory.cc
step/step_add_default_privileges.cc
wgt_app_query_interface.cc
xmlTextWriterEndElement(writer);
}
- // icon is renamed to <appid.png>
if (app->icon) {
icon_x* iconx = reinterpret_cast<icon_x*>(app->icon->data);
- bf::path app_icon = context_->pkg_path.get();
- // TODO(t.iwanek): type should not be used here
- if (context_->pkg_type.get() == "wgt") {
- app_icon /= "res/wgt";
- } else {
- app_icon /= "shared/res";
- }
- app_icon /= iconx->text;
- bf::path icon = app->appid;
- if (app_icon.has_extension())
- icon += app_icon.extension();
- else
- icon += bf::path(".png");
-
- if (bf::exists(app_icon)) {
- xmlTextWriterWriteFormatElement(writer, BAD_CAST "icon",
- "%s", BAD_CAST icon.c_str());
- }
+ xmlTextWriterWriteFormatElement(
+ writer, BAD_CAST "icon", "%s", BAD_CAST iconx->text);
} else {
// Default icon setting is role of the platform
- LOG(DEBUG) << "Icon was not found in package";
+ LOG(DEBUG) << "Icon was not found in application";
}
for (image_x* image : GListRange<image_x*>(app->image)) {
#include "wgt/step/step_parse.h"
+#include <boost/filesystem/path.hpp>
+
#include <common/app_installer.h>
#include <common/installer_context.h>
#include <common/step/step.h>
#include "wgt/wgt_backend_data.h"
+namespace bf = boost::filesystem;
+
namespace {
const std::string kManifestVersion = "1.0.0";
}
bool StepParse::FillIconPaths(manifest_x* manifest) {
+ std::shared_ptr<const TizenApplicationInfo> app_info =
+ std::static_pointer_cast<const TizenApplicationInfo>(
+ parser_->GetManifestData(app_keys::kTizenApplicationKey));
+ if (!app_info) {
+ LOG(ERROR) << "Application info manifest data has not been found.";
+ return false;
+ }
std::shared_ptr<const ApplicationIconsInfo> icons_info =
std::static_pointer_cast<const ApplicationIconsInfo>(
parser_->GetManifestData(app_keys::kIconsKey));
if (icons_info.get()) {
for (auto& application_icon : icons_info->icons()) {
icon_x* icon = reinterpret_cast<icon_x*> (calloc(1, sizeof(icon_x)));
- icon->text = strdup(application_icon.path().c_str());
+ bf::path icon_path = context_->root_application_path.get()
+ / app_info->package() / "res" / "wgt" / application_icon.path();
+ icon->text = strdup(icon_path.c_str());
icon->lang = strdup(DEFAULT_LOCALE);
manifest->icon = g_list_append(manifest->icon, icon);
}
+++ /dev/null
-// 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.
-
-#include "wgt/step/step_wgt_backup_icons.h"
-
-#include <pkgmgr-info.h>
-#include <vector>
-
-namespace {
-const char kSharedRes[] = "shared/res";
-
-namespace bf = boost::filesystem;
-} // namespace
-
-namespace wgt {
-namespace backup {
-
-common_installer::Step::Status StepWgtBackupIcons::process() {
- // TODO(l.wysocki): As a temporary solution this will move icons into two
- // destinations respectively {HOME}/.applications/icons,
- // and {APP_ROOT}/shared/res, when some project will stop using old
- // location ({HOME}/.applications/icons) then it can be removed from here.
- std::vector<bf::path> paths { getIconPath(context_->uid.get()),
- context_->root_application_path.get()
- / context_->pkgid.get() / kSharedRes };
- return MoveIcons(paths);
-}
-
-} // namespace backup
-} // namespace wgt
+++ /dev/null
-// 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_STEP_WGT_BACKUP_ICONS_H_
-#define WGT_STEP_STEP_WGT_BACKUP_ICONS_H_
-
-#include <common/step/step_backup_icons.h>
-#include <manifest_parser/utils/logging.h>
-
-namespace wgt {
-namespace backup {
-
-/**
- *\brief Step responsible for creating backup for icons during update and
- * uninstallation.
- * Used by WGT backend
- */
-class StepWgtBackupIcons : public common_installer::backup::StepBackupIcons {
- public:
- using StepBackupIcons::StepBackupIcons;
-
- /**
- * \brief main logic of backuping icons
- *
- * \return Status::OK, if successful backup, Status::ERROR otherwise
- */
- Status process() override;
-
- SCOPE_LOG_TAG(WgtBackupIcons)
-};
-
-} // namespace backup
-} // namespace wgt
-
-#endif // WGT_STEP_STEP_WGT_BACKUP_ICONS_H_
+++ /dev/null
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#include "wgt/step/step_wgt_create_icons.h"
-
-#include <pkgmgr-info.h>
-#include <vector>
-
-#include "common/utils/glist_range.h"
-
-namespace bf = boost::filesystem;
-namespace ci = common_installer;
-
-namespace {
-const char kResWgt[] = "res/wgt";
-} // namespace
-
-namespace wgt {
-namespace filesystem {
-
-common_installer::Step::Status StepWgtCreateIcons::process() {
- // TODO(l.wysocki): As a temporary solution this will copy icons into two
- // destinations respectively {HOME}/.applications/icons,
- // and {APP_ROOT}/shared/res, when some project will stop using old
- // location ({HOME}/.applications/icons) then it can be removed from here.
- std::vector<bf::path> paths { getIconPath(context_->uid.get()),
- StepCreateIcons::GetIconRoot() };
-
- // explicit step for wgt apps to add absolute path to icon in order to
- // store it in db
- ci::Step::Status result = CopyIcons(paths);
- for (application_x* app :
- GListRange<application_x*>(context_->manifest_data.get()->application)) {
- if (app->icon) {
- icon_x* icon = reinterpret_cast<icon_x*>(app->icon->data);
- bf::path icon_path = StepCreateIcons::GetIconRoot() / icon->text;
- if (icon->text)
- free(const_cast<char *>(icon->text));
- icon->text = strdup(icon_path.c_str());
- }
- }
- return result;
-}
-
-boost::filesystem::path StepWgtCreateIcons::GetIconRoot() const {
- return context_->pkg_path.get() / kResWgt;
-}
-
-std::string StepWgtCreateIcons::GetAppTypeForIcons() const {
- return "webapp";
-}
-
-} // namespace filesystem
-} // namespace wgt
-
+++ /dev/null
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef WGT_STEP_STEP_WGT_CREATE_ICONS_H_
-#define WGT_STEP_STEP_WGT_CREATE_ICONS_H_
-
-#include <manifest_parser/utils/logging.h>
-
-#include <common/step/step_create_icons.h>
-
-#include <string>
-
-namespace wgt {
-namespace filesystem {
-
-/**
- * \brief This step return path to widget icon
- */
-class StepWgtCreateIcons
- : public common_installer::filesystem::StepCreateIcons {
- public:
- using StepCreateIcons::StepCreateIcons;
-
- Status process() override;
-
- /**
- * \brief Return path to widget icon
- *
- * \return path to widget icon
- */
- boost::filesystem::path GetIconRoot() const override;
-
- /**
- * \brief Return type of application for which icons should be created
- *
- * \return application type
- */
- std::string GetAppTypeForIcons() const override;
-
- SCOPE_LOG_TAG(WgtCreateIcons)
-};
-
-} // namespace filesystem
-} // namespace wgt
-
-#endif // WGT_STEP_STEP_WGT_CREATE_ICONS_H_
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "wgt/step/step_wgt_patch_icons.h"
+
+#include <pkgmgr-info.h>
+
+#include "common/utils/file_util.h"
+#include "common/utils/glist_range.h"
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
+namespace ci = common_installer;
+
+namespace {
+const char kResWgt[] = "res/wgt";
+} // namespace
+
+namespace wgt {
+namespace filesystem {
+
+common_installer::Step::Status StepWgtPatchIcons::process() {
+ bf::path common_icon_location = context_->pkg_path.get() / "shared" / "res";
+ bs::error_code error;
+ bf::create_directories(common_icon_location, error);
+ for (application_x* app :
+ GListRange<application_x*>(context_->manifest_data.get()->application)) {
+ if (strcmp(app->type, "webapp") != 0)
+ continue;
+ if (app->icon) {
+ icon_x* icon = reinterpret_cast<icon_x*>(app->icon->data);
+ bf::path icon_text(icon->text);
+ bf::path icon_path = common_icon_location / app->appid;
+ if (icon_text.has_extension())
+ icon_path += icon_text.extension();
+ else
+ icon_path += ".png";
+
+ bf::copy_file(icon->text, icon_path,
+ bf::copy_option::overwrite_if_exists, error);
+ if (error) {
+ LOG(ERROR) << "Failed to move icon from " << icon->text << " to "
+ << icon_path;
+ return Status::ICON_ERROR;
+ }
+ if (icon->text)
+ free(const_cast<char*>(icon->text));
+ icon->text = strdup(icon_path.c_str());
+ }
+ }
+ return Status::OK;
+}
+
+} // namespace filesystem
+} // namespace wgt
+
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef WGT_STEP_STEP_WGT_PATCH_ICONS_H_
+#define WGT_STEP_STEP_WGT_PATCH_ICONS_H_
+
+#include <manifest_parser/utils/logging.h>
+
+#include <common/step/step.h>
+
+#include <string>
+
+namespace wgt {
+namespace filesystem {
+
+/**
+ * @brief The StepWgtPatchIcons class
+ * Copy widget icons to standard location of icons - shared/res/
+ * where StepCreateIcons excepts icons to be.
+ */
+class StepWgtPatchIcons : public common_installer::Step {
+ public:
+ using Step::Step;
+
+ Status process() override;
+ Status undo() override { return Status::OK; }
+ Status clean() override { return Status::OK; }
+ Status precheck() override { return Status::OK; }
+
+ SCOPE_LOG_TAG(WgtPatchIcons)
+};
+
+} // namespace filesystem
+} // namespace wgt
+
+#endif // WGT_STEP_STEP_WGT_PATCH_ICONS_H_
+++ /dev/null
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#include "wgt/step/step_wgt_recover_icons.h"
-
-#include <pkgmgr-info.h>
-
-namespace {
-const char kSharedRes[] = "shared/res";
-
-namespace bf = boost::filesystem;
-} // namespace
-
-namespace wgt {
-namespace filesystem {
-
-std::vector<boost::filesystem::path> StepWgtRecoverIcons::GetIconsPaths() {
- // TODO(l.wysocki): As a temporary solution this will move icons into two
- // destinations respectively {HOME}/.applications/icons,
- // and {APP_ROOT}/shared/res, when some project will stop using old
- // location ({HOME}/.applications/icons) then it can be removed from here.
- std::vector<bf::path> paths { bf::path(getIconPath(context_->uid.get())),
- context_->root_application_path.get()
- / context_->pkgid.get() / kSharedRes };
- return paths;
-}
-
-} // namespace filesystem
-} // namespace wgt
-
+++ /dev/null
-// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
-// Use of this source code is governed by an apache-2.0 license that can be
-// found in the LICENSE file.
-
-#ifndef WGT_STEP_STEP_WGT_RECOVER_ICONS_H_
-#define WGT_STEP_STEP_WGT_RECOVER_ICONS_H_
-
-#include <common/step/step_recover_icons.h>
-#include <vector>
-
-namespace wgt {
-namespace filesystem {
-
-/**
- * @brief The StepRecoverIcons class
- * Fixes state of platform icon files in recovery mode.
- *
- * For recovery of new installation, all icons files are removed.
- * For recovery of update installation, all icons of applications of package are
- * restored to its previous locations.
- */
-class StepWgtRecoverIcons :
- public common_installer::filesystem::StepRecoverIcons {
- public:
- using StepRecoverIcons::StepRecoverIcons;
-
- protected:
- virtual std::vector<boost::filesystem::path> GetIconsPaths();
-
- SCOPE_LOG_TAG(WgtRecoverIcons)
-};
-
-} // namespace filesystem
-} // namespace wgt
-
-#endif // WGT_STEP_STEP_WGT_RECOVER_ICONS_H_
#include <boost/system/error_code.hpp>
#include <common/pkgmgr_registration.h>
+#include <common/recovery_file.h>
#include <common/request.h>
#include <common/utils/file_util.h>
return pkg_id;
}
+std::string ReadPkgidFromRecovery(const std::string& recovery_path) {
+ std::unique_ptr<ci::recovery::RecoveryFile> recovery_file =
+ ci::recovery::RecoveryFile::OpenRecoveryFileForPath(recovery_path);
+ recovery_file->Detach();
+ return recovery_file->pkgid();
+}
+
} // namespace
namespace wgt {
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())) {
bf::path package_directory(ci::GetRootAppPath());
- if (bf::exists(package_directory / kTizenManifestLocation) &&
- bf::exists(package_directory / kHybridConfigLocation))
+ if (bf::exists(package_directory / arg / kTizenManifestLocation) &&
+ bf::exists(package_directory / arg / kHybridConfigLocation))
return true;
} else {
bool tizen_manifest_found = false;
#include <common/pkgmgr_interface.h>
#include <common/step/step_configure.h>
+#include <common/step/step_backup_icons.h>
#include <common/step/step_backup_manifest.h>
+#include <common/step/step_create_icons.h>
#include <common/step/step_create_storage_directories.h>
#include <common/step/step_copy.h>
#include <common/step/step_copy_backup.h>
#include <common/step/step_register_app.h>
#include <common/step/step_recover_application.h>
#include <common/step/step_recover_files.h>
+#include <common/step/step_recover_icons.h>
#include <common/step/step_recover_manifest.h>
#include <common/step/step_recover_security.h>
#include <common/step/step_recover_storage_directories.h>
#include "wgt/step/step_rds_modify.h"
#include "wgt/step/step_rds_parse.h"
#include "wgt/step/step_remove_encryption_data.h"
-#include "wgt/step/step_wgt_backup_icons.h"
-#include "wgt/step/step_wgt_create_icons.h"
+#include "wgt/step/step_wgt_patch_icons.h"
#include "wgt/step/step_wgt_patch_storage_directories.h"
-#include "wgt/step/step_wgt_recover_icons.h"
#include "wgt/step/step_wgt_resource_directory.h"
namespace ci = common_installer;
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCreateStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
- AddStep<wgt::filesystem::StepWgtCreateIcons>();
+ AddStep<wgt::filesystem::StepWgtPatchIcons>();
+ AddStep<ci::filesystem::StepCreateIcons>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::backup::StepOldManifest>();
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::backup::StepBackupManifest>();
- AddStep<wgt::backup::StepWgtBackupIcons>();
+ AddStep<ci::backup::StepBackupIcons>();
AddStep<ci::backup::StepCopyBackup>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
- AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
- AddStep<wgt::filesystem::StepWgtCreateIcons>();
+ AddStep<wgt::filesystem::StepWgtPatchIcons>();
+ AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
AddStep<ci::backup::StepOldManifest>();
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::backup::StepBackupManifest>();
- AddStep<wgt::backup::StepWgtBackupIcons>();
+ AddStep<ci::backup::StepBackupIcons>();
AddStep<ci::backup::StepCopyBackup>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
- AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
- AddStep<wgt::filesystem::StepWgtCreateIcons>();
+ AddStep<wgt::filesystem::StepWgtPatchIcons>();
+ AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
AddStep<wgt::parse::StepParseRecovery>();
AddStep<ci::pkgmgr::StepRecoverApplication>();
AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
- AddStep<wgt::filesystem::StepWgtRecoverIcons>();
+ AddStep<ci::filesystem::StepRecoverIcons>();
AddStep<ci::filesystem::StepRecoverManifest>();
AddStep<ci::filesystem::StepRecoverStorageDirectories>();
AddStep<ci::filesystem::StepRecoverFiles>();