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_create_storage_directories.cc
step/step_wgt_copy_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
--- /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>
+
+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_
#include "wgt/step/step_wgt_create_icons.h"
-namespace {
+#include <pkgmgr-info.h>
-const char kResWgt[] = "res/wgt";
+#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((void *)icon->text);
+ icon->text = strdup(icon_path.c_str());
+ }
+ }
+ return result;
+}
+
boost::filesystem::path StepWgtCreateIcons::GetIconRoot() const {
return context_->pkg_path.get() / kResWgt;
}
public:
using StepCreateIcons::StepCreateIcons;
+ Status process() override;
+
/**
* \brief Return path to widget icon
*
--- /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>
+
+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 <common/pkgmgr_interface.h>
#include <common/step/step_configure.h>
#include <common/step/step_backup_manifest.h>
-#include <common/step/step_backup_icons.h>
#include <common/step/step_copy.h>
#include <common/step/step_copy_backup.h>
#include <common/step/step_copy_storage_directories.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_copy_storage_directories.h"
#include "wgt/step/step_wgt_create_icons.h"
#include "wgt/step/step_wgt_create_storage_directories.h"
+#include "wgt/step/step_wgt_recover_icons.h"
#include "wgt/step/step_wgt_resource_directory.h"
namespace ci = common_installer;
AddStep<ci::backup::StepOldManifest>();
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::backup::StepBackupManifest>();
- AddStep<ci::backup::StepBackupIcons>();
+ AddStep<wgt::backup::StepWgtBackupIcons>();
AddStep<ci::backup::StepCopyBackup>();
AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<ci::backup::StepOldManifest>();
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::backup::StepBackupManifest>();
- AddStep<ci::backup::StepBackupIcons>();
+ AddStep<wgt::backup::StepWgtBackupIcons>();
AddStep<ci::backup::StepCopyBackup>();
AddStep<wgt::filesystem::StepWgtCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<wgt::parse::StepParseRecovery>();
AddStep<ci::pkgmgr::StepRecoverApplication>();
AddStep<ci::filesystem::StepRemoveTemporaryDirectory>();
- AddStep<ci::filesystem::StepRecoverIcons>();
+ AddStep<wgt::filesystem::StepWgtRecoverIcons>();
AddStep<ci::filesystem::StepRecoverManifest>();
AddStep<ci::filesystem::StepRecoverStorageDirectories>();
AddStep<ci::filesystem::StepRecoverFiles>();