From: Ilho Kim Date: Thu, 5 Mar 2020 08:07:46 +0000 (+0900) Subject: Allow Id of UI App to be empty if all Service Apps type global X-Git-Tag: accepted/tizen/unified/20200413.012245~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75fe1c6a3878f398eeb908b3a479cba6ef3041b0;p=platform%2Fcore%2Fappfw%2Fwgt-backend.git Allow Id of UI App to be empty if all Service Apps type global 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 -> Allow -> Disallow -After -> Allow -> 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 --- diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index be1e09c..b544181 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -336,12 +336,51 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) { return true; } +bool StepParse::AllServiceAppGlobal() { + auto service_list = + GetManifestDataForKey( + 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( 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; diff --git a/src/wgt/step/configuration/step_parse.h b/src/wgt/step/configuration/step_parse.h index 5c8593c..c4afe3a 100644 --- a/src/wgt/step/configuration/step_parse.h +++ b/src/wgt/step/configuration/step_parse.h @@ -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);