From 78fdf7c4d6ec63e77ab35bca0f712744eaf63697 Mon Sep 17 00:00:00 2001 From: Bartlomiej Kunikowski Date: Tue, 13 Sep 2016 12:08:55 +0200 Subject: [PATCH] Nodisplay setting handling for webapp and checking privilege level for sound-mode and nodisplay Change-Id: I6b218368ad5a747edb9c08c420abbb443286618b --- src/wgt/step/configuration/step_parse.cc | 7 ++++++- src/wgt/step/security/step_check_settings_level.cc | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index b2b4822..4fcc344 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -300,7 +300,12 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { has_watch_catergory ? strdup("watchapp") : strdup("uiapp"); application->mainapp = strdup("true"); application->appid = strdup(app_info->id().c_str()); - application->nodisplay = has_ime ? strdup("true") : strdup("false"); + auto settings_info = + GetManifestDataForKey( + wgt::application_widget_keys::kTizenSettingKey); + bool no_display = settings_info ? settings_info->no_display() : false; + application->nodisplay = (has_ime || no_display) ? strdup("true") : + strdup("false"); application->taskmanage = has_ime ? strdup("false") : strdup("true"); SetApplicationXDefaults(application); if (has_watch_catergory) diff --git a/src/wgt/step/security/step_check_settings_level.cc b/src/wgt/step/security/step_check_settings_level.cc index 87f7702..2fd5923 100644 --- a/src/wgt/step/security/step_check_settings_level.cc +++ b/src/wgt/step/security/step_check_settings_level.cc @@ -36,6 +36,28 @@ bool ValidateSettingsForLevel(common_installer::PrivilegeLevel level, } LOG(INFO) << "Setting: 'long-polling' allowed"; } + + if (settings.no_display()) { + common_installer::PrivilegeLevel required_level = + common_installer::PrivilegeLevel::PARTNER; + if (!common_installer::SatifiesPrivilegeLevel(required_level, level)) { + LOG(ERROR) << "nodisplay requires visibility level: " + << common_installer::PrivilegeLevelToString(required_level); + return false; + } + LOG(INFO) << "Setting: 'nodisplay' allowed"; + } + + if (settings.sound_mode() != wgt::parse::SettingInfo::SoundMode::SHARED) { + common_installer::PrivilegeLevel required_level = + common_installer::PrivilegeLevel::PARTNER; + if (!common_installer::SatifiesPrivilegeLevel(required_level, level)) { + LOG(ERROR) << "sound-mode requires visibility level: " + << common_installer::PrivilegeLevelToString(required_level); + return false; + } + LOG(INFO) << "Setting: 'sound-mode' allowed"; + } return true; } -- 2.7.4