Nodisplay setting handling for webapp and checking privilege level for 20/88120/3
authorBartlomiej Kunikowski <b.kunikowski@partner.samsung.com>
Tue, 13 Sep 2016 10:08:55 +0000 (12:08 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Tue, 13 Sep 2016 14:01:21 +0000 (07:01 -0700)
sound-mode and nodisplay

Change-Id: I6b218368ad5a747edb9c08c420abbb443286618b

src/wgt/step/configuration/step_parse.cc
src/wgt/step/security/step_check_settings_level.cc

index b2b4822..4fcc344 100644 (file)
@@ -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<const wgt::parse::SettingInfo>(
+             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)
index 87f7702..2fd5923 100644 (file)
@@ -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;
 }