Metadata/category plugin calling convention of tizen 2.4 97/61397/5 accepted/tizen/common/20160315.220748 accepted/tizen/ivi/20160312.015509 accepted/tizen/mobile/20160312.015417 accepted/tizen/tv/20160312.015429 accepted/tizen/wearable/20160312.015446 submit/tizen/20160311.224311
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 7 Mar 2016 12:11:59 +0000 (13:11 +0100)
committerTomasz Iwanek <t.iwanek@samsung.com>
Fri, 11 Mar 2016 10:32:32 +0000 (11:32 +0100)
Change-Id: I0d8c332d6b95261b846da9509d2942c18472ce2e

src/common/plugins/types/category_plugin.cc
src/common/plugins/types/metadata_plugin.cc

index d156197..f53b7dd 100644 (file)
@@ -58,13 +58,13 @@ bool CategoryPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest,
     return false;
   std::string name = GetFunctionName(action_type);
   for (application_x* app : GListRange<application_x*>(manifest->application)) {
-    // pack all categories starting with key + '/' to list that will
+    // pack all categories starting with key to list that will
     // be sent to the plugin.
     // e.g. all http://tizen.org/category/antivirus/*
     //   will be packed for http://tizen.org/category/antivirus
     GList* category_list = nullptr;
     for (const char* category : GListRange<char*>(app->category)) {
-      std::string sub_key_prefix = plugin_info_.name() + "/";
+      const std::string& sub_key_prefix = plugin_info_.name();
       if (std::string(category).find(sub_key_prefix) == 0) {
         __category_t* c = reinterpret_cast<__category_t*>(
             calloc(1, sizeof(__category_t)));
@@ -72,10 +72,13 @@ bool CategoryPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest,
         category_list = g_list_append(category_list, c);
       }
     }
+
+    // skip application if it has no given category
+    if (!category_list)
+      continue;
+
     int result = 0;
-    Exec(name, &result, category_list, tag.c_str(),
-         ActionTypeToPkgmgrActionType(action_type),
-         manifest->package, app->appid);
+    Exec(name, &result, manifest->package, app->appid, category_list);
     if (result) {
       LOG(ERROR) << "Function: " << name << " of plugin "
                  << plugin_info_.path() << " failed";
index 83ab117..25e495d 100644 (file)
@@ -59,13 +59,13 @@ bool MetadataPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest,
     return false;
   std::string name = GetFunctionName(action_type);
   for (application_x* app : GListRange<application_x*>(manifest->application)) {
-    // pack all metadata starting with key + '/' to list that will
+    // pack all metadata starting with key to list that will
     // be sent to the plugin.
     // e.g. all http://developer.samsung.com/tizen/metadata/profile/*
     //   will be packed for http://developer.samsung.com/tizen/metadata/profile
     GList* md_list = nullptr;
     for (metadata_x* meta : GListRange<metadata_x*>(app->metadata)) {
-      std::string sub_key_prefix = plugin_info_.name() + "/";
+      const std::string& sub_key_prefix = plugin_info_.name();
       if (meta->key && meta->value &&
           std::string(meta->key).find(sub_key_prefix) == 0) {
         __metadata_t* md = reinterpret_cast<__metadata_t*>(
@@ -75,10 +75,13 @@ bool MetadataPlugin::Run(xmlDocPtr /*doc_ptr*/, manifest_x* manifest,
         md_list = g_list_append(md_list, md);
       }
     }
+
+    // skip application if it has no given metadata
+    if (!md_list)
+      continue;
+
     int result = 0;
-    Exec(name, &result, md_list, tag.c_str(),
-         ActionTypeToPkgmgrActionType(action_type),
-         manifest->package, app->appid);
+    Exec(name, &result, manifest->package, app->appid, md_list);
     if (result) {
       LOG(ERROR) << "Function: " << name << " of plugin "
                  << plugin_info_.path() << " failed";