Adjust nodisplay attribute of widget application 86/168586/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 29 Jan 2018 10:42:09 +0000 (19:42 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 29 Jan 2018 10:58:01 +0000 (10:58 +0000)
The nodisplay attribute of widget application should be true,
but nodisplay of widget-service framework uses this attribute
as defined at manifest file. So we need to adjust this value
just before register in pkgmgr db.

Change-Id: Ia04208dc5269a6ae96348e4a29c14ebfff123ddb
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/pkgmgr_registration.cc

index c720286..1dc5b67 100644 (file)
@@ -13,6 +13,7 @@
 #include <vector>
 #include <utility>
 
+#include "common/utils/glist_range.h"
 #include "common/utils/manifest_util.h"
 
 namespace bf = boost::filesystem;
@@ -22,6 +23,8 @@ namespace {
 
 using CertInfo = common_installer::CertificateInfo;
 
+const char kWidgetApp[] = "widgetapp";
+
 bool RegisterCertificate(pkgmgr_instcertinfo_h handle,
 const ValidationCore::CertificatePtr& certPtr, pkgmgr_instcert_type type) {
     if (certPtr) {
@@ -76,6 +79,19 @@ bool RegisterCertificates(
   return true;
 }
 
+void AdjustWidgetNodisplayAttr(manifest_x* manifest) {
+  for (auto& app : GListRange<application_x*>(manifest->application)) {
+    if (!strcmp(app->component_type, kWidgetApp)) {
+      free(app->nodisplay);
+      // The nodisplay attribute of widget application should be true,
+      // but nodisplay of widget-service framework uses this attribute
+      // as defined at manifest file. So we need to adjust this value
+      // just before register in pkgmgr db.
+      app->nodisplay = strdup("true");
+    }
+  }
+}
+
 }  // namespace
 
 namespace common_installer {
@@ -96,6 +112,8 @@ bool RegisterAppInPkgmgr(manifest_x* manifest,
     manifest->external_path = strdup(ext_path.c_str());
   }
 
+  AdjustWidgetNodisplayAttr(manifest);
+
   int ret = request_mode != RequestMode::GLOBAL ?
       pkgmgr_parser_process_usr_manifest_x_for_installation(manifest, uid) :
       pkgmgr_parser_process_manifest_x_for_installation(manifest);
@@ -123,6 +141,8 @@ bool UpgradeAppInPkgmgr(manifest_x* manifest,
     manifest->external_path = strdup(ext_path.c_str());
   }
 
+  AdjustWidgetNodisplayAttr(manifest);
+
   int ret = request_mode != RequestMode::GLOBAL ?
        pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest, uid) :
        pkgmgr_parser_process_manifest_x_for_upgrade(manifest);