Allow Id of UI App to be empty if all Service Apps type global 81/226781/13
authorIlho Kim <ilho159.kim@samsung.com>
Thu, 5 Mar 2020 08:07:46 +0000 (17:07 +0900)
committerilho kim <ilho159.kim@samsung.com>
Fri, 3 Apr 2020 05:35:43 +0000 (05:35 +0000)
The wgt service app should have a dummy ui app even if it is not needed
This patch allows the UI app's ID to be empty if all service app types are global

-Before
 <tizen:application id="appid" package="pkgid" required_version="x.x"/> -> Allow
 <tizen:application package="pkgid" required_version="x.x"/> -> Disallow

-After
 <tizen:application id="appid" package="pkgid" required_version="x.x"/> -> Allow
 <tizen:application package="pkgid" required_version="x.x"/> -> Conditionally Allow(If all service app's types global)

Requires:
 [wgt-manifest-handlers]https://review.tizen.org/gerrit/#/c/platform/core/appfw/wgt-manifest-handlers/+/226780/

Change-Id: I2ed942fd7fb16b71a98cdac253bf71ca18cdf067
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/wgt/step/configuration/step_parse.cc
src/wgt/step/configuration/step_parse.h

index be1e09c..b544181 100644 (file)
@@ -336,12 +336,51 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) {
   return true;
 }
 
+bool StepParse::AllServiceAppGlobal() {
+  auto service_list =
+      GetManifestDataForKey<const wgt::parse::ServiceList>(
+             app_keys::kTizenServiceKey);
+  if (!service_list) {
+    LOG(ERROR) << "service app list empty";
+    return false;
+  }
+  bool all_service_app_global = true;
+  for (const auto& service_info : service_list->services) {
+    if (service_info.type() != "global") {
+      all_service_app_global = false;
+      break;
+    }
+  }
+
+  if (!all_service_app_global) {
+    LOG(ERROR) << "All service app types are not global";
+    return false;
+  }
+
+  return true;
+}
+
 bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
   auto app_info =
       GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
              app_keys::kTizenApplicationKey);
   if (!app_info.get())
     return true;
+
+  if (app_info.get()->id().empty()) {
+    if (!AllServiceAppGlobal()) {
+      LOG(ERROR) << "Empty of ui app's id is possible"
+                 << " when service app types are all global";
+      return false;
+    }
+    if (app_info->package().empty()) {
+      LOG(ERROR) << "app_info's package is empty";
+      return false;
+    }
+    manifest->package = strdup(app_info->package().c_str());
+    return true;
+  }
+
   bool has_watch_category = false;
   bool has_ime = false;
   bool has_downloadable_font = false;
@@ -513,6 +552,8 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
       application->metadata = g_list_append(application->metadata, item);
     }
 
+    if (!manifest->mainapp_id)
+      manifest->mainapp_id = strdup(application->appid);
     manifest->application = g_list_append(manifest->application, application);
   }
   return true;
index 5c8593c..c4afe3a 100644 (file)
@@ -55,6 +55,7 @@ class StepParse : public common_installer::Step {
 
   std::string GetPackageVersion(const std::string& manifest_version);
 
+  bool AllServiceAppGlobal();
   bool FillInstallationInfo(manifest_x* manifest);
   bool FillIconPaths(manifest_x* manifest);
   bool FillWidgetInfo(manifest_x* manifest);