step/security/step_add_default_privileges.cc
step/security/step_check_settings_level.cc
step/security/step_check_wgt_background_category.cc
+ step/security/step_check_wgt_notification_category.cc
wgt_app_query_interface.cc
wgt_installer.cc
)
--- /dev/null
+// 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_wgt_notification_category.h>
+
+#include <common/utils/glist_range.h>
+
+#include <manifest_parser/utils/logging.h>
+
+namespace {
+const char kNotificationCategoryName[]
+ = "http://tizen.org/category/always_on_top";
+}
+
+namespace wgt {
+namespace security {
+
+common_installer::Step::Status StepCheckWgtNotificationCategory::process() {
+ const auto notificationAllowed = context_->privilege_level.get() >=
+ common_installer::PrivilegeLevel::PARTNER;
+
+ // no point in checking if priv is set
+ if (notificationAllowed)
+ return Status::OK;
+
+ for (const auto app :
+ GListRange<application_x *>(context_->manifest_data.get()->application)) {
+ for (const auto category : GListRange<char *>(app->category)) {
+ if (strcmp(category, kNotificationCategoryName) == 0) {
+ LOG(ERROR) << "Insufficient privileges for notification category.";
+ return Status::PRIVILEGE_ERROR;
+ }
+ }
+ }
+
+ LOG(INFO) << "No notification category present.";
+ return Status::OK;
+}
+} // namespace security
+} // 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_SECURITY_STEP_CHECK_WGT_NOTIFICATION_CATEGORY_H_
+#define WGT_STEP_SECURITY_STEP_CHECK_WGT_NOTIFICATION_CATEGORY_H_
+
+#include <common/step/step.h>
+
+namespace wgt {
+namespace security {
+
+/**
+ * \brief Checks if the app can show notifications, if it requires that feature.
+ */
+class StepCheckWgtNotificationCategory :
+ public common_installer::Step {
+ public:
+ using common_installer::Step::Step;
+ ~StepCheckWgtNotificationCategory() = default;
+
+ Status process() override;
+
+ Status clean() override { return Status::OK; }
+ Status undo() override { return Status::OK; }
+ Status precheck() override { return Status::OK; }
+};
+} // namespace security
+} // namespace wgt
+
+#endif // WGT_STEP_SECURITY_STEP_CHECK_WGT_NOTIFICATION_CATEGORY_H_
#include "wgt/step/security/step_add_default_privileges.h"
#include "wgt/step/security/step_check_settings_level.h"
#include "wgt/step/security/step_check_wgt_background_category.h"
+#include "wgt/step/security/step_check_wgt_notification_category.h"
namespace ci = common_installer;
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<wgt::security::StepCheckSettingsLevel>();
AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
+ AddStep<wgt::security::StepCheckWgtNotificationCategory>();
AddStep<wgt::encryption::StepEncryptResources>();
AddStep<wgt::filesystem::StepWgtResourceDirectory>();
AddStep<ci::security::StepRollbackInstallationSecurity>();
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<wgt::security::StepCheckSettingsLevel>();
AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
+ AddStep<wgt::security::StepCheckWgtNotificationCategory>();
AddStep<ci::security::StepCheckOldCertificate>();
AddStep<wgt::filesystem::StepWgtResourceDirectory>();
AddStep<ci::configuration::StepParseManifest>(
AddStep<ci::security::StepPrivilegeCompatibility>();
AddStep<wgt::security::StepCheckSettingsLevel>();
AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
+ AddStep<wgt::security::StepCheckWgtNotificationCategory>();
AddStep<ci::security::StepCheckOldCertificate>();
AddStep<wgt::filesystem::StepWgtResourceDirectory>();
AddStep<ci::configuration::StepParseManifest>(