#include "wgt/step/configuration/step_parse.h"
#include "wgt/step/configuration/step_parse_recovery.h"
#include "wgt/step/encryption/step_remove_encryption_data.h"
+#include "wgt/step/filesystem/step_copy_preview_icons.h"
#include "wgt/step/filesystem/step_create_symbolic_link.h"
#include "wgt/step/filesystem/step_wgt_patch_icons.h"
#include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCreateStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<ci::filesystem::StepCreateStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepTpkPatchIcons>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<tpk::filesystem::StepCreateSymbolicLink>();
step/configuration/step_parse_recovery.cc
step/encryption/step_encrypt_resources.cc
step/encryption/step_remove_encryption_data.cc
+ step/filesystem/step_copy_preview_icons.cc
step/filesystem/step_create_symbolic_link.cc
step/filesystem/step_wgt_patch_icons.cc
step/filesystem/step_wgt_patch_storage_directories.cc
return true;
}
+bool StepParse::FillAppWidget() {
+ WgtBackendData* backend_data =
+ static_cast<WgtBackendData*>(context_->backend_data.get());
+
+ std::shared_ptr<const wgt::parse::AppWidgetInfo> appwidget_info =
+ std::static_pointer_cast<const wgt::parse::AppWidgetInfo>(
+ parser_->GetManifestData(
+ 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<const wgt::parse::AccountInfo> account_info =
std::static_pointer_cast<const wgt::parse::AccountInfo>(
}
bool StepParse::FillExtraManifestInfo(manifest_x* manifest) {
- return FillAccounts(manifest) && FillImeInfo();
+ return FillAccounts(manifest) && FillImeInfo() && FillAppWidget();
}
bool StepParse::FillManifestX(manifest_x* manifest) {
bool FillExtraManifestInfo(manifest_x* manifest);
bool FillAccounts(manifest_x* manifest);
bool FillImeInfo();
+ bool FillAppWidget();
bool FillBackgroundCategoryInfo(manifest_x* manifest);
bool FillManifestX(manifest_x* manifest);
--- /dev/null
+// Copyright (c) 2016 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/filesystem/step_copy_preview_icons.h"
+
+#include <boost/filesystem/path.hpp>
+#include <common/utils/file_util.h>
+
+#include <string>
+
+#include "wgt/wgt_backend_data.h"
+
+namespace bf = boost::filesystem;
+namespace ci = common_installer;
+
+namespace {
+
+const char kResWgt[] = "res/wgt";
+const char kSharedRes[] = "shared/res";
+
+} // namespace
+
+namespace wgt {
+namespace filesystem {
+
+ci::Step::Status StepCopyPreviewIcons::process() {
+ WgtBackendData* backend_data =
+ static_cast<WgtBackendData*>(context_->backend_data.get());
+ for (auto& appwidget : backend_data->appwidgets.get().app_widgets()) {
+ for (auto& size : appwidget.content_size) {
+ if (!size.preview.empty()) {
+ bf::path icon_path =
+ context_->pkg_path.get() / kResWgt / size.preview;
+ std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type);
+ std::string icon_name = appwidget.id + "." + type + "." + "preview" +
+ bf::path(size.preview).extension().string();
+ bf::path preview_icon =
+ context_->pkg_path.get() / kSharedRes / icon_name;
+ if (!ci::CopyFile(icon_path, preview_icon)) {
+ LOG(ERROR) << "Cannot create preview icon: " << preview_icon;
+ return Status::ICON_ERROR;
+ }
+ }
+ }
+ }
+ LOG(DEBUG) << "Preview icons created";
+ return Status::OK;
+}
+
+} // namespace filesystem
+} // namespace wgt
--- /dev/null
+// Copyright (c) 2016 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_FILESYSTEM_STEP_COPY_PREVIEW_ICONS_H_
+#define WGT_STEP_FILESYSTEM_STEP_COPY_PREVIEW_ICONS_H_
+
+#include <manifest_parser/utils/logging.h>
+
+#include <common/app_installer.h>
+#include <common/installer_context.h>
+#include <common/step/step.h>
+
+namespace wgt {
+namespace filesystem {
+
+/**
+ * \brief Step that create copy of preview icons in shared/res/ directory
+ */
+class StepCopyPreviewIcons : public common_installer::Step {
+ public:
+ using Step::Step;
+
+ Status process() override;
+ Status clean() override { return Status::OK; }
+ Status undo() override { return Status::OK; }
+ Status precheck() override { return Status::OK; }
+
+ SCOPE_LOG_TAG(CopyPreviewIcons)
+};
+
+} // namespace filesystem
+} // namespace wgt
+
+#endif // WGT_STEP_FILESYSTEM_STEP_COPY_PREVIEW_ICONS_H_
#include <unistd.h>
#include <boost/filesystem.hpp>
+#include <boost/system/error_code.hpp>
#include <common/utils/file_util.h>
#include <common/utils/glist_range.h>
#include <cassert>
#include <cstdio>
#include <string>
+#include "wgt/wgt_backend_data.h"
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
namespace {
const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service";
+const char kWidgetClientBinaryPath[] = "/usr/bin/widget-client";
} // namespace
namespace wgt {
namespace filesystem {
-namespace bf = boost::filesystem;
-
-common_installer::Step::Status StepCreateSymbolicLink::process() {
- assert(context_->manifest_data.get());
+bool StepCreateSymbolicLink::CreateSymlinksForApps() {
boost::system::error_code error;
for (application_x* app :
GListRange<application_x*>(context_->manifest_data.get()->application)) {
if (error) {
LOG(ERROR) << "Failed to set symbolic link "
<< boost::system::system_error(error).what();
- return Step::Status::ERROR;
+ return false;
}
}
- LOG(DEBUG) << "Symlinks created successfully";
+ return true;
+}
+bool StepCreateSymbolicLink::CreateSymlinksForAppWidgets() {
+ WgtBackendData* backend_data =
+ static_cast<WgtBackendData*>(context_->backend_data.get());
+ for (auto& appwidget : backend_data->appwidgets.get().app_widgets()) {
+ bf::path exec_path = context_->pkg_path.get() / "bin" / appwidget.id;
+ bs::error_code error;
+ bf::create_symlink(kWidgetClientBinaryPath, exec_path, error);
+ if (error) {
+ LOG(ERROR) << "Failed to create symlink for app widget: "
+ << appwidget.id;
+ return false;
+ }
+ }
+ return true;
+}
+
+common_installer::Step::Status StepCreateSymbolicLink::process() {
+ assert(context_->manifest_data.get());
+
+ if (!CreateSymlinksForApps())
+ return Status::APP_DIR_ERROR;
+
+ if (!CreateSymlinksForAppWidgets())
+ return Status::APP_DIR_ERROR;
+
+ LOG(DEBUG) << "Symlinks created successfully";
return Status::OK;
}
*/
Status precheck() override { return Status::OK; }
+ private:
+ bool CreateSymlinksForApps();
+ bool CreateSymlinksForAppWidgets();
+
SCOPE_LOG_TAG(SymbolicLink)
};
#include <string>
#include "wgt/step/common/privileges.h"
+#include "wgt/wgt_backend_data.h"
namespace bs = boost::system;
namespace bf = boost::filesystem;
namespace {
+const char kResWgt[] = "res/wgt";
+const char kSharedRes[] = "shared/res";
+
void WriteUIApplicationAttributes(
xmlTextWriterPtr writer, application_x *app) {
if (app->taskmanage)
xmlTextWriterEndElement(writer);
}
+ WgtBackendData* backend_data =
+ static_cast<WgtBackendData*>(context_->backend_data.get());
+ bf::path widget_content_path = context_->pkg_path.get() / kResWgt;
+ for (auto& appwidget : backend_data->appwidgets.get().app_widgets()) {
+ xmlTextWriterStartElement(writer, BAD_CAST "widget");
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "appid",
+ BAD_CAST appwidget.id.c_str());
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "primary",
+ BAD_CAST (appwidget.primary ? "true" : "false")); // NOLINT
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "abi",
+ BAD_CAST "html");
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "network",
+ BAD_CAST "true");
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "nodisplay",
+ BAD_CAST "false");
+
+ if (!appwidget.label.default_value.empty()) {
+ xmlTextWriterStartElement(writer, BAD_CAST "label");
+ xmlTextWriterWriteString(writer,
+ BAD_CAST appwidget.label.default_value.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+ for (auto& pair : appwidget.label.lang_value_map) {
+ xmlTextWriterStartElement(writer, BAD_CAST "label");
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "xml:lang",
+ BAD_CAST pair.first.c_str());
+ xmlTextWriterWriteString(writer, BAD_CAST pair.second.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+
+ if (!appwidget.icon_src.empty()) {
+ xmlTextWriterStartElement(writer, BAD_CAST "icon");
+ xmlTextWriterWriteString(writer, BAD_CAST appwidget.icon_src.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+
+ xmlTextWriterStartElement(writer, BAD_CAST "box");
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "type", BAD_CAST "buffer");
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "mouse_event",
+ BAD_CAST (appwidget.content_mouse_event ? "true" : "false")); // NOLINT
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "touch_effect",
+ BAD_CAST (appwidget.content_touch_effect ? "true" : "false")); // NOLINT
+ xmlTextWriterStartElement(writer, BAD_CAST "script");
+ bf::path src = widget_content_path / appwidget.content_src;
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "src",
+ BAD_CAST src.c_str());
+ xmlTextWriterEndElement(writer);
+ for (auto& size : appwidget.content_size) {
+ xmlTextWriterStartElement(writer, BAD_CAST "size");
+
+ std::string type = wgt::parse::AppWidgetSizeTypeToString(size.type);
+ if (!size.preview.empty()) {
+ std::string icon_name = appwidget.id + "." + type + "." + "preview" +
+ bf::path(size.preview).extension().string();
+ bf::path preview_icon =
+ context_->pkg_path.get() / kSharedRes / icon_name;
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "preview",
+ BAD_CAST preview_icon.c_str()); // NOLINT
+ }
+
+ xmlTextWriterWriteAttribute(writer, BAD_CAST "need_frame",
+ BAD_CAST "true");
+ xmlTextWriterWriteString(writer,
+ BAD_CAST type.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+ xmlTextWriterEndElement(writer);
+
+ xmlTextWriterEndElement(writer);
+ }
+
xmlTextWriterEndElement(writer);
xmlTextWriterEndDocument(writer);
#include <common/installer_context.h>
#include <common/utils/property.h>
+#include <wgt_manifest_handlers/appwidget_handler.h>
#include <wgt_manifest_handlers/setting_handler.h>
#include <string>
* \brief Property of SettingInfo
*/
Property<parse::SettingInfo> settings;
+
+ Property<parse::AppWidgetInfo> appwidgets;
};
} // namespace wgt
#include "wgt/step/configuration/step_parse_recovery.h"
#include "wgt/step/encryption/step_encrypt_resources.h"
#include "wgt/step/encryption/step_remove_encryption_data.h"
+#include "wgt/step/filesystem/step_copy_preview_icons.h"
#include "wgt/step/filesystem/step_create_symbolic_link.h"
#include "wgt/step/filesystem/step_wgt_patch_icons.h"
#include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
AddStep<wgt::filesystem::StepCreateSymbolicLink>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<ci::filesystem::StepCreateIcons>();
+ AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(