1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
5 #include "wgt/step/step_check_settings_level.h"
7 #include <manifest_parser/utils/logging.h>
8 #include <wgt_manifest_handlers/setting_handler.h>
12 #include "wgt/wgt_backend_data.h"
16 bool ValidateSettingsForLevel(common_installer::PrivilegeLevel level,
17 const wgt::parse::SettingInfo& settings) {
18 if (settings.background_vibration()) {
19 common_installer::PrivilegeLevel required_level =
20 common_installer::PrivilegeLevel::PARTNER;
21 if (!common_installer::SatifiesPrivilegeLevel(required_level, level)) {
22 LOG(ERROR) << "background_vibration requires visibility level: "
23 << common_installer::PrivilegeLevelToString(required_level);
26 LOG(INFO) << "Setting: 'background-vibration' allowed";
36 common_installer::Step::Status StepCheckSettingsLevel::process() {
37 if (!ValidateSettingsForLevel(context_->privilege_level.get(),
38 static_cast<WgtBackendData*>(
39 context_->backend_data.get())->settings.get())) {
40 return Status::PRIVILEGE_ERROR;
42 LOG(INFO) << "Settings privilege level checked";
46 } // namespace security