Support legacy web service apps 67/254867/3
authorYoungsoo Choi <kenshin.choi@samsung.com>
Wed, 10 Mar 2021 05:17:37 +0000 (21:17 -0800)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Wed, 10 Mar 2021 07:21:01 +0000 (23:21 -0800)
This creates symlink to wrt-service only if service type is not defined
to support legacy web service apps.

Change-Id: I0c7214770aa50fae6236597b8f5a3b11e8a54f07
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
src/wgt/step/configuration/step_parse.cc
src/wgt/step/filesystem/step_create_wgt_symbolic_link.cc

index 3b11daa..c7d17e6 100644 (file)
@@ -344,7 +344,7 @@ bool StepParse::AllServiceAppGlobal() {
   }
   bool all_service_app_global = true;
   for (const auto& service_info : service_list->services) {
-    if (service_info.type() != "global") {
+    if (service_info.type() == "ui") {
       all_service_app_global = false;
       break;
     }
@@ -991,6 +991,10 @@ common_installer::Step::Status StepParse::process() {
 
   WgtBackendData* backend_data =
     static_cast<WgtBackendData*>(context_->backend_data.get());
+  auto service_list = GetManifestDataForKey<const wgt::parse::ServiceList>(
+      app_keys::kTizenServiceKey);
+  if (service_list)
+    backend_data->service_list.set(*service_list);
 
   if (check_start_file_) {
     if (!ui_app_not_exists_ && !parser_->CheckValidStartFile()) {
@@ -1007,12 +1011,8 @@ common_installer::Step::Status StepParse::process() {
     // making backup of content data and services content data
     auto content_info = GetManifestDataForKey<const wgt::parse::ContentInfo>(
         app_keys::kTizenContentKey);
-    auto service_list = GetManifestDataForKey<const wgt::parse::ServiceList>(
-        app_keys::kTizenServiceKey);
     if (content_info)
       backend_data->content.set(*content_info);
-    if (service_list)
-      backend_data->service_list.set(*service_list);
   }
 
   context_->pkgid.set(manifest->package);
index c6ea4fd..3b9f132 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <pkgmgr-info.h>
 #include <unistd.h>
+#include <unordered_map>
 
 #include <boost/filesystem.hpp>
 #include <boost/system/error_code.hpp>
 #include <cstdio>
 #include <string>
 
+#include "wgt/utils/wgt_backend_data.h"
+
 namespace bf = boost::filesystem;
 namespace bs = boost::system;
 
 namespace {
 
-const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service-launcher";
+const char kWrtServiceBinaryPath[] = "/usr/bin/wrt-service";
+const char kWrtServiceLauncherBinaryPath[] = "/usr/bin/wrt-service-launcher";
 const char kWebWidgetRuntimeBinaryPath[] = "/usr/bin/web-widget-runtime";
 const char kWRTPath[] = "/usr/bin/wrt";
 
@@ -32,6 +36,13 @@ namespace wgt {
 namespace filesystem {
 
 bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() {
+  std::unordered_map<std::string, std::string> service_app_type;
+  WgtBackendData* backend_data =
+      static_cast<WgtBackendData*>(context_->backend_data.get());
+  for (auto& service_info : backend_data->service_list.get().services) {
+    service_app_type[service_info.id()] = service_info.type();
+  }
+
   boost::system::error_code error;
   for (application_x* app :
       GListRange<application_x*>(context_->manifest_data.get()->application)) {
@@ -52,6 +63,8 @@ bool StepCreateWgtSymbolicLink::CreateSymlinksForApps() {
       bf::create_symlink(bf::path(kWRTPath), exec_path, error);
     } else if (strcmp(app->component_type, "widgetapp") == 0) {
       bf::create_symlink(kWebWidgetRuntimeBinaryPath, exec_path, error);
+    } else if (!service_app_type[app->appid].empty()) {
+      bf::create_symlink(kWrtServiceLauncherBinaryPath, exec_path, error);
     } else {
       bf::create_symlink(kWrtServiceBinaryPath, exec_path, error);
     }